getTwitterUserName switched to performCallbackOnMainThreadforJS #542

Merged
merged 1 commit into from Jun 9, 2012
@@ -156,7 +156,11 @@ - (void) getTwitterUsername:(NSMutableArray*)arguments withDict:(NSMutableDictio
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
ACAccount *twitterAccount = [accountsArray objectAtIndex:0];
NSString *username = twitterAccount.username;
- [super writeJavascript:[[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:username] toSuccessCallbackString:callbackId]];
+
+ NSString *jsResponse = [[CDVPluginResult resultWithStatus:CDVCommandStatus_OK
+ messageAsString:username]
+ toSuccessCallbackString:callbackId];
+ [self performCallbackOnMainThreadforJS:jsResponse];
}
}];
@@ -22,8 +22,8 @@ Twitter.prototype.getMentions = function(success, failure){
cordova.exec(success, failure, "TwitterPlugin", "getMentions", []);
};
-Twitter.prototype.getTwitterUsername = function(response){
- cordova.exec(response, null, "TwitterPlugin", "getTwitterUsername", []);
+Twitter.prototype.getTwitterUsername = function(success, failure) {
+ cordova.exec(success, failure, "TwitterPlugin", "getTwitterUsername", []);
};
cordova.addConstructor(function() {