| 313 | } |
| 314 | |
| 315 | initializeApp(options: FirebaseOptions = null, configOrName?: FirebaseConfig | string) { |
| 316 | return new Promise((resolve, reject) => { |
| 317 | const initApp = () => { |
| 318 | try { |
| 319 | const name = typeof configOrName === 'string' ? configOrName : configOrName?.name; |
| 320 | let nativeOptions: FIROptions; |
| 321 | if (name) { |
| 322 | nativeOptions = FIROptions.alloc().initWithGoogleAppIDGCMSenderID(options.googleAppId, options.gcmSenderId); |
| 323 | } |
| 324 | |
| 325 | if (!nativeOptions && options) { |
| 326 | nativeOptions = FIROptions.defaultOptions(); |
| 327 | } |
| 328 | |
| 329 | if (options?.apiKey) { |
| 330 | nativeOptions.APIKey = options.apiKey; |
| 331 | } |
| 332 | |
| 333 | if (options?.gcmSenderId) { |
| 334 | nativeOptions.GCMSenderID = options.gcmSenderId; |
| 335 | } |
| 336 | |
| 337 | if (options?.androidClientId) { |
| 338 | nativeOptions.androidClientID = options.androidClientId; |
| 339 | } |
| 340 | |
| 341 | if (options?.appGroupId) { |
| 342 | nativeOptions.appGroupID = options.appGroupId; |
| 343 | } |
| 344 | |
| 345 | if (options?.bundleId) { |
| 346 | nativeOptions.bundleID = options.bundleId; |
| 347 | } |
| 348 | |
| 349 | if (options?.clientId) { |
| 350 | nativeOptions.clientID = options.clientId; |
| 351 | } |
| 352 | |
| 353 | if (options?.databaseURL) { |
| 354 | nativeOptions.databaseURL = options.databaseURL; |
| 355 | } |
| 356 | |
| 357 | if (options?.deepLinkURLScheme) { |
| 358 | nativeOptions.deepLinkURLScheme = options.deepLinkURLScheme; |
| 359 | } |
| 360 | |
| 361 | if (options?.googleAppId) { |
| 362 | nativeOptions.googleAppID = options.googleAppId; |
| 363 | } |
| 364 | |
| 365 | if (options?.projectId) { |
| 366 | nativeOptions.projectID = options.projectId; |
| 367 | } |
| 368 | |
| 369 | if (options?.storageBucket) { |
| 370 | nativeOptions.storageBucket = options.storageBucket; |
| 371 | } |
| 372 | |