@react-native-firebase/app-check 21.7.4 → 21.8.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 +7 -0
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/__tests__/appcheck.test.ts +0 -171
- package/plugin/__tests__/README.md +0 -19
- package/plugin/__tests__/__snapshots__/iosPlugin.test.ts.snap +0 -483
- package/plugin/__tests__/fixtures/AppDelegate_bare_sdk43.m +0 -86
- package/plugin/__tests__/fixtures/AppDelegate_fallback.m +0 -46
- package/plugin/__tests__/fixtures/AppDelegate_sdk42.m +0 -102
- package/plugin/__tests__/fixtures/AppDelegate_sdk44.m +0 -79
- package/plugin/__tests__/fixtures/AppDelegate_sdk45.mm +0 -129
- package/plugin/__tests__/iosPlugin.test.ts +0 -107
- package/type-test.ts +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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.8.0](https://github.com/invertase/react-native-firebase/compare/v21.7.4...v21.8.0) (2025-02-10)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- do not ship types tests with released packages ([a870cf7](https://github.com/invertase/react-native-firebase/commit/a870cf749687ad2bd6a7a027540bdf29beeaffaa))
|
|
11
|
+
- do not ship unit tests in released packages ([e71dadf](https://github.com/invertase/react-native-firebase/commit/e71dadfc1c0cad2e89c94100913af31ddf7d9c91))
|
|
12
|
+
|
|
6
13
|
## [21.7.4](https://github.com/invertase/react-native-firebase/compare/v21.7.3...v21.7.4) (2025-02-08)
|
|
7
14
|
|
|
8
15
|
### Bug Fixes
|
package/lib/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
module.exports = '21.
|
|
2
|
+
module.exports = '21.8.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-firebase/app-check",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.8.0",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Firebase - App Check",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"appCheck"
|
|
26
26
|
],
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@react-native-firebase/app": "21.
|
|
28
|
+
"@react-native-firebase/app": "21.8.0",
|
|
29
29
|
"expo": ">=47.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "14ebd5c2d2e0f284397c331f909e533c47f2ec62"
|
|
43
43
|
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { jest, beforeEach, describe, expect, it } from '@jest/globals';
|
|
2
|
-
// @ts-ignore test
|
|
3
|
-
import FirebaseModule from '../../app/lib/internal/FirebaseModule';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
createCheckV9Deprecation,
|
|
7
|
-
CheckV9DeprecationFunction,
|
|
8
|
-
} from '../../app/lib/common/unitTestUtils';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
firebase,
|
|
12
|
-
initializeAppCheck,
|
|
13
|
-
getToken,
|
|
14
|
-
getLimitedUseToken,
|
|
15
|
-
setTokenAutoRefreshEnabled,
|
|
16
|
-
onTokenChanged,
|
|
17
|
-
CustomProvider,
|
|
18
|
-
} from '../lib';
|
|
19
|
-
|
|
20
|
-
describe('appCheck()', function () {
|
|
21
|
-
describe('namespace', function () {
|
|
22
|
-
it('accessible from firebase.app()', function () {
|
|
23
|
-
const app = firebase.app();
|
|
24
|
-
expect(app.appCheck).toBeDefined();
|
|
25
|
-
expect(app.appCheck().app).toEqual(app);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('supports multiple apps', async function () {
|
|
29
|
-
expect(firebase.appCheck().app.name).toEqual('[DEFAULT]');
|
|
30
|
-
expect(firebase.appCheck(firebase.app('secondaryFromNative')).app.name).toEqual(
|
|
31
|
-
'secondaryFromNative',
|
|
32
|
-
);
|
|
33
|
-
expect(firebase.app('secondaryFromNative').appCheck().app.name).toEqual(
|
|
34
|
-
'secondaryFromNative',
|
|
35
|
-
);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('react-native-firebase provider', function () {
|
|
40
|
-
it('correctly creates a provider instance', function () {
|
|
41
|
-
expect(firebase.appCheck().newReactNativeFirebaseAppCheckProvider()).toBeDefined();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe('modular', function () {
|
|
46
|
-
it('`initializeAppCheck` function is properly exposed to end user', function () {
|
|
47
|
-
expect(initializeAppCheck).toBeDefined();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('`getToken` function is properly exposed to end user', function () {
|
|
51
|
-
expect(getToken).toBeDefined();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('`getLimitedUseToken` function is properly exposed to end user', function () {
|
|
55
|
-
expect(getLimitedUseToken).toBeDefined();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('`setTokenAutoRefreshEnabled` function is properly exposed to end user', function () {
|
|
59
|
-
expect(setTokenAutoRefreshEnabled).toBeDefined();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('`CustomProvider` function is properly exposed to end user', function () {
|
|
63
|
-
expect(CustomProvider).toBeDefined();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe('test `console.warn` is called for RNFB v8 API & not called for v9 API', function () {
|
|
68
|
-
let appCheckRefV9Deprecation: CheckV9DeprecationFunction;
|
|
69
|
-
let staticsRefV9Deprecation: CheckV9DeprecationFunction;
|
|
70
|
-
|
|
71
|
-
beforeEach(function () {
|
|
72
|
-
appCheckRefV9Deprecation = createCheckV9Deprecation(['appCheck']);
|
|
73
|
-
staticsRefV9Deprecation = createCheckV9Deprecation(['appCheck', 'statics']);
|
|
74
|
-
|
|
75
|
-
// @ts-ignore test
|
|
76
|
-
jest.spyOn(FirebaseModule.prototype, 'native', 'get').mockImplementation(() => {
|
|
77
|
-
return new Proxy(
|
|
78
|
-
{},
|
|
79
|
-
{
|
|
80
|
-
get: () =>
|
|
81
|
-
jest.fn().mockResolvedValue({
|
|
82
|
-
source: 'cache',
|
|
83
|
-
changes: [],
|
|
84
|
-
documents: [],
|
|
85
|
-
metadata: {},
|
|
86
|
-
path: 'foo',
|
|
87
|
-
} as never),
|
|
88
|
-
},
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
describe('AppCheck', function () {
|
|
94
|
-
it('appCheck.activate()', function () {
|
|
95
|
-
const app = firebase.app();
|
|
96
|
-
const appCheck = firebase.appCheck();
|
|
97
|
-
appCheckRefV9Deprecation(
|
|
98
|
-
() =>
|
|
99
|
-
initializeAppCheck(app, {
|
|
100
|
-
provider: {
|
|
101
|
-
providerOptions: {
|
|
102
|
-
android: {
|
|
103
|
-
provider: 'playIntegrity',
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
isTokenAutoRefreshEnabled: true,
|
|
108
|
-
}),
|
|
109
|
-
() => appCheck.activate('string'),
|
|
110
|
-
'activate',
|
|
111
|
-
);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('appCheck.setTokenAutoRefreshEnabled()', function () {
|
|
115
|
-
const appCheck = firebase.appCheck();
|
|
116
|
-
appCheckRefV9Deprecation(
|
|
117
|
-
() => setTokenAutoRefreshEnabled(appCheck, true),
|
|
118
|
-
() => appCheck.setTokenAutoRefreshEnabled(true),
|
|
119
|
-
'setTokenAutoRefreshEnabled',
|
|
120
|
-
);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('appCheck.getToken()', function () {
|
|
124
|
-
const appCheck = firebase.appCheck();
|
|
125
|
-
appCheckRefV9Deprecation(
|
|
126
|
-
() => getToken(appCheck, true),
|
|
127
|
-
() => appCheck.getToken(true),
|
|
128
|
-
'getToken',
|
|
129
|
-
);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('appCheck.getLimitedUseToken()', function () {
|
|
133
|
-
const appCheck = firebase.appCheck();
|
|
134
|
-
appCheckRefV9Deprecation(
|
|
135
|
-
() => getLimitedUseToken(appCheck),
|
|
136
|
-
() => appCheck.getLimitedUseToken(),
|
|
137
|
-
'getLimitedUseToken',
|
|
138
|
-
);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('appCheck.onTokenChanged()', function () {
|
|
142
|
-
const appCheck = firebase.appCheck();
|
|
143
|
-
appCheckRefV9Deprecation(
|
|
144
|
-
() =>
|
|
145
|
-
onTokenChanged(
|
|
146
|
-
appCheck,
|
|
147
|
-
() => {},
|
|
148
|
-
() => {},
|
|
149
|
-
() => {},
|
|
150
|
-
),
|
|
151
|
-
() =>
|
|
152
|
-
appCheck.onTokenChanged(
|
|
153
|
-
() => {},
|
|
154
|
-
() => {},
|
|
155
|
-
() => {},
|
|
156
|
-
),
|
|
157
|
-
'onTokenChanged',
|
|
158
|
-
);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('CustomProvider', function () {
|
|
162
|
-
const appCheck = firebase.appCheck;
|
|
163
|
-
staticsRefV9Deprecation(
|
|
164
|
-
() => CustomProvider,
|
|
165
|
-
() => appCheck.CustomProvider,
|
|
166
|
-
'CustomProvider',
|
|
167
|
-
);
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1,483 +0,0 @@
|
|
|
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
|
-
`;
|
|
@@ -1,86 +0,0 @@
|
|
|
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
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
|
@@ -1,102 +0,0 @@
|
|
|
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
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// This AppDelegate prebuild template is used in Expo SDK 44+
|
|
2
|
-
// It has the RCTBridge to be created by Expo ReactDelegate
|
|
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
|
-
#import <React/RCTConvert.h>
|
|
11
|
-
|
|
12
|
-
#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
|
|
13
|
-
#import <FlipperKit/FlipperClient.h>
|
|
14
|
-
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
|
|
15
|
-
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
|
|
16
|
-
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
|
|
17
|
-
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
|
|
18
|
-
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
|
|
19
|
-
|
|
20
|
-
static void InitializeFlipper(UIApplication *application) {
|
|
21
|
-
FlipperClient *client = [FlipperClient sharedClient];
|
|
22
|
-
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
|
|
23
|
-
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
|
|
24
|
-
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
|
|
25
|
-
[client addPlugin:[FlipperKitReactPlugin new]];
|
|
26
|
-
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
|
|
27
|
-
[client start];
|
|
28
|
-
}
|
|
29
|
-
#endif
|
|
30
|
-
|
|
31
|
-
@implementation AppDelegate
|
|
32
|
-
|
|
33
|
-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
34
|
-
{
|
|
35
|
-
#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
|
|
36
|
-
InitializeFlipper(application);
|
|
37
|
-
#endif
|
|
38
|
-
|
|
39
|
-
RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
|
|
40
|
-
RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
|
|
41
|
-
rootView.backgroundColor = [UIColor whiteColor];
|
|
42
|
-
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
43
|
-
UIViewController *rootViewController = [self.reactDelegate createRootViewController];
|
|
44
|
-
rootViewController.view = rootView;
|
|
45
|
-
self.window.rootViewController = rootViewController;
|
|
46
|
-
[self.window makeKeyAndVisible];
|
|
47
|
-
|
|
48
|
-
[super application:application didFinishLaunchingWithOptions:launchOptions];
|
|
49
|
-
|
|
50
|
-
return YES;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
|
|
54
|
-
{
|
|
55
|
-
// If you'd like to export some custom RCTBridgeModules, add them here!
|
|
56
|
-
return @[];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
|
|
60
|
-
#ifdef DEBUG
|
|
61
|
-
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
|
|
62
|
-
#else
|
|
63
|
-
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
|
64
|
-
#endif
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Linking API
|
|
68
|
-
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
|
69
|
-
return [RCTLinkingManager application:application openURL:url options:options];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Universal Links
|
|
73
|
-
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
|
|
74
|
-
return [RCTLinkingManager application:application
|
|
75
|
-
continueUserActivity:userActivity
|
|
76
|
-
restorationHandler:restorationHandler];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
@end
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
// RN 0.68.1, Expo SDK 45 template
|
|
2
|
-
// The main difference between this and the SDK 44 one is that this is
|
|
3
|
-
// using React Native 0.68 and is written in Objective-C++
|
|
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
|
-
#import <React/RCTAppSetupUtils.h>
|
|
14
|
-
|
|
15
|
-
#if RCT_NEW_ARCH_ENABLED
|
|
16
|
-
#import <React/CoreModulesPlugins.h>
|
|
17
|
-
#import <React/RCTCxxBridgeDelegate.h>
|
|
18
|
-
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
|
|
19
|
-
#import <React/RCTSurfacePresenter.h>
|
|
20
|
-
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
|
21
|
-
#import <ReactCommon/RCTTurboModuleManager.h>
|
|
22
|
-
|
|
23
|
-
#import <react/config/ReactNativeConfig.h>
|
|
24
|
-
|
|
25
|
-
@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
|
|
26
|
-
RCTTurboModuleManager *_turboModuleManager;
|
|
27
|
-
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
|
|
28
|
-
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
|
|
29
|
-
facebook::react::ContextContainer::Shared _contextContainer;
|
|
30
|
-
}
|
|
31
|
-
@end
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
|
-
@implementation AppDelegate
|
|
35
|
-
|
|
36
|
-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
37
|
-
{
|
|
38
|
-
RCTAppSetupPrepareApp(application);
|
|
39
|
-
|
|
40
|
-
RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
|
|
41
|
-
|
|
42
|
-
#if RCT_NEW_ARCH_ENABLED
|
|
43
|
-
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
|
|
44
|
-
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
|
|
45
|
-
_contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
|
|
46
|
-
_bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
|
|
47
|
-
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
|
|
48
|
-
#endif
|
|
49
|
-
|
|
50
|
-
UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
|
|
51
|
-
|
|
52
|
-
rootView.backgroundColor = [UIColor whiteColor];
|
|
53
|
-
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
54
|
-
UIViewController *rootViewController = [self.reactDelegate createRootViewController];
|
|
55
|
-
rootViewController.view = rootView;
|
|
56
|
-
self.window.rootViewController = rootViewController;
|
|
57
|
-
[self.window makeKeyAndVisible];
|
|
58
|
-
|
|
59
|
-
[super application:application didFinishLaunchingWithOptions:launchOptions];
|
|
60
|
-
|
|
61
|
-
return YES;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
|
|
65
|
-
{
|
|
66
|
-
// If you'd like to export some custom RCTBridgeModules, add them here!
|
|
67
|
-
return @[];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
|
|
71
|
-
{
|
|
72
|
-
#if DEBUG
|
|
73
|
-
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
|
|
74
|
-
#else
|
|
75
|
-
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
|
76
|
-
#endif
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Linking API
|
|
80
|
-
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
|
81
|
-
return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Universal Links
|
|
85
|
-
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
|
|
86
|
-
BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
|
|
87
|
-
return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
#if RCT_NEW_ARCH_ENABLED
|
|
91
|
-
|
|
92
|
-
#pragma mark - RCTCxxBridgeDelegate
|
|
93
|
-
|
|
94
|
-
- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
|
|
95
|
-
{
|
|
96
|
-
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
|
|
97
|
-
delegate:self
|
|
98
|
-
jsInvoker:bridge.jsCallInvoker];
|
|
99
|
-
return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
#pragma mark RCTTurboModuleManagerDelegate
|
|
103
|
-
|
|
104
|
-
- (Class)getModuleClassFromName:(const char *)name
|
|
105
|
-
{
|
|
106
|
-
return RCTCoreModulesClassProvider(name);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
|
110
|
-
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
|
|
111
|
-
{
|
|
112
|
-
return nullptr;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
|
116
|
-
initParams:
|
|
117
|
-
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
118
|
-
{
|
|
119
|
-
return nullptr;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
|
123
|
-
{
|
|
124
|
-
return RCTAppSetupDefaultModuleFromClass(moduleClass);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
#endif
|
|
128
|
-
|
|
129
|
-
@end
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { IOSConfig } from '@expo/config-plugins';
|
|
2
|
-
import { AppDelegateProjectFile } from '@expo/config-plugins/build/ios/Paths';
|
|
3
|
-
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
|
|
4
|
-
import fs from 'fs/promises';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
|
|
7
|
-
import { modifyAppDelegateAsync, modifyObjcAppDelegate } from '../src/ios/appDelegate';
|
|
8
|
-
|
|
9
|
-
describe('Config Plugin iOS Tests', function () {
|
|
10
|
-
beforeEach(function () {
|
|
11
|
-
jest.resetAllMocks();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('tests changes made to old AppDelegate.m (SDK 42)', async function () {
|
|
15
|
-
const appDelegate = await fs.readFile(path.join(__dirname, './fixtures/AppDelegate_sdk42.m'), {
|
|
16
|
-
encoding: 'utf8',
|
|
17
|
-
});
|
|
18
|
-
const result = modifyObjcAppDelegate(appDelegate);
|
|
19
|
-
expect(result).toMatchSnapshot();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('tests changes made to AppDelegate.m (SDK 43)', async function () {
|
|
23
|
-
const appDelegate = await fs.readFile(
|
|
24
|
-
path.join(__dirname, './fixtures/AppDelegate_bare_sdk43.m'),
|
|
25
|
-
{
|
|
26
|
-
encoding: 'utf8',
|
|
27
|
-
},
|
|
28
|
-
);
|
|
29
|
-
const result = modifyObjcAppDelegate(appDelegate);
|
|
30
|
-
expect(result).toMatchSnapshot();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('tests changes made to AppDelegate.m with Expo ReactDelegate support (SDK 44+)', async function () {
|
|
34
|
-
const appDelegate = await fs.readFile(path.join(__dirname, './fixtures/AppDelegate_sdk44.m'), {
|
|
35
|
-
encoding: 'utf8',
|
|
36
|
-
});
|
|
37
|
-
const result = modifyObjcAppDelegate(appDelegate);
|
|
38
|
-
expect(result).toMatchSnapshot();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('tests changes made to AppDelegate.m with fallback regex (if the original one fails)', async function () {
|
|
42
|
-
const appDelegate = await fs.readFile(
|
|
43
|
-
path.join(__dirname, './fixtures/AppDelegate_fallback.m'),
|
|
44
|
-
{
|
|
45
|
-
encoding: 'utf8',
|
|
46
|
-
},
|
|
47
|
-
);
|
|
48
|
-
const result = modifyObjcAppDelegate(appDelegate);
|
|
49
|
-
expect(result).toMatchSnapshot();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('works with AppDelegate.mm (RN 0.68+)', async function () {
|
|
53
|
-
const appDelegate = await fs.readFile(path.join(__dirname, './fixtures/AppDelegate_sdk45.mm'), {
|
|
54
|
-
encoding: 'utf8',
|
|
55
|
-
});
|
|
56
|
-
const result = modifyObjcAppDelegate(appDelegate);
|
|
57
|
-
expect(result).toMatchSnapshot();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('detects Objective-C++ AppDelegate.mm', async function () {
|
|
61
|
-
jest.spyOn(fs, 'writeFile').mockImplementation(async () => {});
|
|
62
|
-
|
|
63
|
-
const appDelegatePath = path.join(__dirname, './fixtures/AppDelegate_sdk45.mm');
|
|
64
|
-
const appDelegateFileInfo = IOSConfig.Paths.getFileInfo(
|
|
65
|
-
appDelegatePath,
|
|
66
|
-
) as AppDelegateProjectFile;
|
|
67
|
-
|
|
68
|
-
await modifyAppDelegateAsync(appDelegateFileInfo);
|
|
69
|
-
|
|
70
|
-
// expect file contents to be modified
|
|
71
|
-
expect(fs.writeFile).toHaveBeenCalledWith(
|
|
72
|
-
appDelegateFileInfo.path,
|
|
73
|
-
expect.not.stringContaining(appDelegateFileInfo.contents),
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("doesn't support Swift AppDelegate", async function () {
|
|
78
|
-
jest.spyOn(fs, 'writeFile').mockImplementation(async () => {});
|
|
79
|
-
|
|
80
|
-
const appDelegateFileInfo: AppDelegateProjectFile = {
|
|
81
|
-
path: '.',
|
|
82
|
-
language: 'swift',
|
|
83
|
-
contents: 'some dummy content',
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
await expect(modifyAppDelegateAsync(appDelegateFileInfo)).rejects.toThrow();
|
|
87
|
-
expect(fs.writeFile).not.toHaveBeenCalled();
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('does not add the firebase import multiple times', async function () {
|
|
91
|
-
const singleImport = '#import "AppDelegate.h"\n#import <RNFBAppCheckModule.h>';
|
|
92
|
-
const doubleImport = singleImport + '\n#import <RNFBAppCheckModule.h>';
|
|
93
|
-
|
|
94
|
-
const appDelegate = await fs.readFile(path.join(__dirname, './fixtures/AppDelegate_sdk45.mm'), {
|
|
95
|
-
encoding: 'utf8',
|
|
96
|
-
});
|
|
97
|
-
expect(appDelegate).not.toContain(singleImport);
|
|
98
|
-
|
|
99
|
-
const onceModifiedAppDelegate = modifyObjcAppDelegate(appDelegate);
|
|
100
|
-
expect(onceModifiedAppDelegate).toContain(singleImport);
|
|
101
|
-
expect(onceModifiedAppDelegate).not.toContain(doubleImport);
|
|
102
|
-
|
|
103
|
-
const twiceModifiedAppDelegate = modifyObjcAppDelegate(onceModifiedAppDelegate);
|
|
104
|
-
expect(twiceModifiedAppDelegate).toContain(singleImport);
|
|
105
|
-
expect(twiceModifiedAppDelegate).not.toContain(doubleImport);
|
|
106
|
-
});
|
|
107
|
-
});
|
package/type-test.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import firebase from '.';
|
|
2
|
-
|
|
3
|
-
// TODO none of these seem to work, local issue?
|
|
4
|
-
|
|
5
|
-
// checks module exists at root
|
|
6
|
-
console.log(firebase.appCheck().app.name);
|
|
7
|
-
|
|
8
|
-
// checks module exists at app level
|
|
9
|
-
console.log(firebase.app().appCheck().app.name);
|
|
10
|
-
|
|
11
|
-
// checks statics exist
|
|
12
|
-
console.log(firebase.appCheck.SDK_VERSION);
|
|
13
|
-
|
|
14
|
-
// checks root exists
|
|
15
|
-
console.log(firebase.SDK_VERSION);
|
|
16
|
-
|
|
17
|
-
// checks firebase named export exists on module
|
|
18
|
-
console.log(firebase.SDK_VERSION);
|
|
19
|
-
|
|
20
|
-
// checks multi-app support exists
|
|
21
|
-
console.log(firebase.appCheck(firebase.app()).app.name);
|
|
22
|
-
|
|
23
|
-
// checks default export supports app arg
|
|
24
|
-
console.log(firebase(firebase.app()).app.name);
|