@@ -41,7 +41,7 @@ - (void) trySilentLogin:(CDVInvokedUrlCommand*)command {
41
41
// trySilentAuthentication doesn't call delegate when it fails, so handle it here
42
42
if (![[self getGooglePlusSignInObject: command] trySilentAuthentication ]) {
43
43
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];
45
45
}
46
46
}
47
47
@@ -51,7 +51,7 @@ - (GPPSignIn*) getGooglePlusSignInObject:(CDVInvokedUrlCommand*)command {
51
51
NSString * apiKey = [options objectForKey: @" iOSApiKey" ];
52
52
if (apiKey == nil ) {
53
53
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: @" iOSApiKey not set" ];
54
- [self writeJavascript: [ pluginResult toErrorCallbackString : _callbackId] ];
54
+ [self .commandDelegate sendPluginResult: pluginResult callbackId : _callbackId];
55
55
return nil ;
56
56
}
57
57
@@ -69,13 +69,13 @@ - (GPPSignIn*) getGooglePlusSignInObject:(CDVInvokedUrlCommand*)command {
69
69
- (void ) logout : (CDVInvokedUrlCommand*)command {
70
70
[[GPPSignIn sharedInstance ] signOut ];
71
71
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString: @" logged out" ];
72
- [self writeJavascript: [ pluginResult toSuccessCallbackString : command.callbackId] ];
72
+ [self .commandDelegate sendPluginResult: pluginResult callbackId : command.callbackId];
73
73
}
74
74
75
75
- (void ) disconnect : (CDVInvokedUrlCommand*)command {
76
76
[[GPPSignIn sharedInstance ] disconnect ];
77
77
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsString: @" disconnected" ];
78
- [self writeJavascript: [ pluginResult toSuccessCallbackString : command.callbackId] ];
78
+ [self .commandDelegate sendPluginResult: pluginResult callbackId : command.callbackId];
79
79
}
80
80
81
81
- (void ) share_unused : (CDVInvokedUrlCommand*)command {
@@ -87,7 +87,7 @@ - (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
87
87
error : (NSError *)error {
88
88
if (error) {
89
89
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_ERROR messageAsString: error.localizedDescription];
90
- [self writeJavascript: [ pluginResult toErrorCallbackString : _callbackId] ];
90
+ [self .commandDelegate sendPluginResult: pluginResult callbackId : _callbackId];
91
91
} else {
92
92
NSString *email = [GPPSignIn sharedInstance ].userEmail ;
93
93
NSString *token = [GPPSignIn sharedInstance ].idToken ;
@@ -119,7 +119,7 @@ - (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
119
119
};
120
120
}
121
121
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsDictionary: result];
122
- [self writeJavascript: [ pluginResult toSuccessCallbackString : _callbackId] ];
122
+ [self .commandDelegate sendPluginResult: pluginResult callbackId : _callbackId];
123
123
}
124
124
}
125
125
0 commit comments