@react-native-firebase/app 18.7.3 → 18.8.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [18.8.0](https://github.com/invertase/react-native-firebase/compare/v18.7.3...v18.8.0) (2024-01-25)
7
+
8
+ ### Features
9
+
10
+ - **auth, authDomain:** implement FirebaseOptions.authDomain on Auth ([a1f4710](https://github.com/invertase/react-native-firebase/commit/a1f471029352b7597d7e83a8c1ea06145768cf89))
11
+
12
+ ### Bug Fixes
13
+
14
+ - **app:** firebase-ios-sdk 10.20.0 / firebase-android-sdk 32.7.1 ([8d3c3a0](https://github.com/invertase/react-native-firebase/commit/8d3c3a02689d8ec7dd7d705adb941808039cdd50))
15
+
6
16
  ## [18.7.3](https://github.com/invertase/react-native-firebase/compare/v18.7.2...v18.7.3) (2023-12-13)
7
17
 
8
18
  ### Bug Fixes
@@ -17,6 +17,7 @@ package io.invertase.firebase.app;
17
17
  *
18
18
  */
19
19
 
20
+ import android.util.Log;
20
21
  import com.facebook.react.bridge.Promise;
21
22
  import com.facebook.react.bridge.ReactApplicationContext;
22
23
  import com.facebook.react.bridge.ReactMethod;
@@ -38,6 +39,8 @@ import java.util.Map;
38
39
  public class ReactNativeFirebaseAppModule extends ReactNativeFirebaseModule {
39
40
  private static final String TAG = "App";
40
41
 
42
+ public static Map<String, String> authDomains = new HashMap<>();
43
+
41
44
  ReactNativeFirebaseAppModule(ReactApplicationContext reactContext) {
42
45
  super(reactContext, TAG);
43
46
  }
@@ -52,11 +55,22 @@ public class ReactNativeFirebaseAppModule extends ReactNativeFirebaseModule {
52
55
  public void initializeApp(ReadableMap options, ReadableMap appConfig, Promise promise) {
53
56
  FirebaseApp firebaseApp =
54
57
  RCTConvertFirebase.readableMapToFirebaseApp(options, appConfig, getContext());
58
+ ReactNativeFirebaseAppModule.configureAuthDomain(
59
+ appConfig.getString("name"), options.getString("authDomain"));
55
60
 
56
61
  WritableMap firebaseAppMap = RCTConvertFirebase.firebaseAppToWritableMap(firebaseApp);
57
62
  promise.resolve(firebaseAppMap);
58
63
  }
59
64
 
65
+ public static void configureAuthDomain(String name, String authDomain) {
66
+ if (authDomain != null) {
67
+ Log.d(TAG, name + " custom authDomain " + authDomain);
68
+ authDomains.put(name, authDomain);
69
+ } else {
70
+ authDomains.remove(name);
71
+ }
72
+ }
73
+
60
74
  @ReactMethod
61
75
  public void setAutomaticDataCollectionEnabled(String appName, Boolean enabled) {
62
76
  FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
@@ -18,5 +18,5 @@ package io.invertase.firebase.app;
18
18
  */
19
19
  // generated file - do not modify or commit
20
20
  public class ReactNativeFirebaseVersion {
21
- public static String VERSION = "18.7.3";
21
+ public static String VERSION = "18.8.0";
22
22
  }
@@ -25,6 +25,7 @@ import com.facebook.react.bridge.ReadableMap;
25
25
  import com.facebook.react.bridge.WritableMap;
26
26
  import com.google.firebase.FirebaseApp;
27
27
  import com.google.firebase.FirebaseOptions;
28
+ import io.invertase.firebase.app.ReactNativeFirebaseAppModule;
28
29
  import java.util.HashMap;
29
30
  import java.util.List;
30
31
  import java.util.Map;
@@ -56,6 +57,10 @@ public class RCTConvertFirebase {
56
57
  options.put("messagingSenderId", appOptions.getGcmSenderId());
57
58
  options.put("storageBucket", appOptions.getStorageBucket());
58
59
 
60
+ if (ReactNativeFirebaseAppModule.authDomains.get(name) != null) {
61
+ options.put("authDomain", ReactNativeFirebaseAppModule.authDomains.get(name));
62
+ }
63
+
59
64
  root.put("options", options);
60
65
  root.put("appConfig", appConfig);
61
66
 
@@ -21,6 +21,8 @@
21
21
 
22
22
  @interface RNFBAppModule : NSObject <RCTBridgeModule>
23
23
 
24
+ + (NSString *)getCustomDomain:(NSString *)appName;
25
+
24
26
  - (void)setLogLevel:(NSString *)logLevel;
25
27
 
26
28
  @end
@@ -168,7 +168,7 @@ RCT_EXPORT_METHOD(removeListeners : (NSInteger)count) {
168
168
  #pragma mark Firebase App Methods
169
169
 
170
170
  RCT_EXPORT_METHOD(initializeApp
171
- : (FIROptions *)firOptions appConfig
171
+ : (NSDictionary *)options appConfig
172
172
  : (NSDictionary *)appConfig resolver
173
173
  : (RCTPromiseResolveBlock)resolve rejecter
174
174
  : (RCTPromiseRejectBlock)reject) {
@@ -176,6 +176,44 @@ RCT_EXPORT_METHOD(initializeApp
176
176
  FIRApp *firApp;
177
177
  NSString *appName = [appConfig valueForKey:@"name"];
178
178
 
179
+ NSString *appId = [options valueForKey:@"appId"];
180
+ NSString *messagingSenderId = [options valueForKey:@"messagingSenderId"];
181
+ FIROptions *firOptions = [[FIROptions alloc] initWithGoogleAppID:appId
182
+ GCMSenderID:messagingSenderId];
183
+ firOptions.APIKey = [options valueForKey:@"apiKey"];
184
+ firOptions.projectID = [options valueForKey:@"projectId"];
185
+ // kFirebaseOptionsDatabaseUrl
186
+ if (![[options valueForKey:@"databaseURL"] isEqual:[NSNull null]]) {
187
+ firOptions.databaseURL = [options valueForKey:@"databaseURL"];
188
+ }
189
+ // kFirebaseOptionsStorageBucket
190
+ if (![[options valueForKey:@"storageBucket"] isEqual:[NSNull null]]) {
191
+ firOptions.storageBucket = [options valueForKey:@"storageBucket"];
192
+ }
193
+ // kFirebaseOptionsDeepLinkURLScheme
194
+ if (![[options valueForKey:@"deepLinkURLScheme"] isEqual:[NSNull null]]) {
195
+ firOptions.deepLinkURLScheme = [options valueForKey:@"deepLinkURLScheme"];
196
+ }
197
+ // kFirebaseOptionsIosBundleId
198
+ if (![[options valueForKey:@"iosBundleId"] isEqual:[NSNull null]]) {
199
+ firOptions.bundleID = [options valueForKey:@"iosBundleId"];
200
+ }
201
+ // kFirebaseOptionsIosClientId
202
+ if (![[options valueForKey:@"iosClientId"] isEqual:[NSNull null]]) {
203
+ firOptions.clientID = [options valueForKey:@"iosClientId"];
204
+ }
205
+ // kFirebaseOptionsAppGroupId
206
+ if (![[options valueForKey:@"appGroupId"] isEqual:[NSNull null]]) {
207
+ firOptions.appGroupID = [options valueForKey:@"appGroupId"];
208
+ }
209
+
210
+ if ([options valueForKey:@"authDomain"] != nil) {
211
+ DLog(@"RNFBAuth app: %@ customAuthDomain: %@", appName, [options valueForKey:@"authDomain"]);
212
+ if (customAuthDomains == nil) {
213
+ customAuthDomains = [[NSMutableDictionary alloc] init];
214
+ }
215
+ customAuthDomains[appName] = [options valueForKey:@"authDomain"];
216
+ }
179
217
  @try {
180
218
  if (!appName || [appName isEqualToString:DEFAULT_APP_DISPLAY_NAME]) {
181
219
  [FIRApp configureWithOptions:firOptions];
@@ -195,6 +233,13 @@ RCT_EXPORT_METHOD(initializeApp
195
233
  });
196
234
  }
197
235
 
236
+ static NSMutableDictionary<NSString *, NSString *> *customAuthDomains;
237
+
238
+ + (NSString *)getCustomDomain:(NSString *)appName {
239
+ DLog(@"authDomains: %@", customAuthDomains);
240
+ return customAuthDomains[appName];
241
+ }
242
+
198
243
  RCT_EXPORT_METHOD(setLogLevel : (NSString *)logLevel) {
199
244
  int level = FIRLoggerLevelError;
200
245
  if ([logLevel isEqualToString:@"verbose"]) {
@@ -16,6 +16,7 @@
16
16
  */
17
17
 
18
18
  #import "RNFBSharedUtils.h"
19
+ #import "RNFBAppModule.h"
19
20
  #import "RNFBJSON.h"
20
21
  #import "RNFBMeta.h"
21
22
  #import "RNFBPreferences.h"
@@ -65,6 +66,10 @@ static NSString *const RNFBErrorDomain = @"RNFBErrorDomain";
65
66
  firAppOptions[@"clientId"] = firOptions.clientID;
66
67
  firAppOptions[@"androidClientID"] = firOptions.androidClientID;
67
68
  firAppOptions[@"deepLinkUrlScheme"] = firOptions.deepLinkURLScheme;
69
+ // not in FIROptions API but in JS SDK and project config JSON
70
+ if ([RNFBAppModule getCustomDomain:name] != nil) {
71
+ firAppOptions[@"authDomain"] = [RNFBAppModule getCustomDomain:name];
72
+ }
68
73
 
69
74
  firAppDictionary[@"options"] = firAppOptions;
70
75
  firAppDictionary[@"appConfig"] = firAppConfig;
@@ -18,4 +18,4 @@
18
18
  #import <React/RCTVersion.h>
19
19
 
20
20
  // generated file - do not modify or commit
21
- NSString* const RNFBVersionString = @"18.7.3";
21
+ NSString* const RNFBVersionString = @"18.8.0";
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '18.7.3';
2
+ module.exports = '18.8.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/app",
3
- "version": "18.7.3",
3
+ "version": "18.8.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Storage and more.",
6
6
  "main": "lib/index.js",
@@ -73,7 +73,7 @@
73
73
  },
74
74
  "sdkVersions": {
75
75
  "ios": {
76
- "firebase": "10.19.0",
76
+ "firebase": "10.20.0",
77
77
  "iosTarget": "11.0",
78
78
  "macosTarget": "10.13"
79
79
  },
@@ -81,12 +81,12 @@
81
81
  "minSdk": 19,
82
82
  "targetSdk": 33,
83
83
  "compileSdk": 33,
84
- "firebase": "32.7.0",
84
+ "firebase": "32.7.1",
85
85
  "firebaseCrashlyticsGradle": "2.9.9",
86
86
  "firebasePerfGradle": "1.4.2",
87
87
  "gmsGoogleServicesGradle": "4.4.0",
88
88
  "playServicesAuth": "20.7.0"
89
89
  }
90
90
  },
91
- "gitHead": "605a0df8171c451513125629355027bda2ea5e5d"
91
+ "gitHead": "970756d733e1c4642b53d91c5b1b8f58a8f5dbc0"
92
92
  }