Browse files

Updated handleOpenURL to wrap the callback in a setTimeout (with a ti…

…mer value of 0) so any graphical alerts don't block the app.
  • Loading branch information...
1 parent cf2a115 commit d3f7ce56ab8ffa9d7f97f1c9f3853856eacb14fb @shazron shazron committed Jul 11, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 native/ios/FacebookConnectPlugin.m
View
4 native/ios/FacebookConnectPlugin.m
@@ -42,7 +42,9 @@ - (void) handleOpenURL:(NSNotification*)notification
PluginResult* result = [PluginResult resultWithStatus:PGCommandStatus_OK messageAsDictionary:status];
- [super writeJavascript:[result toSuccessCallbackString:self.loginCallbackId]];
+ NSString* callback = [result toSuccessCallbackString:self.loginCallbackId];
+ // we need to wrap the callback in a setTimeout(func, 0) so it doesn't block the UI (handleOpenURL limitation)
+ [super writeJavascript:[NSString stringWithFormat:@"setTimeout(function() { %@; }, 0);", callback]];
}
}

0 comments on commit d3f7ce5

Please sign in to comment.