Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/ios/AppDelegate+FirebasePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,6 @@ - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotif
[FirebasePlugin.firebasePlugin _logError:[NSString stringWithFormat:@"didFailToRegisterForRemoteNotificationsWithError: %@", error.description]];
}

- (BOOL)application:(nonnull UIApplication *)application
openURL:(nonnull NSURL *)url
options:(nonnull NSDictionary<NSString *, id> *)options {
return [[GIDSignIn sharedInstance] handleURL:url];
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(UNNotification *)notification
{
@try {
Expand Down
14 changes: 11 additions & 3 deletions src/ios/FirebasePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ + (void) setFirestore:(FIRFirestore*) firestoreInstance{
firestore = firestoreInstance;
}

- (void)applicationLaunchedWithUrl:(NSNotification*)notification
{
NSURL* url = [notification object];
[[GIDSignIn sharedInstance] handleURL:url];
}

// @override abstract
- (void)pluginInitialize {
NSLog(@"Starting Firebase plugin");
Expand All @@ -64,6 +70,8 @@ - (void)pluginInitialize {
preferences = [NSUserDefaults standardUserDefaults];
googlePlist = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationLaunchedWithUrl:) name:CDVPluginHandleOpenURLNotification object:nil];

if([self getGooglePlistFlagWithDefaultValue:FirebaseCrashlyticsCollectionEnabled defaultValue:YES]){
[self setPreferenceFlag:FIREBASE_CRASHLYTICS_COLLECTION_ENABLED flag:YES];
}
Expand All @@ -81,7 +89,7 @@ - (void)pluginInitialize {

// Check for permission and register for remote notifications if granted
[self _hasPermission:^(BOOL result) {}];


authCredentials = [[NSMutableDictionary alloc] init];
firestoreListeners = [[NSMutableDictionary alloc] init];
Expand Down Expand Up @@ -738,15 +746,15 @@ - (void)authenticateUserWithGoogle:(CDVInvokedUrlCommand*)command{
[GIDSignIn.sharedInstance signInWithConfiguration:googleSignInConfig presentingViewController:self.viewController callback:^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {
__auto_type strongSelf = weakSelf;
if (strongSelf == nil) { return; }

@try{
CDVPluginResult* pluginResult;
if (error == nil) {
GIDAuthentication *authentication = user.authentication;
FIRAuthCredential *credential =
[FIRGoogleAuthProvider credentialWithIDToken:authentication.idToken
accessToken:authentication.accessToken];

NSNumber* key = [[FirebasePlugin firebasePlugin] saveAuthCredential:credential];
NSString *idToken = user.authentication.idToken;
NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
Expand Down