@react-native-firebase/auth 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 +6 -0
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/__tests__/auth.test.ts +0 -395
- package/plugin/__tests__/__snapshots__/iosPlugin_openUrlFix.test.ts.snap +0 -350
- package/plugin/__tests__/__snapshots__/iosPlugin_urlTypes.test.ts.snap +0 -13
- 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__/fixtures/TestGoogleService-Info.incomplete.plist +0 -6
- package/plugin/__tests__/fixtures/TestGoogleService-Info.plist +0 -38
- package/plugin/__tests__/iosPlugin_openUrlFix.test.ts +0 -343
- package/plugin/__tests__/iosPlugin_urlTypes.test.ts +0 -75
@@ -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,38 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
-
<plist version="1.0">
|
4
|
-
<dict>
|
5
|
-
<key>CLIENT_ID</key>
|
6
|
-
<string>SomeRandomClientIdString.apps.googleusercontent.com</string>
|
7
|
-
<key>REVERSED_CLIENT_ID</key>
|
8
|
-
<string>com.googleusercontent.apps.SomeRandomClientIdString</string>
|
9
|
-
<key>ANDROID_CLIENT_ID</key>
|
10
|
-
<string>SomeRandomAndroidClientIdString.apps.googleusercontent.com</string>
|
11
|
-
<key>API_KEY</key>
|
12
|
-
<string>SomeRandomApiKeyString</string>
|
13
|
-
<key>GCM_SENDER_ID</key>
|
14
|
-
<string>SomeRandomGcmSenderIdNumber</string>
|
15
|
-
<key>PLIST_VERSION</key>
|
16
|
-
<string>1</string>
|
17
|
-
<key>BUNDLE_ID</key>
|
18
|
-
<string>com.example.app</string>
|
19
|
-
<key>PROJECT_ID</key>
|
20
|
-
<string>example</string>
|
21
|
-
<key>STORAGE_BUCKET</key>
|
22
|
-
<string>example.appspot.com</string>
|
23
|
-
<key>IS_ADS_ENABLED</key>
|
24
|
-
<false></false>
|
25
|
-
<key>IS_ANALYTICS_ENABLED</key>
|
26
|
-
<false></false>
|
27
|
-
<key>IS_APPINVITE_ENABLED</key>
|
28
|
-
<true></true>
|
29
|
-
<key>IS_GCM_ENABLED</key>
|
30
|
-
<true></true>
|
31
|
-
<key>IS_SIGNIN_ENABLED</key>
|
32
|
-
<true></true>
|
33
|
-
<key>GOOGLE_APP_ID</key>
|
34
|
-
<string>1234:1234:ios:1234</string>
|
35
|
-
<key>DATABASE_URL</key>
|
36
|
-
<string>https://example.firebaseio.com</string>
|
37
|
-
</dict>
|
38
|
-
</plist>
|
@@ -1,343 +0,0 @@
|
|
1
|
-
import fs from 'fs/promises';
|
2
|
-
import path from 'path';
|
3
|
-
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
|
4
|
-
import { WarningAggregator } from '@expo/config-plugins';
|
5
|
-
import type { AppDelegateProjectFile } from '@expo/config-plugins/build/ios/Paths';
|
6
|
-
import {
|
7
|
-
shouldApplyIosOpenUrlFix,
|
8
|
-
modifyObjcAppDelegate,
|
9
|
-
withOpenUrlFixForAppDelegate,
|
10
|
-
ensureFirebaseSwizzlingIsEnabled,
|
11
|
-
appDelegateOpenUrlInsertionPointAfter,
|
12
|
-
multiline_appDelegateOpenUrlInsertionPointAfter,
|
13
|
-
} from '../src/ios/openUrlFix';
|
14
|
-
import type { ExpoConfigPluginEntry } from '../src/ios/openUrlFix';
|
15
|
-
|
16
|
-
describe('Config Plugin iOS Tests - openUrlFix', () => {
|
17
|
-
beforeEach(function () {
|
18
|
-
jest.resetAllMocks();
|
19
|
-
});
|
20
|
-
|
21
|
-
it('is disabled by default', async () => {
|
22
|
-
const config = {
|
23
|
-
name: 'TestName',
|
24
|
-
slug: 'TestSlug',
|
25
|
-
};
|
26
|
-
|
27
|
-
expect(
|
28
|
-
shouldApplyIosOpenUrlFix({
|
29
|
-
config,
|
30
|
-
}),
|
31
|
-
).toBe(false);
|
32
|
-
|
33
|
-
expect(
|
34
|
-
shouldApplyIosOpenUrlFix({
|
35
|
-
config,
|
36
|
-
props: {},
|
37
|
-
}),
|
38
|
-
).toBe(false);
|
39
|
-
|
40
|
-
expect(
|
41
|
-
shouldApplyIosOpenUrlFix({
|
42
|
-
config,
|
43
|
-
props: {
|
44
|
-
ios: {},
|
45
|
-
},
|
46
|
-
}),
|
47
|
-
).toBe(false);
|
48
|
-
|
49
|
-
expect(
|
50
|
-
shouldApplyIosOpenUrlFix({
|
51
|
-
config,
|
52
|
-
props: {
|
53
|
-
ios: {
|
54
|
-
captchaOpenUrlFix: undefined,
|
55
|
-
},
|
56
|
-
},
|
57
|
-
}),
|
58
|
-
).toBe(false);
|
59
|
-
|
60
|
-
expect(
|
61
|
-
shouldApplyIosOpenUrlFix({
|
62
|
-
config,
|
63
|
-
props: {
|
64
|
-
ios: {
|
65
|
-
captchaOpenUrlFix: 'default',
|
66
|
-
},
|
67
|
-
},
|
68
|
-
}),
|
69
|
-
).toBe(false);
|
70
|
-
|
71
|
-
expect(
|
72
|
-
shouldApplyIosOpenUrlFix({
|
73
|
-
config,
|
74
|
-
props: {
|
75
|
-
ios: {
|
76
|
-
captchaOpenUrlFix: false,
|
77
|
-
},
|
78
|
-
},
|
79
|
-
}),
|
80
|
-
).toBe(false);
|
81
|
-
|
82
|
-
expect(
|
83
|
-
shouldApplyIosOpenUrlFix({
|
84
|
-
config,
|
85
|
-
props: {
|
86
|
-
ios: {
|
87
|
-
captchaOpenUrlFix: true,
|
88
|
-
},
|
89
|
-
},
|
90
|
-
}),
|
91
|
-
).toBe(true);
|
92
|
-
});
|
93
|
-
|
94
|
-
it('is enabled by default when expo-router is found', async () => {
|
95
|
-
const cases: ExpoConfigPluginEntry[] = ['expo-router', ['expo-router'], ['expo-router', {}]];
|
96
|
-
|
97
|
-
for (const routerPluginEntry of cases) {
|
98
|
-
const plugins: ExpoConfigPluginEntry[] = [
|
99
|
-
'something',
|
100
|
-
[],
|
101
|
-
['something-else', { foo: 'bar' }],
|
102
|
-
routerPluginEntry,
|
103
|
-
];
|
104
|
-
|
105
|
-
const config = {
|
106
|
-
name: 'TestName',
|
107
|
-
slug: 'TestSlug',
|
108
|
-
plugins,
|
109
|
-
};
|
110
|
-
|
111
|
-
expect(
|
112
|
-
shouldApplyIosOpenUrlFix({
|
113
|
-
config,
|
114
|
-
props: {},
|
115
|
-
}),
|
116
|
-
).toBe(true);
|
117
|
-
|
118
|
-
expect(
|
119
|
-
shouldApplyIosOpenUrlFix({
|
120
|
-
config,
|
121
|
-
props: {
|
122
|
-
ios: {},
|
123
|
-
},
|
124
|
-
}),
|
125
|
-
).toBe(true);
|
126
|
-
|
127
|
-
expect(
|
128
|
-
shouldApplyIosOpenUrlFix({
|
129
|
-
config,
|
130
|
-
props: {
|
131
|
-
ios: {
|
132
|
-
captchaOpenUrlFix: undefined,
|
133
|
-
},
|
134
|
-
},
|
135
|
-
}),
|
136
|
-
).toBe(true);
|
137
|
-
|
138
|
-
expect(
|
139
|
-
shouldApplyIosOpenUrlFix({
|
140
|
-
config,
|
141
|
-
props: {
|
142
|
-
ios: {
|
143
|
-
captchaOpenUrlFix: 'default',
|
144
|
-
},
|
145
|
-
},
|
146
|
-
}),
|
147
|
-
).toBe(true);
|
148
|
-
|
149
|
-
expect(
|
150
|
-
shouldApplyIosOpenUrlFix({
|
151
|
-
config,
|
152
|
-
props: {
|
153
|
-
ios: {
|
154
|
-
captchaOpenUrlFix: false,
|
155
|
-
},
|
156
|
-
},
|
157
|
-
}),
|
158
|
-
).toBe(false);
|
159
|
-
|
160
|
-
expect(
|
161
|
-
shouldApplyIosOpenUrlFix({
|
162
|
-
config,
|
163
|
-
props: {
|
164
|
-
ios: {
|
165
|
-
captchaOpenUrlFix: true,
|
166
|
-
},
|
167
|
-
},
|
168
|
-
}),
|
169
|
-
).toBe(true);
|
170
|
-
}
|
171
|
-
});
|
172
|
-
|
173
|
-
it('throws an error for invalid config', () => {
|
174
|
-
expect(() =>
|
175
|
-
shouldApplyIosOpenUrlFix({
|
176
|
-
config: {
|
177
|
-
name: 'TestName',
|
178
|
-
slug: 'TestSlug',
|
179
|
-
},
|
180
|
-
props: {
|
181
|
-
ios: {
|
182
|
-
// @ts-ignore testing invalid argument
|
183
|
-
captchaOpenUrlFix: Math.PI,
|
184
|
-
},
|
185
|
-
},
|
186
|
-
}),
|
187
|
-
).toThrow("Unexpected value for 'captchaOpenUrlFix' config option");
|
188
|
-
});
|
189
|
-
|
190
|
-
const appDelegateFixturesPatch = [
|
191
|
-
'AppDelegate_bare_sdk43.m',
|
192
|
-
'AppDelegate_sdk44.m',
|
193
|
-
'AppDelegate_sdk45.mm',
|
194
|
-
];
|
195
|
-
appDelegateFixturesPatch.forEach(fixtureName => {
|
196
|
-
it(`munges AppDelegate correctly - ${fixtureName}`, async () => {
|
197
|
-
const fixturePath = path.join(__dirname, 'fixtures', fixtureName);
|
198
|
-
const appDelegate = await fs.readFile(fixturePath, { encoding: 'utf-8' });
|
199
|
-
const result = modifyObjcAppDelegate(appDelegate);
|
200
|
-
expect(result).toMatchSnapshot();
|
201
|
-
});
|
202
|
-
|
203
|
-
it(`prints warning message when configured to default and AppDelegate is modified`, async () => {
|
204
|
-
const fixturePath = path.join(__dirname, 'fixtures', fixtureName);
|
205
|
-
const appDelegate = await fs.readFile(fixturePath, { encoding: 'utf-8' });
|
206
|
-
const config = {
|
207
|
-
name: 'TestName',
|
208
|
-
slug: 'TestSlug',
|
209
|
-
modRequest: { projectRoot: path.join(__dirname, 'fixtures') } as any,
|
210
|
-
modResults: {
|
211
|
-
path: fixturePath,
|
212
|
-
language: 'objc',
|
213
|
-
contents: appDelegate,
|
214
|
-
} as AppDelegateProjectFile,
|
215
|
-
modRawConfig: { name: 'TestName', slug: 'TestSlug' },
|
216
|
-
};
|
217
|
-
const props = undefined;
|
218
|
-
const spy = jest
|
219
|
-
.spyOn(WarningAggregator, 'addWarningIOS')
|
220
|
-
.mockImplementation(() => undefined);
|
221
|
-
withOpenUrlFixForAppDelegate({ config, props });
|
222
|
-
expect(spy).toHaveBeenCalledWith(
|
223
|
-
'@react-native-firebase/auth',
|
224
|
-
'modifying iOS AppDelegate openURL method to ignore firebaseauth reCAPTCHA redirect URLs',
|
225
|
-
);
|
226
|
-
});
|
227
|
-
});
|
228
|
-
|
229
|
-
const appDelegateFixturesNoop = ['AppDelegate_sdk42.m', 'AppDelegate_fallback.m'];
|
230
|
-
appDelegateFixturesNoop.forEach(fixtureName => {
|
231
|
-
it(`skips AppDelegate without openURL - ${fixtureName}`, async () => {
|
232
|
-
const fixturePath = path.join(__dirname, 'fixtures', fixtureName);
|
233
|
-
const appDelegate = await fs.readFile(fixturePath, { encoding: 'utf-8' });
|
234
|
-
const config = {
|
235
|
-
name: 'TestName',
|
236
|
-
slug: 'TestSlug',
|
237
|
-
plugins: ['expo-router'],
|
238
|
-
modRequest: { projectRoot: path.join(__dirname, 'fixtures') } as any,
|
239
|
-
modResults: {
|
240
|
-
path: fixturePath,
|
241
|
-
language: 'objc',
|
242
|
-
contents: appDelegate,
|
243
|
-
} as AppDelegateProjectFile,
|
244
|
-
modRawConfig: { name: 'TestName', slug: 'TestSlug' },
|
245
|
-
};
|
246
|
-
const props = undefined;
|
247
|
-
const spy = jest
|
248
|
-
.spyOn(WarningAggregator, 'addWarningIOS')
|
249
|
-
.mockImplementation(() => undefined);
|
250
|
-
const result = withOpenUrlFixForAppDelegate({ config, props });
|
251
|
-
expect(result.modResults.contents).toBe(appDelegate);
|
252
|
-
expect(spy).toHaveBeenCalledWith(
|
253
|
-
'@react-native-firebase/auth',
|
254
|
-
"Skipping iOS openURL fix because no 'openURL' method was found",
|
255
|
-
);
|
256
|
-
});
|
257
|
-
|
258
|
-
it(`errors when enabled but openURL not found - ${fixtureName}`, async () => {
|
259
|
-
const fixturePath = path.join(__dirname, 'fixtures', fixtureName);
|
260
|
-
const appDelegate = await fs.readFile(fixturePath, { encoding: 'utf-8' });
|
261
|
-
const config = {
|
262
|
-
name: 'TestName',
|
263
|
-
slug: 'TestSlug',
|
264
|
-
modRequest: { projectRoot: path.join(__dirname, 'fixtures') } as any,
|
265
|
-
modResults: {
|
266
|
-
path: fixturePath,
|
267
|
-
language: 'objc',
|
268
|
-
contents: appDelegate,
|
269
|
-
} as AppDelegateProjectFile,
|
270
|
-
modRawConfig: { name: 'TestName', slug: 'TestSlug' },
|
271
|
-
};
|
272
|
-
const props = {
|
273
|
-
ios: {
|
274
|
-
captchaOpenUrlFix: true,
|
275
|
-
},
|
276
|
-
};
|
277
|
-
expect(() => withOpenUrlFixForAppDelegate({ config, props })).toThrow(
|
278
|
-
"Failed to apply iOS openURL fix because no 'openURL' method was found",
|
279
|
-
);
|
280
|
-
});
|
281
|
-
});
|
282
|
-
|
283
|
-
it(`should issue error when openURL is found but patching fails`, () => {
|
284
|
-
const snippet = [
|
285
|
-
'// preamble goes here\nint theAnswer()\n{\n\treturn 42;\n}',
|
286
|
-
'- (BOOL)application:(UIApplication *)application options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options openURL:(NSURL *)url\n{',
|
287
|
-
'int x = theAnswer();\n',
|
288
|
-
].join('');
|
289
|
-
expect(() => modifyObjcAppDelegate(snippet)).toThrow(
|
290
|
-
"Failed to apply 'captchaOpenUrlFix' but detected 'openURL' method.",
|
291
|
-
);
|
292
|
-
});
|
293
|
-
|
294
|
-
const positiveTemplateCases = [
|
295
|
-
'- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {\n\tint x=3;',
|
296
|
-
'- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options',
|
297
|
-
'\t- (\tBOOL ) application : ( UIApplication*\t) application openURL : ( NSURL*) url options : ( NSDictionary < UIApplicationOpenURLOptionsKey , id > *)\toptions',
|
298
|
-
' - ( BOOL ) application : ( UIApplication*\t) application openURL : ( NSURL*) url options : ( NSDictionary < UIApplicationOpenURLOptionsKey , id > *)\toptions\n\n{\n\n',
|
299
|
-
];
|
300
|
-
positiveTemplateCases.forEach((snippet, caseIdx) => {
|
301
|
-
it(`must match positiveTemplateCases[${caseIdx}]`, () => {
|
302
|
-
expect(appDelegateOpenUrlInsertionPointAfter.test(snippet)).toBe(true);
|
303
|
-
if (snippet.match(/{/)) {
|
304
|
-
expect(multiline_appDelegateOpenUrlInsertionPointAfter.test(snippet)).toBe(true);
|
305
|
-
expect(modifyObjcAppDelegate(snippet)).toMatchSnapshot();
|
306
|
-
}
|
307
|
-
});
|
308
|
-
});
|
309
|
-
|
310
|
-
const negativeTemplateCases = [
|
311
|
-
'- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity {',
|
312
|
-
'- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url',
|
313
|
-
'\t( BOOL ) application : ( UIApplication*\t) application openURL : ( NSURL*) url options : ( NSDictionary < UIApplicationOpenURLOptionsKey , id > *)\toptions',
|
314
|
-
];
|
315
|
-
negativeTemplateCases.forEach((snippet, caseIdx) => {
|
316
|
-
it(`must not match negativeTemplateCases[${caseIdx}]`, () => {
|
317
|
-
expect(appDelegateOpenUrlInsertionPointAfter.test(snippet)).toBe(false);
|
318
|
-
});
|
319
|
-
});
|
320
|
-
|
321
|
-
it(`rejects projects with swizzling disabled`, () => {
|
322
|
-
const config = {
|
323
|
-
name: 'TestName',
|
324
|
-
slug: 'TestSlug',
|
325
|
-
plugins: ['expo-router'],
|
326
|
-
modRequest: { projectRoot: path.join(__dirname, 'fixtures') } as any,
|
327
|
-
modResults: {
|
328
|
-
path: path.join(__dirname, 'fixtures', '/path/to/Info.plist'),
|
329
|
-
language: 'plist',
|
330
|
-
contents: '',
|
331
|
-
},
|
332
|
-
modRawConfig: { name: 'TestName', slug: 'TestSlug' },
|
333
|
-
ios: {
|
334
|
-
infoPlist: {
|
335
|
-
FirebaseAppDelegateProxyEnabled: false,
|
336
|
-
},
|
337
|
-
},
|
338
|
-
};
|
339
|
-
expect(() => ensureFirebaseSwizzlingIsEnabled(config)).toThrow(
|
340
|
-
'Your app has disabled swizzling by setting FirebaseAppDelegateProxyEnabled=false in its Info.plist.',
|
341
|
-
);
|
342
|
-
});
|
343
|
-
});
|
@@ -1,75 +0,0 @@
|
|
1
|
-
import path from 'path';
|
2
|
-
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
|
3
|
-
import { setUrlTypesForCaptcha } from '../src/ios/urlTypes';
|
4
|
-
|
5
|
-
describe('Config Plugin iOS Tests - urlTypes', () => {
|
6
|
-
beforeEach(function () {
|
7
|
-
jest.resetAllMocks();
|
8
|
-
});
|
9
|
-
|
10
|
-
it('throws if path to GoogleServer-Info.plist is not provided', async () => {
|
11
|
-
expect(() => {
|
12
|
-
setUrlTypesForCaptcha({
|
13
|
-
config: {
|
14
|
-
name: 'TestName',
|
15
|
-
slug: 'TestSlug',
|
16
|
-
modRequest: { projectRoot: path.join(__dirname, 'fixtures') } as any,
|
17
|
-
modResults: {},
|
18
|
-
modRawConfig: { name: 'TestName', slug: 'TestSlug' },
|
19
|
-
ios: {},
|
20
|
-
},
|
21
|
-
});
|
22
|
-
}).toThrow(
|
23
|
-
`[@react-native-firebase/auth] Your app.json file is missing ios.googleServicesFile. Please add this field.`,
|
24
|
-
);
|
25
|
-
});
|
26
|
-
|
27
|
-
it('throws if GoogleServer-Info.plist cannot be read', async () => {
|
28
|
-
const googleServiceFilePath = path.join(__dirname, 'fixtures', 'ThisFileDoesNotExist.plist');
|
29
|
-
expect(() => {
|
30
|
-
setUrlTypesForCaptcha({
|
31
|
-
config: {
|
32
|
-
name: 'TestName',
|
33
|
-
slug: 'TestSlug',
|
34
|
-
modRequest: { projectRoot: path.join(__dirname, 'fixtures') } as any,
|
35
|
-
modResults: {},
|
36
|
-
modRawConfig: { name: 'TestName', slug: 'TestSlug' },
|
37
|
-
ios: { googleServicesFile: 'ThisFileDoesNotExist.plist' },
|
38
|
-
},
|
39
|
-
});
|
40
|
-
}).toThrow(
|
41
|
-
`[@react-native-firebase/auth] GoogleService-Info.plist doesn't exist in ${googleServiceFilePath}. Place it there or configure the path in app.json`,
|
42
|
-
);
|
43
|
-
});
|
44
|
-
|
45
|
-
it('throws if GoogleServer-Info.plist has no reversed client id', async () => {
|
46
|
-
expect(() => {
|
47
|
-
setUrlTypesForCaptcha({
|
48
|
-
config: {
|
49
|
-
name: 'TestName',
|
50
|
-
slug: 'TestSlug',
|
51
|
-
modRequest: { projectRoot: path.join(__dirname, 'fixtures') } as any,
|
52
|
-
modResults: {},
|
53
|
-
modRawConfig: { name: 'TestName', slug: 'TestSlug' },
|
54
|
-
ios: { googleServicesFile: 'TestGoogleService-Info.incomplete.plist' },
|
55
|
-
},
|
56
|
-
});
|
57
|
-
}).toThrow(
|
58
|
-
'[@react-native-firebase/auth] Failed to parse your GoogleService-Info.plist. Are you sure it is a valid Info.Plist file with a REVERSE_CLIENT_ID field?',
|
59
|
-
);
|
60
|
-
});
|
61
|
-
|
62
|
-
it('adds url types to the Info.plist', async () => {
|
63
|
-
const result = setUrlTypesForCaptcha({
|
64
|
-
config: {
|
65
|
-
name: 'TestName',
|
66
|
-
slug: 'TestSlug',
|
67
|
-
modRequest: { projectRoot: path.join(__dirname, 'fixtures') } as any,
|
68
|
-
modResults: {},
|
69
|
-
modRawConfig: { name: 'TestName', slug: 'TestSlug' },
|
70
|
-
ios: { googleServicesFile: 'TestGoogleService-Info.plist' },
|
71
|
-
},
|
72
|
-
});
|
73
|
-
expect(result.modResults).toMatchSnapshot();
|
74
|
-
});
|
75
|
-
});
|