Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
#22 User-cancelled login on iOS - Neither the success nor error callb…
Browse files Browse the repository at this point in the history
…acks are called
  • Loading branch information
EddyVerbruggen committed Dec 8, 2014
1 parent 941b8b5 commit 5389799
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ios/GooglePlus.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ - (void) trySilentLogin:(CDVInvokedUrlCommand*)command {
// trySilentAuthentication doesn't call delegate when it fails, so handle it here
if (![[self getGooglePlusSignInObject:command] trySilentAuthentication]) {
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no valid token"];
[self writeJavascript:[pluginResult toErrorCallbackString:command.callbackId]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
}

Expand All @@ -51,7 +51,7 @@ - (GPPSignIn*) getGooglePlusSignInObject:(CDVInvokedUrlCommand*)command {
NSString* apiKey = [options objectForKey:@"iOSApiKey"];
if (apiKey == nil) {
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"iOSApiKey not set"];
[self writeJavascript:[pluginResult toErrorCallbackString:_callbackId]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:_callbackId];
return nil;
}

Expand All @@ -69,13 +69,13 @@ - (GPPSignIn*) getGooglePlusSignInObject:(CDVInvokedUrlCommand*)command {
- (void) logout:(CDVInvokedUrlCommand*)command {
[[GPPSignIn sharedInstance] signOut];
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"logged out"];
[self writeJavascript:[pluginResult toSuccessCallbackString:command.callbackId]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void) disconnect:(CDVInvokedUrlCommand*)command {
[[GPPSignIn sharedInstance] disconnect];
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"disconnected"];
[self writeJavascript:[pluginResult toSuccessCallbackString:command.callbackId]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void) share_unused:(CDVInvokedUrlCommand*)command {
Expand All @@ -87,7 +87,7 @@ - (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error {
if (error) {
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error.localizedDescription];
[self writeJavascript:[pluginResult toErrorCallbackString:_callbackId]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:_callbackId];
} else {
NSString *email = [GPPSignIn sharedInstance].userEmail;
NSString *token = [GPPSignIn sharedInstance].idToken;
Expand Down Expand Up @@ -119,7 +119,7 @@ - (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
};
}
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result];
[self writeJavascript:[pluginResult toSuccessCallbackString:_callbackId]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:_callbackId];
}
}

Expand Down

0 comments on commit 5389799

Please sign in to comment.