cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: CB-10106 - iOS bridges need to take into account bridge changes
Date Tue, 01 Dec 2015 18:14:09 GMT
Repository: cordova-ios
Updated Branches:
  refs/heads/master e3ae7e3ca -> 7d81a79be


CB-10106 - iOS bridges need to take into account bridge changes


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/7d81a79b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/7d81a79b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/7d81a79b

Branch: refs/heads/master
Commit: 7d81a79bee8e4f4d0885eb3131c18a517134db71
Parents: e3ae7e3
Author: Shazron Abdullah <shazron@apache.org>
Authored: Tue Dec 1 10:14:01 2015 -0800
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Tue Dec 1 10:14:01 2015 -0800

----------------------------------------------------------------------
 cordova-js-src/exec.js | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/7d81a79b/cordova-js-src/exec.js
----------------------------------------------------------------------
diff --git a/cordova-js-src/exec.js b/cordova-js-src/exec.js
index 11c6f55..155f2ba 100644
--- a/cordova-js-src/exec.js
+++ b/cordova-js-src/exec.js
@@ -134,7 +134,32 @@ function iOSExec() {
     }
 }
 
+function handleBridgeChange() {
+    if (iOSExec !== cordova.exec) {
+        var commandString = commandQueue.shift();
+        while(commandString) {
+            var command = JSON.parse(commandString);
+            var callbackId = command[0];
+            var service = command[1];
+            var action = command[2];
+            var actionArgs = command[3];
+            var callbacks = cordova.callbacks[callbackId] || {};
+            
+            cordova.exec(callbacks.success, callbacks.fail, service, action, actionArgs);
+            
+            commandString = commandQueue.shift();
+        };
+        return true;
+    }
+    
+    return false;
+}     
+
 function pokeNative() {
+    if (handleBridgeChange()) {
+        return;
+    }
+    
     // CB-5488 - Don't attempt to create iframe before document.body is available.
     if (!document.body) {
         setTimeout(pokeNative);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message