aboutsummaryrefslogtreecommitdiffstats
path: root/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m
diff options
context:
space:
mode:
Diffstat (limited to 'iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m')
-rwxr-xr-xiPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m22
1 files changed, 8 insertions, 14 deletions
diff --git a/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m b/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m
index e399289..fa0e5e0 100755
--- a/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m
+++ b/iPhone/CordovaLib/Classes/CDVCommandDelegateImpl.m
@@ -55,7 +55,11 @@
- (void)evalJsHelper2:(NSString*)js
{
+ CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js];
+ if ([commandsJSON length] > 0) {
+ CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
+ }
[_commandQueue enqueCommandBatch:commandsJSON];
}
@@ -78,21 +82,16 @@
- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId
{
+ CDV_EXEC_LOG(@"Exec(%@): Sending result. Status=%@", callbackId, result.status);
// This occurs when there is are no win/fail callbacks for the call.
- if ([@"INVALID" isEqualToString:callbackId]) {
+ if ([@"INVALID" isEqualToString : callbackId]) {
return;
}
int status = [result.status intValue];
BOOL keepCallback = [result.keepCallback boolValue];
- id message = result.message == nil ? [NSNull null] : result.message;
+ NSString* argumentsAsJSON = [result argumentsAsJSON];
- // Use an array to encode the message as JSON.
- message = [NSArray arrayWithObject:message];
- NSString* encodedMessage = [message JSONString];
- // And then strip off the outer []s.
- encodedMessage = [encodedMessage substringWithRange:NSMakeRange(1, [encodedMessage length] - 2)];
- NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)",
- callbackId, status, encodedMessage, keepCallback];
+ NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)", callbackId, status, argumentsAsJSON, keepCallback];
[self evalJsHelper:js];
}
@@ -122,11 +121,6 @@
return [_viewController getCommandInstance:pluginName];
}
-- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className
-{
- [_viewController registerPlugin:plugin withClassName:className];
-}
-
- (void)runInBackground:(void (^)())block
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);