(options: FirebaseOptions = null, configOrName?: FirebaseConfig | string)
| 269 | } |
| 270 | |
| 271 | initializeApp(options: FirebaseOptions = null, configOrName?: FirebaseConfig | string) { |
| 272 | return new Promise((resolve, reject) => { |
| 273 | try { |
| 274 | let nativeOptions; |
| 275 | if (options) { |
| 276 | nativeOptions = new com.google.firebase.FirebaseOptions.Builder(); |
| 277 | } |
| 278 | if (options?.apiKey) { |
| 279 | nativeOptions.setApiKey(options.apiKey); |
| 280 | } |
| 281 | |
| 282 | if (options?.gcmSenderId) { |
| 283 | nativeOptions.setGcmSenderId(options.gcmSenderId); |
| 284 | } |
| 285 | |
| 286 | if (options?.databaseURL) { |
| 287 | nativeOptions.setDatabaseUrl(options.databaseURL); |
| 288 | } |
| 289 | |
| 290 | if (options?.googleAppId) { |
| 291 | nativeOptions.setApplicationId(options.googleAppId); |
| 292 | } |
| 293 | |
| 294 | if (options?.projectId) { |
| 295 | nativeOptions.setProjectId(options.projectId); |
| 296 | } |
| 297 | |
| 298 | if (options?.storageBucket) { |
| 299 | nativeOptions.setStorageBucket(options.storageBucket); |
| 300 | } |
| 301 | |
| 302 | if (options?.trackingId) { |
| 303 | nativeOptions.setGaTrackingId(options.trackingId); |
| 304 | } |
| 305 | |
| 306 | const name = typeof configOrName === 'string' ? configOrName : configOrName?.name; |
| 307 | let app: com.google.firebase.FirebaseApp; |
| 308 | let isDefault = false; |
| 309 | if (name) { |
| 310 | if (!nativeOptions) { |
| 311 | nativeOptions = new com.google.firebase.FirebaseOptions.Builder(); |
| 312 | } |
| 313 | app = com.google.firebase.FirebaseApp.initializeApp(Utils.android.getApplicationContext(), nativeOptions.build(), name); |
| 314 | } else { |
| 315 | if (defaultApp) { |
| 316 | resolve(defaultApp); |
| 317 | return; |
| 318 | } |
| 319 | isDefault = true; |
| 320 | if (nativeOptions) { |
| 321 | app = com.google.firebase.FirebaseApp.initializeApp(Utils.android.getApplicationContext(), nativeOptions.build()); |
| 322 | } else { |
| 323 | app = com.google.firebase.FirebaseApp.initializeApp(Utils.android.getApplicationContext()); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | console.log(app); |
| 328 |
nothing calls this directly
no test coverage detected