@react-native-firebase/app-check 19.0.1 → 19.1.1

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
+ ## [19.1.1](https://github.com/invertase/react-native-firebase/compare/v19.1.0...v19.1.1) (2024-03-26)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **app-check, expo:** ensure config plugin is built before using ([#7704](https://github.com/invertase/react-native-firebase/issues/7704)) ([873130c](https://github.com/invertase/react-native-firebase/commit/873130c11595690924cf60feb08b64b3b9421042))
11
+
12
+ ## [19.1.0](https://github.com/invertase/react-native-firebase/compare/v19.0.1...v19.1.0) (2024-03-23)
13
+
14
+ ### Features
15
+
16
+ - **app-check, expo:** add config plugin for iOS module initialization ([#7662](https://github.com/invertase/react-native-firebase/issues/7662)) ([c6e813e](https://github.com/invertase/react-native-firebase/commit/c6e813e1d73b464e48525b16b447a808b15ae2b3))
17
+
6
18
  ## [19.0.1](https://github.com/invertase/react-native-firebase/compare/v19.0.0...v19.0.1) (2024-03-07)
7
19
 
8
20
  **Note:** Version bump only for package @react-native-firebase/app-check
package/app.plugin.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./plugin/build');
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '19.0.1';
2
+ module.exports = '19.1.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/app-check",
3
- "version": "19.0.1",
3
+ "version": "19.1.1",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - App Check",
6
6
  "main": "lib/index.js",
@@ -8,7 +8,9 @@
8
8
  "scripts": {
9
9
  "build": "genversion --semi lib/version.js",
10
10
  "build:clean": "rimraf android/build && rimraf ios/build",
11
- "prepare": "yarn run build"
11
+ "build:plugin": "rimraf plugin/build && tsc --build plugin",
12
+ "lint:plugin": "eslint plugin/src/*",
13
+ "prepare": "yarn run build && yarn run build:plugin"
12
14
  },
13
15
  "repository": {
14
16
  "type": "git",
@@ -23,10 +25,19 @@
23
25
  "appCheck"
24
26
  ],
25
27
  "peerDependencies": {
26
- "@react-native-firebase/app": "19.0.1"
28
+ "@react-native-firebase/app": "19.1.1",
29
+ "expo": ">=47.0.0"
30
+ },
31
+ "devDependencies": {
32
+ "expo": "^49.0.21"
33
+ },
34
+ "peerDependenciesMeta": {
35
+ "expo": {
36
+ "optional": true
37
+ }
27
38
  },
28
39
  "publishConfig": {
29
40
  "access": "public"
30
41
  },
31
- "gitHead": "fae5966f2220706a5f5375d94dcdafbcc3c37440"
42
+ "gitHead": "2cee82424b7191c83d5378209a31cb73cbf8bd0a"
32
43
  }
@@ -0,0 +1,19 @@
1
+ ## Expo Config Plugin unit tests
2
+
3
+ To test the changes to native code applied by config plugins, [snapshot tests](https://jestjs.io/docs/snapshot-testing) are used. Plugin test flow, in short:
4
+
5
+ 1. A test fixture is loaded. In this case, fixtures are template files (`build.gradle`, `AppDelegate.m` etc.) from [`expo-template-bare-minimum`](https://github.com/expo/expo/tree/main/templates/expo-template-bare-minimum).
6
+ 2. Plugin changes are applied (e.g. gradle dependency is added).
7
+ 3. Modified file is compared with previously saved snapshot. If they're equal, the test passes. If not, the test fails and the difference (actual vs expected) is shown.
8
+
9
+ You can preview the snapshot files manually, by opening `__snapshots__/*.snap` files.
10
+
11
+ ### Updating the snapshots
12
+
13
+ Snapshot tests are designed to ensure the plugin result will not change. In case you intentionally modified the plugin behavior (e.g. updated gradle dependency versions), you have to update the snapshots, otherwise the tests will fail. There are two ways to do it:
14
+
15
+ - Update all snapshots by running `npm run tests:jest -u`.
16
+ - Update snapshots interactively, one by one:
17
+ 1. Run `yarn tests:jest --watchAll`
18
+ 2. Press `i` to let `jest` display changes and prompt you for updating each snapshot.
19
+ > This option is not available, when there are no failing snapshots
@@ -0,0 +1,483 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m (SDK 43) 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
+ #import <RNFBAppCheckModule.h>
10
+
11
+ #import <React/RCTBridge.h>
12
+ #import <React/RCTBundleURLProvider.h>
13
+ #import <React/RCTRootView.h>
14
+ #import <React/RCTLinkingManager.h>
15
+ #import <React/RCTConvert.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
+ @implementation AppDelegate
37
+
38
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
39
+ {
40
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
41
+ InitializeFlipper(application);
42
+ #endif
43
+
44
+ // @generated begin @react-native-firebase/app-check-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-39c06fe0cc03ffe4bc9cc005b839c559e7ba13d2
45
+ [RNFBAppCheckModule sharedInstance];
46
+ // @generated end @react-native-firebase/app-check-didFinishLaunchingWithOptions
47
+ RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
48
+ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
49
+ id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
50
+ if (rootViewBackgroundColor != nil) {
51
+ rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
52
+ } else {
53
+ rootView.backgroundColor = [UIColor whiteColor];
54
+ }
55
+
56
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
57
+ UIViewController *rootViewController = [UIViewController new];
58
+ rootViewController.view = rootView;
59
+ self.window.rootViewController = rootViewController;
60
+ [self.window makeKeyAndVisible];
61
+
62
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
63
+
64
+ return YES;
65
+ }
66
+
67
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
68
+ {
69
+ // If you'd like to export some custom RCTBridgeModules, add them here!
70
+ return @[];
71
+ }
72
+
73
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
74
+ #ifdef DEBUG
75
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
76
+ #else
77
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
78
+ #endif
79
+ }
80
+
81
+ // Linking API
82
+ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
83
+ return [RCTLinkingManager application:application openURL:url options:options];
84
+ }
85
+
86
+ // Universal Links
87
+ - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
88
+ return [RCTLinkingManager application:application
89
+ continueUserActivity:userActivity
90
+ restorationHandler:restorationHandler];
91
+ }
92
+
93
+ @end
94
+ "
95
+ `;
96
+
97
+ exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m with Expo ReactDelegate support (SDK 44+) 1`] = `
98
+ "// This AppDelegate prebuild template is used in Expo SDK 44+
99
+ // It has the RCTBridge to be created by Expo ReactDelegate
100
+
101
+ #import "AppDelegate.h"
102
+ #import <RNFBAppCheckModule.h>
103
+
104
+ #import <React/RCTBridge.h>
105
+ #import <React/RCTBundleURLProvider.h>
106
+ #import <React/RCTRootView.h>
107
+ #import <React/RCTLinkingManager.h>
108
+ #import <React/RCTConvert.h>
109
+
110
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
111
+ #import <FlipperKit/FlipperClient.h>
112
+ #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
113
+ #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
114
+ #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
115
+ #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
116
+ #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
117
+
118
+ static void InitializeFlipper(UIApplication *application) {
119
+ FlipperClient *client = [FlipperClient sharedClient];
120
+ SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
121
+ [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
122
+ [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
123
+ [client addPlugin:[FlipperKitReactPlugin new]];
124
+ [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
125
+ [client start];
126
+ }
127
+ #endif
128
+
129
+ @implementation AppDelegate
130
+
131
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
132
+ {
133
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
134
+ InitializeFlipper(application);
135
+ #endif
136
+
137
+ // @generated begin @react-native-firebase/app-check-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-39c06fe0cc03ffe4bc9cc005b839c559e7ba13d2
138
+ [RNFBAppCheckModule sharedInstance];
139
+ // @generated end @react-native-firebase/app-check-didFinishLaunchingWithOptions
140
+ RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
141
+ RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
142
+ rootView.backgroundColor = [UIColor whiteColor];
143
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
144
+ UIViewController *rootViewController = [self.reactDelegate createRootViewController];
145
+ rootViewController.view = rootView;
146
+ self.window.rootViewController = rootViewController;
147
+ [self.window makeKeyAndVisible];
148
+
149
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
150
+
151
+ return YES;
152
+ }
153
+
154
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
155
+ {
156
+ // If you'd like to export some custom RCTBridgeModules, add them here!
157
+ return @[];
158
+ }
159
+
160
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
161
+ #ifdef DEBUG
162
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
163
+ #else
164
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
165
+ #endif
166
+ }
167
+
168
+ // Linking API
169
+ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
170
+ return [RCTLinkingManager application:application openURL:url options:options];
171
+ }
172
+
173
+ // Universal Links
174
+ - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
175
+ return [RCTLinkingManager application:application
176
+ continueUserActivity:userActivity
177
+ restorationHandler:restorationHandler];
178
+ }
179
+
180
+ @end
181
+ "
182
+ `;
183
+
184
+ exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m with fallback regex (if the original one fails) 1`] = `
185
+ "// This AppDelegate template is modified to have RCTBridge
186
+ // created in some non-standard way or not created at all.
187
+ // This should trigger the fallback regex in iOS AppDelegate Expo plugin.
188
+
189
+ // some parts omitted to be short
190
+
191
+ #import "AppDelegate.h"
192
+ #import <RNFBAppCheckModule.h>
193
+
194
+ #import <React/RCTBridge.h>
195
+ #import <React/RCTBundleURLProvider.h>
196
+ #import <React/RCTRootView.h>
197
+ #import <React/RCTLinkingManager.h>
198
+ #import <React/RCTConvert.h>
199
+
200
+ @implementation AppDelegate
201
+
202
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
203
+ {
204
+ // @generated begin @react-native-firebase/app-didFinishLaunchingWithOptions-fallback - expo prebuild (DO NOT MODIFY) sync-39c06fe0cc03ffe4bc9cc005b839c559e7ba13d2
205
+ [RNFBAppCheckModule sharedInstance];
206
+ // @generated end @react-native-firebase/app-didFinishLaunchingWithOptions-fallback
207
+
208
+ // The generated code should appear above ^^^
209
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
210
+ InitializeFlipper(application);
211
+ #endif
212
+
213
+ // the line below is malfolmed not to be matched by the Expo plugin regex
214
+ // RCTBridge* briddge = [RCTBridge new];
215
+ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:briddge moduleName:@"main" initialProperties:nil];
216
+ id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
217
+ if (rootViewBackgroundColor != nil) {
218
+ rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
219
+ } else {
220
+ rootView.backgroundColor = [UIColor whiteColor];
221
+ }
222
+
223
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
224
+ UIViewController *rootViewController = [UIViewController new];
225
+ rootViewController.view = rootView;
226
+ self.window.rootViewController = rootViewController;
227
+ [self.window makeKeyAndVisible];
228
+
229
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
230
+
231
+ return YES;
232
+ }
233
+
234
+ @end
235
+ "
236
+ `;
237
+
238
+ exports[`Config Plugin iOS Tests tests changes made to old AppDelegate.m (SDK 42) 1`] = `
239
+ "// This AppDelegate prebuild template is used in Expo SDK 42 and older
240
+ // It expects the old react-native-unimodules architecture (UM* prefix)
241
+
242
+ #import "AppDelegate.h"
243
+ #import <RNFBAppCheckModule.h>
244
+
245
+ #import <React/RCTBridge.h>
246
+ #import <React/RCTBundleURLProvider.h>
247
+ #import <React/RCTRootView.h>
248
+ #import <React/RCTLinkingManager.h>
249
+
250
+ #import <UMCore/UMModuleRegistry.h>
251
+ #import <UMReactNativeAdapter/UMNativeModulesProxy.h>
252
+ #import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
253
+ #import <EXSplashScreen/EXSplashScreenService.h>
254
+ #import <UMCore/UMModuleRegistryProvider.h>
255
+
256
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
257
+ #import <FlipperKit/FlipperClient.h>
258
+ #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
259
+ #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
260
+ #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
261
+ #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
262
+ #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
263
+
264
+ static void InitializeFlipper(UIApplication *application) {
265
+ FlipperClient *client = [FlipperClient sharedClient];
266
+ SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
267
+ [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
268
+ [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
269
+ [client addPlugin:[FlipperKitReactPlugin new]];
270
+ [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
271
+ [client start];
272
+ }
273
+ #endif
274
+
275
+ @interface AppDelegate () <RCTBridgeDelegate>
276
+
277
+ @property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
278
+ @property (nonatomic, strong) NSDictionary *launchOptions;
279
+
280
+ @end
281
+
282
+ @implementation AppDelegate
283
+
284
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
285
+ {
286
+ #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
287
+ InitializeFlipper(application);
288
+ #endif
289
+
290
+ // @generated begin @react-native-firebase/app-check-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-39c06fe0cc03ffe4bc9cc005b839c559e7ba13d2
291
+ [RNFBAppCheckModule sharedInstance];
292
+ // @generated end @react-native-firebase/app-check-didFinishLaunchingWithOptions
293
+ self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
294
+ self.launchOptions = launchOptions;
295
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
296
+ #ifdef DEBUG
297
+ [self initializeReactNativeApp];
298
+ #else
299
+ EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
300
+ controller.delegate = self;
301
+ [controller startAndShowLaunchScreen:self.window];
302
+ #endif
303
+
304
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
305
+
306
+ return YES;
307
+ }
308
+
309
+ - (RCTBridge *)initializeReactNativeApp
310
+ {
311
+ RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
312
+ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
313
+ rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
314
+
315
+ UIViewController *rootViewController = [UIViewController new];
316
+ rootViewController.view = rootView;
317
+ self.window.rootViewController = rootViewController;
318
+ [self.window makeKeyAndVisible];
319
+
320
+ return bridge;
321
+ }
322
+
323
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
324
+ {
325
+ NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
326
+ // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!
327
+ return extraModules;
328
+ }
329
+
330
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
331
+ #ifdef DEBUG
332
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
333
+ #else
334
+ return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
335
+ #endif
336
+ }
337
+
338
+ - (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success {
339
+ appController.bridge = [self initializeReactNativeApp];
340
+ EXSplashScreenService *splashScreenService = (EXSplashScreenService *)[UMModuleRegistryProvider getSingletonModuleForClass:[EXSplashScreenService class]];
341
+ [splashScreenService showSplashScreenFor:self.window.rootViewController];
342
+ }
343
+
344
+ @end
345
+ "
346
+ `;
347
+
348
+ exports[`Config Plugin iOS Tests works with AppDelegate.mm (RN 0.68+) 1`] = `
349
+ "// RN 0.68.1, Expo SDK 45 template
350
+ // The main difference between this and the SDK 44 one is that this is
351
+ // using React Native 0.68 and is written in Objective-C++
352
+
353
+ #import "AppDelegate.h"
354
+ #import <RNFBAppCheckModule.h>
355
+
356
+ #import <React/RCTBridge.h>
357
+ #import <React/RCTBundleURLProvider.h>
358
+ #import <React/RCTRootView.h>
359
+ #import <React/RCTLinkingManager.h>
360
+ #import <React/RCTConvert.h>
361
+
362
+ #import <React/RCTAppSetupUtils.h>
363
+
364
+ #if RCT_NEW_ARCH_ENABLED
365
+ #import <React/CoreModulesPlugins.h>
366
+ #import <React/RCTCxxBridgeDelegate.h>
367
+ #import <React/RCTFabricSurfaceHostingProxyRootView.h>
368
+ #import <React/RCTSurfacePresenter.h>
369
+ #import <React/RCTSurfacePresenterBridgeAdapter.h>
370
+ #import <ReactCommon/RCTTurboModuleManager.h>
371
+
372
+ #import <react/config/ReactNativeConfig.h>
373
+
374
+ @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
375
+ RCTTurboModuleManager *_turboModuleManager;
376
+ RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
377
+ std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
378
+ facebook::react::ContextContainer::Shared _contextContainer;
379
+ }
380
+ @end
381
+ #endif
382
+
383
+ @implementation AppDelegate
384
+
385
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
386
+ {
387
+ RCTAppSetupPrepareApp(application);
388
+
389
+ // @generated begin @react-native-firebase/app-check-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-39c06fe0cc03ffe4bc9cc005b839c559e7ba13d2
390
+ [RNFBAppCheckModule sharedInstance];
391
+ // @generated end @react-native-firebase/app-check-didFinishLaunchingWithOptions
392
+ RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
393
+
394
+ #if RCT_NEW_ARCH_ENABLED
395
+ _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
396
+ _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
397
+ _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
398
+ _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
399
+ bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
400
+ #endif
401
+
402
+ UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
403
+
404
+ rootView.backgroundColor = [UIColor whiteColor];
405
+ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
406
+ UIViewController *rootViewController = [self.reactDelegate createRootViewController];
407
+ rootViewController.view = rootView;
408
+ self.window.rootViewController = rootViewController;
409
+ [self.window makeKeyAndVisible];
410
+
411
+ [super application:application didFinishLaunchingWithOptions:launchOptions];
412
+
413
+ return YES;
414
+ }
415
+
416
+ - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
417
+ {
418
+ // If you'd like to export some custom RCTBridgeModules, add them here!
419
+ return @[];
420
+ }
421
+
422
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
423
+ {
424
+ #if DEBUG
425
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
426
+ #else
427
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
428
+ #endif
429
+ }
430
+
431
+ // Linking API
432
+ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
433
+ return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
434
+ }
435
+
436
+ // Universal Links
437
+ - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
438
+ BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
439
+ return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;
440
+ }
441
+
442
+ #if RCT_NEW_ARCH_ENABLED
443
+
444
+ #pragma mark - RCTCxxBridgeDelegate
445
+
446
+ - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
447
+ {
448
+ _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
449
+ delegate:self
450
+ jsInvoker:bridge.jsCallInvoker];
451
+ return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
452
+ }
453
+
454
+ #pragma mark RCTTurboModuleManagerDelegate
455
+
456
+ - (Class)getModuleClassFromName:(const char *)name
457
+ {
458
+ return RCTCoreModulesClassProvider(name);
459
+ }
460
+
461
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
462
+ jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
463
+ {
464
+ return nullptr;
465
+ }
466
+
467
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
468
+ initParams:
469
+ (const facebook::react::ObjCTurboModule::InitParams &)params
470
+ {
471
+ return nullptr;
472
+ }
473
+
474
+ - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
475
+ {
476
+ return RCTAppSetupDefaultModuleFromClass(moduleClass);
477
+ }
478
+
479
+ #endif
480
+
481
+ @end
482
+ "
483
+ `;
@@ -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