Skip to content

Commit 97b3fe3

Browse files
committed
fix opening universal links
1 parent 3811f30 commit 97b3fe3

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/ios/AppDelegate+FirebasePlugin.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,6 @@ - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotif
290290
[FirebasePlugin.firebasePlugin _logError:[NSString stringWithFormat:@"didFailToRegisterForRemoteNotificationsWithError: %@", error.description]];
291291
}
292292

293-
- (BOOL)application:(nonnull UIApplication *)application
294-
openURL:(nonnull NSURL *)url
295-
options:(nonnull NSDictionary<NSString *, id> *)options {
296-
return [[GIDSignIn sharedInstance] handleURL:url];
297-
}
298-
299293
- (void)userNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(UNNotification *)notification
300294
{
301295
@try {

src/ios/FirebasePlugin.m

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ + (void) setFirestore:(FIRFirestore*) firestoreInstance{
5555
firestore = firestoreInstance;
5656
}
5757

58+
- (void)applicationLaunchedWithUrl:(NSNotification*)notification
59+
{
60+
NSURL* url = [notification object];
61+
[[GIDSignIn sharedInstance] handleURL:url];
62+
}
63+
5864
// @override abstract
5965
- (void)pluginInitialize {
6066
NSLog(@"Starting Firebase plugin");
@@ -64,6 +70,8 @@ - (void)pluginInitialize {
6470
preferences = [NSUserDefaults standardUserDefaults];
6571
googlePlist = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]];
6672

73+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationLaunchedWithUrl:) name:CDVPluginHandleOpenURLNotification object:nil];
74+
6775
if([self getGooglePlistFlagWithDefaultValue:FirebaseCrashlyticsCollectionEnabled defaultValue:YES]){
6876
[self setPreferenceFlag:FIREBASE_CRASHLYTICS_COLLECTION_ENABLED flag:YES];
6977
}
@@ -81,7 +89,7 @@ - (void)pluginInitialize {
8189

8290
// Check for permission and register for remote notifications if granted
8391
[self _hasPermission:^(BOOL result) {}];
84-
92+
8593

8694
authCredentials = [[NSMutableDictionary alloc] init];
8795
firestoreListeners = [[NSMutableDictionary alloc] init];
@@ -738,15 +746,15 @@ - (void)authenticateUserWithGoogle:(CDVInvokedUrlCommand*)command{
738746
[GIDSignIn.sharedInstance signInWithConfiguration:googleSignInConfig presentingViewController:self.viewController callback:^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {
739747
__auto_type strongSelf = weakSelf;
740748
if (strongSelf == nil) { return; }
741-
749+
742750
@try{
743751
CDVPluginResult* pluginResult;
744752
if (error == nil) {
745753
GIDAuthentication *authentication = user.authentication;
746754
FIRAuthCredential *credential =
747755
[FIRGoogleAuthProvider credentialWithIDToken:authentication.idToken
748756
accessToken:authentication.accessToken];
749-
757+
750758
NSNumber* key = [[FirebasePlugin firebasePlugin] saveAuthCredential:credential];
751759
NSString *idToken = user.authentication.idToken;
752760
NSMutableDictionary* result = [[NSMutableDictionary alloc] init];

0 commit comments

Comments
 (0)