@react-native-firebase/auth 21.6.1 → 21.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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
+ ## [21.7.0](https://github.com/invertase/react-native-firebase/compare/v21.6.2...v21.7.0) (2025-01-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **auth, types:** instantiating OAuthProvider returns OAuthProvider ([e068e12](https://github.com/invertase/react-native-firebase/commit/e068e1210b053d05f5b76b763de3dff91d874969))
11
+
12
+ ## [21.6.2](https://github.com/invertase/react-native-firebase/compare/v21.6.1...v21.6.2) (2025-01-02)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **auth, expo:** plugin: skip expo-router on iOS for firebaseauth URLs ([#8203](https://github.com/invertase/react-native-firebase/issues/8203)) ([33744da](https://github.com/invertase/react-native-firebase/commit/33744da3535573d6ef752bc2c3d5d752bfca673f))
17
+
6
18
  ## [21.6.1](https://github.com/invertase/react-native-firebase/compare/v21.6.0...v21.6.1) (2024-11-25)
7
19
 
8
20
  **Note:** Version bump only for package @react-native-firebase/auth
package/lib/index.d.ts CHANGED
@@ -112,13 +112,13 @@ export namespace FirebaseAuthTypes {
112
112
  /**
113
113
  * Interface that represents an OAuth provider. Implemented by other providers.
114
114
  */
115
- export interface OAuthProvider {
115
+ export interface OAuthProvider extends AuthProvider {
116
116
  /**
117
117
  * The provider ID of the provider.
118
118
  * @param providerId
119
119
  */
120
120
  // eslint-disable-next-line @typescript-eslint/no-misused-new
121
- new (providerId: string): AuthProvider;
121
+ new (providerId: string): OAuthProvider;
122
122
  /**
123
123
  * Creates a new `AuthCredential`.
124
124
  *
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '21.6.1';
2
+ module.exports = '21.7.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/auth",
3
- "version": "21.6.1",
3
+ "version": "21.7.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - The authentication module provides an easy-to-use API to integrate an authentication workflow into new and existing applications. React Native Firebase provides access to all Firebase authentication methods and identity providers.",
6
6
  "main": "lib/index.js",
@@ -27,7 +27,7 @@
27
27
  "plist": "^3.1.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@react-native-firebase/app": "21.6.1",
30
+ "@react-native-firebase/app": "21.7.0",
31
31
  "expo": ">=47.0.0"
32
32
  },
33
33
  "devDependencies": {
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "3623a504a6d07fa148390bd3f97d6c06fea8955d"
45
+ "gitHead": "c027ef2d772882c091383b7ff81b65573f549b5d"
46
46
  }
@@ -0,0 +1,350 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Config Plugin iOS Tests - openUrlFix munges AppDelegate correctly - AppDelegate_bare_sdk43.m 1`] = `
4
+ "// This AppDelegate template is used in Expo SDK 43
5
+ // It is (nearly) identical to the pure template used when
6
+ // creating a bare React Native app (without Expo)
7
+
8
+ #import "AppDelegate.h"
9
+
10
+ #import <React/RCTBridge.h>
11
+ #import <React/RCTBundleURLProvider.h>
12
+ #import <React/RCTRootView.h>
13
+ #import <React/RCTLinkingManager.h>
14
+ #import <React/RCTConvert.h>
15
+
16
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
17
+ #import <FlipperKit/FlipperClient.h>
18
+ #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
19
+ #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
20
+ #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
21
+ #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
22
+ #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
23
+
24
+ static void InitializeFlipper(UIApplication *application) {
25
+ FlipperClient *client = [FlipperClient sharedClient];
26
+ SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
27
+ [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
28
+ [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
29
+ [client addPlugin:[FlipperKitReactPlugin new]];
30
+ [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
31
+ [client start];
32
+ }
33
+ #endif
34
+
35
+ @implementation AppDelegate
36
+
37
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
38
+ {
39
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
40
+ InitializeFlipper(application);
41
+ #endif
42
+
43
+ RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
44
+ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
45
+ id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
46
+ if (rootViewBackgroundColor != nil) {
47
+ rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
48
+ } else {
49
+ rootView.backgroundColor = [UIColor whiteColor];
50
+ }
51
+
52
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
53
+ UIViewController *rootViewController = [UIViewController new];
54
+ rootViewController.view = rootView;
55
+ self.window.rootViewController = rootViewController;
56
+ [self.window makeKeyAndVisible];
57
+
58
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
59
+
60
+ return YES;
61
+ }
62
+
63
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
64
+ {
65
+ // If you'd like to export some custom RCTBridgeModules, add them here!
66
+ return @[];
67
+ }
68
+
69
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
70
+ #ifdef DEBUG
71
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
72
+ #else
73
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
74
+ #endif
75
+ }
76
+
77
+ // Linking API
78
+ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
79
+ // @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
80
+ if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
81
+ // invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
82
+ return NO;
83
+ }
84
+ // @generated end @react-native-firebase/auth-openURL
85
+ return [RCTLinkingManager application:application openURL:url options:options];
86
+ }
87
+
88
+ // Universal Links
89
+ - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
90
+ return [RCTLinkingManager application:application
91
+ continueUserActivity:userActivity
92
+ restorationHandler:restorationHandler];
93
+ }
94
+
95
+ @end
96
+ "
97
+ `;
98
+
99
+ exports[`Config Plugin iOS Tests - openUrlFix munges AppDelegate correctly - AppDelegate_sdk44.m 1`] = `
100
+ "// This AppDelegate prebuild template is used in Expo SDK 44+
101
+ // It has the RCTBridge to be created by Expo ReactDelegate
102
+
103
+ #import "AppDelegate.h"
104
+
105
+ #import <React/RCTBridge.h>
106
+ #import <React/RCTBundleURLProvider.h>
107
+ #import <React/RCTRootView.h>
108
+ #import <React/RCTLinkingManager.h>
109
+ #import <React/RCTConvert.h>
110
+
111
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
112
+ #import <FlipperKit/FlipperClient.h>
113
+ #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
114
+ #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
115
+ #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
116
+ #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
117
+ #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
118
+
119
+ static void InitializeFlipper(UIApplication *application) {
120
+ FlipperClient *client = [FlipperClient sharedClient];
121
+ SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
122
+ [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
123
+ [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
124
+ [client addPlugin:[FlipperKitReactPlugin new]];
125
+ [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
126
+ [client start];
127
+ }
128
+ #endif
129
+
130
+ @implementation AppDelegate
131
+
132
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
133
+ {
134
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
135
+ InitializeFlipper(application);
136
+ #endif
137
+
138
+ RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
139
+ RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
140
+ rootView.backgroundColor = [UIColor whiteColor];
141
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
142
+ UIViewController *rootViewController = [self.reactDelegate createRootViewController];
143
+ rootViewController.view = rootView;
144
+ self.window.rootViewController = rootViewController;
145
+ [self.window makeKeyAndVisible];
146
+
147
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
148
+
149
+ return YES;
150
+ }
151
+
152
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
153
+ {
154
+ // If you'd like to export some custom RCTBridgeModules, add them here!
155
+ return @[];
156
+ }
157
+
158
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
159
+ #ifdef DEBUG
160
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
161
+ #else
162
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
163
+ #endif
164
+ }
165
+
166
+ // Linking API
167
+ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
168
+ // @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
169
+ if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
170
+ // invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
171
+ return NO;
172
+ }
173
+ // @generated end @react-native-firebase/auth-openURL
174
+ return [RCTLinkingManager application:application openURL:url options:options];
175
+ }
176
+
177
+ // Universal Links
178
+ - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
179
+ return [RCTLinkingManager application:application
180
+ continueUserActivity:userActivity
181
+ restorationHandler:restorationHandler];
182
+ }
183
+
184
+ @end
185
+ "
186
+ `;
187
+
188
+ exports[`Config Plugin iOS Tests - openUrlFix munges AppDelegate correctly - AppDelegate_sdk45.mm 1`] = `
189
+ "// RN 0.68.1, Expo SDK 45 template
190
+ // The main difference between this and the SDK 44 one is that this is
191
+ // using React Native 0.68 and is written in Objective-C++
192
+
193
+ #import "AppDelegate.h"
194
+
195
+ #import <React/RCTBridge.h>
196
+ #import <React/RCTBundleURLProvider.h>
197
+ #import <React/RCTRootView.h>
198
+ #import <React/RCTLinkingManager.h>
199
+ #import <React/RCTConvert.h>
200
+
201
+ #import <React/RCTAppSetupUtils.h>
202
+
203
+ #if RCT_NEW_ARCH_ENABLED
204
+ #import <React/CoreModulesPlugins.h>
205
+ #import <React/RCTCxxBridgeDelegate.h>
206
+ #import <React/RCTFabricSurfaceHostingProxyRootView.h>
207
+ #import <React/RCTSurfacePresenter.h>
208
+ #import <React/RCTSurfacePresenterBridgeAdapter.h>
209
+ #import <ReactCommon/RCTTurboModuleManager.h>
210
+
211
+ #import <react/config/ReactNativeConfig.h>
212
+
213
+ @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
214
+ RCTTurboModuleManager *_turboModuleManager;
215
+ RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
216
+ std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
217
+ facebook::react::ContextContainer::Shared _contextContainer;
218
+ }
219
+ @end
220
+ #endif
221
+
222
+ @implementation AppDelegate
223
+
224
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
225
+ {
226
+ RCTAppSetupPrepareApp(application);
227
+
228
+ RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
229
+
230
+ #if RCT_NEW_ARCH_ENABLED
231
+ _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
232
+ _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
233
+ _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
234
+ _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
235
+ bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
236
+ #endif
237
+
238
+ UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
239
+
240
+ rootView.backgroundColor = [UIColor whiteColor];
241
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
242
+ UIViewController *rootViewController = [self.reactDelegate createRootViewController];
243
+ rootViewController.view = rootView;
244
+ self.window.rootViewController = rootViewController;
245
+ [self.window makeKeyAndVisible];
246
+
247
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
248
+
249
+ return YES;
250
+ }
251
+
252
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
253
+ {
254
+ // If you'd like to export some custom RCTBridgeModules, add them here!
255
+ return @[];
256
+ }
257
+
258
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
259
+ {
260
+ #if DEBUG
261
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
262
+ #else
263
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
264
+ #endif
265
+ }
266
+
267
+ // Linking API
268
+ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
269
+ // @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
270
+ if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
271
+ // invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
272
+ return NO;
273
+ }
274
+ // @generated end @react-native-firebase/auth-openURL
275
+ return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
276
+ }
277
+
278
+ // Universal Links
279
+ - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
280
+ BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
281
+ return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;
282
+ }
283
+
284
+ #if RCT_NEW_ARCH_ENABLED
285
+
286
+ #pragma mark - RCTCxxBridgeDelegate
287
+
288
+ - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
289
+ {
290
+ _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
291
+ delegate:self
292
+ jsInvoker:bridge.jsCallInvoker];
293
+ return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
294
+ }
295
+
296
+ #pragma mark RCTTurboModuleManagerDelegate
297
+
298
+ - (Class)getModuleClassFromName:(const char *)name
299
+ {
300
+ return RCTCoreModulesClassProvider(name);
301
+ }
302
+
303
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
304
+ jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
305
+ {
306
+ return nullptr;
307
+ }
308
+
309
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
310
+ initParams:
311
+ (const facebook::react::ObjCTurboModule::InitParams &)params
312
+ {
313
+ return nullptr;
314
+ }
315
+
316
+ - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
317
+ {
318
+ return RCTAppSetupDefaultModuleFromClass(moduleClass);
319
+ }
320
+
321
+ #endif
322
+
323
+ @end
324
+ "
325
+ `;
326
+
327
+ exports[`Config Plugin iOS Tests - openUrlFix must match positiveTemplateCases[0] 1`] = `
328
+ "- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
329
+ // @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
330
+ if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
331
+ // invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
332
+ return NO;
333
+ }
334
+ // @generated end @react-native-firebase/auth-openURL
335
+ int x=3;"
336
+ `;
337
+
338
+ exports[`Config Plugin iOS Tests - openUrlFix must match positiveTemplateCases[3] 1`] = `
339
+ " - ( BOOL ) application : ( UIApplication* ) application openURL : ( NSURL*) url options : ( NSDictionary < UIApplicationOpenURLOptionsKey , id > *) options
340
+
341
+ {
342
+
343
+ // @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
344
+ if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
345
+ // invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
346
+ return NO;
347
+ }
348
+ // @generated end @react-native-firebase/auth-openURL
349
+ "
350
+ `;
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Config Plugin iOS Tests adds url types to the Info.plist 1`] = `
3
+ exports[`Config Plugin iOS Tests - urlTypes adds url types to the Info.plist 1`] = `
4
4
  {
5
5
  "CFBundleURLTypes": [
6
6
  {
@@ -0,0 +1,86 @@
1
+ // This AppDelegate template is used in Expo SDK 43
2
+ // It is (nearly) identical to the pure template used when
3
+ // creating a bare React Native app (without Expo)
4
+
5
+ #import "AppDelegate.h"
6
+
7
+ #import <React/RCTBridge.h>
8
+ #import <React/RCTBundleURLProvider.h>
9
+ #import <React/RCTRootView.h>
10
+ #import <React/RCTLinkingManager.h>
11
+ #import <React/RCTConvert.h>
12
+
13
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
14
+ #import <FlipperKit/FlipperClient.h>
15
+ #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
16
+ #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
17
+ #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
18
+ #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
19
+ #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
20
+
21
+ static void InitializeFlipper(UIApplication *application) {
22
+ FlipperClient *client = [FlipperClient sharedClient];
23
+ SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
24
+ [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
25
+ [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
26
+ [client addPlugin:[FlipperKitReactPlugin new]];
27
+ [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
28
+ [client start];
29
+ }
30
+ #endif
31
+
32
+ @implementation AppDelegate
33
+
34
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
35
+ {
36
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
37
+ InitializeFlipper(application);
38
+ #endif
39
+
40
+ RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
41
+ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
42
+ id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
43
+ if (rootViewBackgroundColor != nil) {
44
+ rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
45
+ } else {
46
+ rootView.backgroundColor = [UIColor whiteColor];
47
+ }
48
+
49
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
50
+ UIViewController *rootViewController = [UIViewController new];
51
+ rootViewController.view = rootView;
52
+ self.window.rootViewController = rootViewController;
53
+ [self.window makeKeyAndVisible];
54
+
55
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
56
+
57
+ return YES;
58
+ }
59
+
60
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
61
+ {
62
+ // If you'd like to export some custom RCTBridgeModules, add them here!
63
+ return @[];
64
+ }
65
+
66
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
67
+ #ifdef DEBUG
68
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
69
+ #else
70
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
71
+ #endif
72
+ }
73
+
74
+ // Linking API
75
+ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
76
+ return [RCTLinkingManager application:application openURL:url options:options];
77
+ }
78
+
79
+ // Universal Links
80
+ - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
81
+ return [RCTLinkingManager application:application
82
+ continueUserActivity:userActivity
83
+ restorationHandler:restorationHandler];
84
+ }
85
+
86
+ @end
@@ -0,0 +1,46 @@
1
+ // This AppDelegate template is modified to have RCTBridge
2
+ // created in some non-standard way or not created at all.
3
+ // This should trigger the fallback regex in iOS AppDelegate Expo plugin.
4
+
5
+ // some parts omitted to be short
6
+
7
+ #import "AppDelegate.h"
8
+
9
+ #import <React/RCTBridge.h>
10
+ #import <React/RCTBundleURLProvider.h>
11
+ #import <React/RCTRootView.h>
12
+ #import <React/RCTLinkingManager.h>
13
+ #import <React/RCTConvert.h>
14
+
15
+ @implementation AppDelegate
16
+
17
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
18
+ {
19
+
20
+ // The generated code should appear above ^^^
21
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
22
+ InitializeFlipper(application);
23
+ #endif
24
+
25
+ // the line below is malfolmed not to be matched by the Expo plugin regex
26
+ // RCTBridge* briddge = [RCTBridge new];
27
+ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:briddge moduleName:@"main" initialProperties:nil];
28
+ id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
29
+ if (rootViewBackgroundColor != nil) {
30
+ rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
31
+ } else {
32
+ rootView.backgroundColor = [UIColor whiteColor];
33
+ }
34
+
35
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
36
+ UIViewController *rootViewController = [UIViewController new];
37
+ rootViewController.view = rootView;
38
+ self.window.rootViewController = rootViewController;
39
+ [self.window makeKeyAndVisible];
40
+
41
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
42
+
43
+ return YES;
44
+ }
45
+
46
+ @end
@@ -0,0 +1,102 @@
1
+ // This AppDelegate prebuild template is used in Expo SDK 42 and older
2
+ // It expects the old react-native-unimodules architecture (UM* prefix)
3
+
4
+ #import "AppDelegate.h"
5
+
6
+ #import <React/RCTBridge.h>
7
+ #import <React/RCTBundleURLProvider.h>
8
+ #import <React/RCTRootView.h>
9
+ #import <React/RCTLinkingManager.h>
10
+
11
+ #import <UMCore/UMModuleRegistry.h>
12
+ #import <UMReactNativeAdapter/UMNativeModulesProxy.h>
13
+ #import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
14
+ #import <EXSplashScreen/EXSplashScreenService.h>
15
+ #import <UMCore/UMModuleRegistryProvider.h>
16
+
17
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
18
+ #import <FlipperKit/FlipperClient.h>
19
+ #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
20
+ #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
21
+ #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
22
+ #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
23
+ #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
24
+
25
+ static void InitializeFlipper(UIApplication *application) {
26
+ FlipperClient *client = [FlipperClient sharedClient];
27
+ SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
28
+ [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
29
+ [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
30
+ [client addPlugin:[FlipperKitReactPlugin new]];
31
+ [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
32
+ [client start];
33
+ }
34
+ #endif
35
+
36
+ @interface AppDelegate () <RCTBridgeDelegate>
37
+
38
+ @property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
39
+ @property (nonatomic, strong) NSDictionary *launchOptions;
40
+
41
+ @end
42
+
43
+ @implementation AppDelegate
44
+
45
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
46
+ {
47
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
48
+ InitializeFlipper(application);
49
+ #endif
50
+
51
+ self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
52
+ self.launchOptions = launchOptions;
53
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
54
+ #ifdef DEBUG
55
+ [self initializeReactNativeApp];
56
+ #else
57
+ EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
58
+ controller.delegate = self;
59
+ [controller startAndShowLaunchScreen:self.window];
60
+ #endif
61
+
62
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
63
+
64
+ return YES;
65
+ }
66
+
67
+ - (RCTBridge *)initializeReactNativeApp
68
+ {
69
+ RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
70
+ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
71
+ rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
72
+
73
+ UIViewController *rootViewController = [UIViewController new];
74
+ rootViewController.view = rootView;
75
+ self.window.rootViewController = rootViewController;
76
+ [self.window makeKeyAndVisible];
77
+
78
+ return bridge;
79
+ }
80
+
81
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
82
+ {
83
+ NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
84
+ // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!
85
+ return extraModules;
86
+ }
87
+
88
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
89
+ #ifdef DEBUG
90
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
91
+ #else
92
+ return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
93
+ #endif
94
+ }
95
+
96
+ - (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success {
97
+ appController.bridge = [self initializeReactNativeApp];
98
+ EXSplashScreenService *splashScreenService = (EXSplashScreenService *)[UMModuleRegistryProvider getSingletonModuleForClass:[EXSplashScreenService class]];
99
+ [splashScreenService showSplashScreenFor:self.window.rootViewController];
100
+ }
101
+
102
+ @end