Skip to content

Commit f0cba0b

Browse files
authored
fix(auth, ios): avoid inappropriate linking when host is nil (#8517)
1 parent b302210 commit f0cba0b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

packages/auth/plugin/__tests__/__snapshots__/iosPlugin_openUrlFix.test.ts.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ static void InitializeFlipper(UIApplication *application) {
7676
7777
// Linking API
7878
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
79-
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
80-
if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
79+
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-11c57ab508c3e776ab45ad4f3c3cb28310f617ea
80+
if (url.host && [url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
8181
// invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
8282
return NO;
8383
}
@@ -165,8 +165,8 @@ static void InitializeFlipper(UIApplication *application) {
165165
166166
// Linking API
167167
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
168-
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
169-
if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
168+
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-11c57ab508c3e776ab45ad4f3c3cb28310f617ea
169+
if (url.host && [url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
170170
// invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
171171
return NO;
172172
}
@@ -266,8 +266,8 @@ exports[`Config Plugin iOS Tests - openUrlFix munges AppDelegate correctly - App
266266
267267
// Linking API
268268
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
269-
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
270-
if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
269+
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-11c57ab508c3e776ab45ad4f3c3cb28310f617ea
270+
if (url.host && [url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
271271
// invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
272272
return NO;
273273
}
@@ -378,8 +378,8 @@ public class AppDelegate: ExpoAppDelegate {
378378
379379
exports[`Config Plugin iOS Tests - openUrlFix must match positiveTemplateCases[0] 1`] = `
380380
"- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
381-
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
382-
if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
381+
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-11c57ab508c3e776ab45ad4f3c3cb28310f617ea
382+
if (url.host && [url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
383383
// invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
384384
return NO;
385385
}
@@ -392,8 +392,8 @@ exports[`Config Plugin iOS Tests - openUrlFix must match positiveTemplateCases[3
392392
393393
{
394394
395-
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-5e029a87ac71df3ca5665387eb712d1b32274c6a
396-
if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
395+
// @generated begin @react-native-firebase/auth-openURL - expo prebuild (DO NOT MODIFY) sync-11c57ab508c3e776ab45ad4f3c3cb28310f617ea
396+
if (url.host && [url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
397397
// invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
398398
return NO;
399399
}

packages/auth/plugin/src/ios/openUrlFix.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function modifyAppDelegate(contents: string, language: string): string |
101101
}
102102

103103
const skipOpenUrlForFirebaseAuthBlock: string = `\
104-
if ([url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
104+
if (url.host && [url.host caseInsensitiveCompare:@"firebaseauth"] == NSOrderedSame) {
105105
// invocations for Firebase Auth are handled elsewhere and should not be forwarded to Expo Router
106106
return NO;
107107
}\

0 commit comments

Comments
 (0)