You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/12/17 18:12:24 UTC
ios commit: CB-5134 Add location.hash based exec() bridge.
Updated Branches:
refs/heads/master 7452c68c7 -> 0f28be660
CB-5134 Add location.hash based exec() bridge.
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/0f28be66
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/0f28be66
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/0f28be66
Branch: refs/heads/master
Commit: 0f28be660c19f0860d1a37ee985e1fd934cae836
Parents: 7452c68
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Dec 17 12:11:56 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Dec 17 12:11:56 2013 -0500
----------------------------------------------------------------------
CordovaLib/Classes/CDVCommandQueue.m | 2 +-
CordovaLib/Classes/CDVViewController.m | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/0f28be66/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index 606cc8a..1e25ecc 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -58,6 +58,7 @@
- (void)enqueueCommandBatch:(NSString*)batchJSON
{
+ CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [batchJSON length] > 0);
if ([batchJSON length] > 0) {
[_queue addObject:batchJSON];
[self executePending];
@@ -93,7 +94,6 @@
NSString* queuedCommandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:
@"cordova.require('cordova/exec').nativeFetchMessages()"];
- CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
[self enqueueCommandBatch:queuedCommandsJSON];
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/0f28be66/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index a8d2c47..ab86dfe 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -658,6 +658,17 @@
return NO;
}
+ if ([[url fragment] hasPrefix:@"%01"]) {
+ NSString* inlineCommands = [[url fragment] substringFromIndex:3];
+ if ([inlineCommands length] == 0) {
+ [_commandQueue fetchCommandsFromJs];
+ } else {
+ inlineCommands = [inlineCommands stringByRemovingPercentEncoding];
+ [_commandQueue enqueueCommandBatch:inlineCommands];
+ }
+ return NO;
+ }
+
/*
* Give plugins the chance to handle the url
*/