[jira] [Commented] (CB-10106) iOS bridges need to take into account bridge changes
[ https://issues.apache.org/jira/browse/CB-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15041332#comment-15041332 ] ASF subversion and git services commented on CB-10106: -- Commit 6340ef0729458b604fd964215135a482d4124053 in cordova-plugin-wkwebview-engine's branch refs/heads/master from [~shazron] [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-wkwebview-engine.git;h=6340ef0 ] CB-10106 - added bridge proxy > iOS bridges need to take into account bridge changes > > > Key: CB-10106 > URL: https://issues.apache.org/jira/browse/CB-10106 > Project: Apache Cordova > Issue Type: Bug > Components: iOS, Plugin WKWebViewEngine >Reporter: Shazron Abdullah >Assignee: Shazron Abdullah > Labels: cordova-ios-4.0.x > > New bridges (and the existing bridge) needs to take into account bridge > changes. > Each bridge should have this at the end of their .js: > {code} > // unregister the old bridge > cordova.define.remove('cordova/exec'); > // redefine bridge to our new bridge > cordova.define("cordova/exec", function(require, exports, module) { > module.exports = iOSExec; > }); > {code} > But, this would only re-define cordova.exec and the return value of > `require('cordova/exec')`. However, if the bridge was not loaded first, > existing local references in plugins to `require('cordova/exec')` will not be > updated. > Therefore, each bridge itself must detect that it is not the current bridge, > and forward commands to the new bridge. Thus: > {code} > var iOSExec = function() { > if (iOSExec !== cordova.exec) { > cordova.exec.apply(null, arguments); > return; > } > // ... rest of the implementation here... > } > {code} > Although I see this being a problem of the default bridge, not any external > bridges. > There might be an edge case where a command is already in the commandQueue > (default bridge) when the bridge is swapped, that needs to be handled. > I realize this seems hacky, but if there's a better way to handle this case > I'm all ears. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-10106) iOS bridges need to take into account bridge changes
[ https://issues.apache.org/jira/browse/CB-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15041330#comment-15041330 ] ASF subversion and git services commented on CB-10106: -- Commit f2e056e5fe945801b518b752871f5c64c0a28a88 in cordova-ios's branch refs/heads/master from [~shazron] [ https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git;h=f2e056e ] CB-10106 - added bridge proxy > iOS bridges need to take into account bridge changes > > > Key: CB-10106 > URL: https://issues.apache.org/jira/browse/CB-10106 > Project: Apache Cordova > Issue Type: Bug > Components: iOS, Plugin WKWebViewEngine >Reporter: Shazron Abdullah >Assignee: Shazron Abdullah > Labels: cordova-ios-4.0.x > > New bridges (and the existing bridge) needs to take into account bridge > changes. > Each bridge should have this at the end of their .js: > {code} > // unregister the old bridge > cordova.define.remove('cordova/exec'); > // redefine bridge to our new bridge > cordova.define("cordova/exec", function(require, exports, module) { > module.exports = iOSExec; > }); > {code} > But, this would only re-define cordova.exec and the return value of > `require('cordova/exec')`. However, if the bridge was not loaded first, > existing local references in plugins to `require('cordova/exec')` will not be > updated. > Therefore, each bridge itself must detect that it is not the current bridge, > and forward commands to the new bridge. Thus: > {code} > var iOSExec = function() { > if (iOSExec !== cordova.exec) { > cordova.exec.apply(null, arguments); > return; > } > // ... rest of the implementation here... > } > {code} > Although I see this being a problem of the default bridge, not any external > bridges. > There might be an edge case where a command is already in the commandQueue > (default bridge) when the bridge is swapped, that needs to be handled. > I realize this seems hacky, but if there's a better way to handle this case > I'm all ears. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-10106) iOS bridges need to take into account bridge changes
[ https://issues.apache.org/jira/browse/CB-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15034242#comment-15034242 ] ASF subversion and git services commented on CB-10106: -- Commit 7d81a79bee8e4f4d0885eb3131c18a517134db71 in cordova-ios's branch refs/heads/master from [~shazron] [ https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git;h=7d81a79 ] CB-10106 - iOS bridges need to take into account bridge changes > iOS bridges need to take into account bridge changes > > > Key: CB-10106 > URL: https://issues.apache.org/jira/browse/CB-10106 > Project: Apache Cordova > Issue Type: Bug > Components: iOS, Plugin WKWebViewEngine >Reporter: Shazron Abdullah >Assignee: Shazron Abdullah > Labels: cordova-ios-4.x > > New bridges (and the existing bridge) needs to take into account bridge > changes. > Each bridge should have this at the end of their .js: > {code} > // unregister the old bridge > cordova.define.remove('cordova/exec'); > // redefine bridge to our new bridge > cordova.define("cordova/exec", function(require, exports, module) { > module.exports = iOSExec; > }); > {code} > But, this would only re-define cordova.exec and the return value of > `require('cordova/exec')`. However, if the bridge was not loaded first, > existing local references in plugins to `require('cordova/exec')` will not be > updated. > Therefore, each bridge itself must detect that it is not the current bridge, > and forward commands to the new bridge. Thus: > {code} > var iOSExec = function() { > if (iOSExec !== cordova.exec) { > cordova.exec.apply(null, arguments); > return; > } > // ... rest of the implementation here... > } > {code} > Although I see this being a problem of the default bridge, not any external > bridges. > There might be an edge case where a command is already in the commandQueue > (default bridge) when the bridge is swapped, that needs to be handled. > I realize this seems hacky, but if there's a better way to handle this case > I'm all ears. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-10106) iOS bridges need to take into account bridge changes
[ https://issues.apache.org/jira/browse/CB-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15034205#comment-15034205 ] Shazron Abdullah commented on CB-10106: --- In the default bridge I had to do this in pokeNative() as well to clear the queue: {code} function pokeNative() { 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; } // rest of pokeNative } {code} > iOS bridges need to take into account bridge changes > > > Key: CB-10106 > URL: https://issues.apache.org/jira/browse/CB-10106 > Project: Apache Cordova > Issue Type: Bug > Components: iOS, Plugin WKWebViewEngine >Reporter: Shazron Abdullah >Assignee: Shazron Abdullah > Labels: cordova-ios-4.x > > New bridges (and the existing bridge) needs to take into account bridge > changes. > Each bridge should have this at the end of their .js: > {code} > // unregister the old bridge > cordova.define.remove('cordova/exec'); > // redefine bridge to our new bridge > cordova.define("cordova/exec", function(require, exports, module) { > module.exports = iOSExec; > }); > {code} > But, this would only re-define cordova.exec and the return value of > `require('cordova/exec')`. However, if the bridge was not loaded first, > existing local references in plugins to `require('cordova/exec')` will not be > updated. > Therefore, each bridge itself must detect that it is not the current bridge, > and forward commands to the new bridge. Thus: > {code} > var iOSExec = function() { > if (iOSExec !== cordova.exec) { > cordova.exec.apply(null, arguments); > return; > } > // ... rest of the implementation here... > } > {code} > Although I see this being a problem of the default bridge, not any external > bridges. > There might be an edge case where a command is already in the commandQueue > (default bridge) when the bridge is swapped, that needs to be handled. > I realize this seems hacky, but if there's a better way to handle this case > I'm all ears. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-10106) iOS bridges need to take into account bridge changes
[ https://issues.apache.org/jira/browse/CB-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15034248#comment-15034248 ] ASF subversion and git services commented on CB-10106: -- Commit b5c8de507b27c83ac3952d1114532b2c5307539b in cordova-plugin-wkwebview-engine's branch refs/heads/master from [~shazron] [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-wkwebview-engine.git;h=b5c8de5 ] CB-10106 - iOS bridges need to take into account bridge changes > iOS bridges need to take into account bridge changes > > > Key: CB-10106 > URL: https://issues.apache.org/jira/browse/CB-10106 > Project: Apache Cordova > Issue Type: Bug > Components: iOS, Plugin WKWebViewEngine >Reporter: Shazron Abdullah >Assignee: Shazron Abdullah > Labels: cordova-ios-4.x > > New bridges (and the existing bridge) needs to take into account bridge > changes. > Each bridge should have this at the end of their .js: > {code} > // unregister the old bridge > cordova.define.remove('cordova/exec'); > // redefine bridge to our new bridge > cordova.define("cordova/exec", function(require, exports, module) { > module.exports = iOSExec; > }); > {code} > But, this would only re-define cordova.exec and the return value of > `require('cordova/exec')`. However, if the bridge was not loaded first, > existing local references in plugins to `require('cordova/exec')` will not be > updated. > Therefore, each bridge itself must detect that it is not the current bridge, > and forward commands to the new bridge. Thus: > {code} > var iOSExec = function() { > if (iOSExec !== cordova.exec) { > cordova.exec.apply(null, arguments); > return; > } > // ... rest of the implementation here... > } > {code} > Although I see this being a problem of the default bridge, not any external > bridges. > There might be an edge case where a command is already in the commandQueue > (default bridge) when the bridge is swapped, that needs to be handled. > I realize this seems hacky, but if there's a better way to handle this case > I'm all ears. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-10106) iOS bridges need to take into account bridge changes
[ https://issues.apache.org/jira/browse/CB-10106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15034240#comment-15034240 ] Shazron Abdullah commented on CB-10106: --- I've decided to funnel all the processing in a handleBridgeChange function that is called in pokeNative() > iOS bridges need to take into account bridge changes > > > Key: CB-10106 > URL: https://issues.apache.org/jira/browse/CB-10106 > Project: Apache Cordova > Issue Type: Bug > Components: iOS, Plugin WKWebViewEngine >Reporter: Shazron Abdullah >Assignee: Shazron Abdullah > Labels: cordova-ios-4.x > > New bridges (and the existing bridge) needs to take into account bridge > changes. > Each bridge should have this at the end of their .js: > {code} > // unregister the old bridge > cordova.define.remove('cordova/exec'); > // redefine bridge to our new bridge > cordova.define("cordova/exec", function(require, exports, module) { > module.exports = iOSExec; > }); > {code} > But, this would only re-define cordova.exec and the return value of > `require('cordova/exec')`. However, if the bridge was not loaded first, > existing local references in plugins to `require('cordova/exec')` will not be > updated. > Therefore, each bridge itself must detect that it is not the current bridge, > and forward commands to the new bridge. Thus: > {code} > var iOSExec = function() { > if (iOSExec !== cordova.exec) { > cordova.exec.apply(null, arguments); > return; > } > // ... rest of the implementation here... > } > {code} > Although I see this being a problem of the default bridge, not any external > bridges. > There might be an edge case where a command is already in the commandQueue > (default bridge) when the bridge is swapped, that needs to be handled. > I realize this seems hacky, but if there's a better way to handle this case > I'm all ears. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org