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

Commit 5389799

Browse files
#22 User-cancelled login on iOS - Neither the success nor error callbacks are called
1 parent 941b8b5 commit 5389799

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: src/ios/GooglePlus.m

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ - (void) trySilentLogin:(CDVInvokedUrlCommand*)command {
4141
// trySilentAuthentication doesn't call delegate when it fails, so handle it here
4242
if (![[self getGooglePlusSignInObject:command] trySilentAuthentication]) {
4343
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no valid token"];
44-
[self writeJavascript:[pluginResult toErrorCallbackString:command.callbackId]];
44+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
4545
}
4646
}
4747

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

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

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

8181
- (void) share_unused:(CDVInvokedUrlCommand*)command {
@@ -87,7 +87,7 @@ - (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
8787
error:(NSError *)error {
8888
if (error) {
8989
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error.localizedDescription];
90-
[self writeJavascript:[pluginResult toErrorCallbackString:_callbackId]];
90+
[self.commandDelegate sendPluginResult:pluginResult callbackId:_callbackId];
9191
} else {
9292
NSString *email = [GPPSignIn sharedInstance].userEmail;
9393
NSString *token = [GPPSignIn sharedInstance].idToken;
@@ -119,7 +119,7 @@ - (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
119119
};
120120
}
121121
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result];
122-
[self writeJavascript:[pluginResult toSuccessCallbackString:_callbackId]];
122+
[self.commandDelegate sendPluginResult:pluginResult callbackId:_callbackId];
123123
}
124124
}
125125

0 commit comments

Comments
 (0)