From 931c315f21676575dc9bb8de7fbc844992bc3878 Mon Sep 17 00:00:00 2001 From: EddyVerbruggen Date: Sun, 12 Oct 2014 21:43:20 +0200 Subject: [PATCH] #3 redirect url not handled when redirected from Google+ app on iOS --- plugin.xml | 2 +- src/ios/GooglePlus.h | 1 + src/ios/GooglePlus.m | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin.xml b/plugin.xml index d83d6075..8ffdd9d8 100755 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="1.0.2"> Google+ diff --git a/src/ios/GooglePlus.h b/src/ios/GooglePlus.h index fe2f6b9a..2e069174 100644 --- a/src/ios/GooglePlus.h +++ b/src/ios/GooglePlus.h @@ -4,6 +4,7 @@ @interface GooglePlus : CDVPlugin @property (nonatomic, copy) NSString* callbackId; +@property (nonatomic, assign) BOOL isSigningIn; - (void) login:(CDVInvokedUrlCommand*)command; - (void) trySilentLogin:(CDVInvokedUrlCommand*)command; diff --git a/src/ios/GooglePlus.m b/src/ios/GooglePlus.m index 72fbede4..15e79e4e 100644 --- a/src/ios/GooglePlus.m +++ b/src/ios/GooglePlus.m @@ -18,19 +18,22 @@ - (BOOL)identity_application: (UIApplication *)application sourceApplication: (NSString *)sourceApplication annotation: (id)annotation { - if (url && [url.path rangeOfString:@"oauth2callback"].location != NSNotFound) { + GooglePlus* gp = (GooglePlus*)[[self.viewController pluginObjects] objectForKey:@"GooglePlus"]; + + if ([gp isSigningIn]) { + gp.isSigningIn = NO; return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation]; } else { // call super return [self identity_application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; } } - @end @implementation GooglePlus - (void) login:(CDVInvokedUrlCommand*)command { + self.isSigningIn = YES; [[self getGooglePlusSignInObject:command] authenticate]; }