You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/08/21 01:21:02 UTC

[1/5] android commit: Update JS snapshot to version 3.5.0 (via coho)

Repository: cordova-android
Updated Branches:
  refs/heads/3.5.x 4d2467670 -> f89e63bc2


Update JS snapshot to version 3.5.0 (via coho)


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

Branch: refs/heads/3.5.x
Commit: bdbd5ba7b60dffd78231b024b9ae87809bc5c5c7
Parents: 4d24676
Author: Steven Gill <st...@gmail.com>
Authored: Fri Aug 15 11:41:57 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Fri Aug 15 11:41:57 2014 -0700

----------------------------------------------------------------------
 framework/assets/www/cordova.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bdbd5ba7/framework/assets/www/cordova.js
----------------------------------------------------------------------
diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js
index 4e7b0c8..b2103fb 100644
--- a/framework/assets/www/cordova.js
+++ b/framework/assets/www/cordova.js
@@ -1,5 +1,5 @@
 // Platform: android
-// 3.5.1
+// 3.5.0
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '3.5.1';
+var CORDOVA_JS_BUILD_LABEL = '3.5.0';
 // file: src/scripts/require.js
 
 /*jshint -W079 */


[2/5] android commit: Set VERSION to 3.5.0 (via coho)

Posted by st...@apache.org.
Set VERSION to 3.5.0 (via coho)


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/503c0480
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/503c0480
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/503c0480

Branch: refs/heads/3.5.x
Commit: 503c0480ed841df8def157bce1bc00d566b23368
Parents: bdbd5ba
Author: Steven Gill <st...@gmail.com>
Authored: Fri Aug 15 11:41:58 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Fri Aug 15 11:41:58 2014 -0700

----------------------------------------------------------------------
 VERSION                                         |  2 +-
 bin/templates/cordova/version                   |  2 +-
 .../src/org/apache/cordova/CordovaWebView.java  |  2 +-
 package.json                                    | 40 ++++++++++----------
 4 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/503c0480/VERSION
----------------------------------------------------------------------
diff --git a/VERSION b/VERSION
index d5c0c99..1545d96 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.5.1
+3.5.0

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/503c0480/bin/templates/cordova/version
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/version b/bin/templates/cordova/version
index 5e6be24..f935529 100755
--- a/bin/templates/cordova/version
+++ b/bin/templates/cordova/version
@@ -20,6 +20,6 @@
 */
 
 // Coho updates this line:
-var VERSION = "3.5.1";
+var VERSION = "3.5.0";
 
 console.log(VERSION);

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/503c0480/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index 86ef2ab..c6a7023 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -68,7 +68,7 @@ import android.widget.FrameLayout;
 public class CordovaWebView extends WebView {
 
     public static final String TAG = "CordovaWebView";
-    public static final String CORDOVA_VERSION = "3.5.1";
+    public static final String CORDOVA_VERSION = "3.5.0";
 
     private ArrayList<Integer> keyDownCodes = new ArrayList<Integer>();
     private ArrayList<Integer> keyUpCodes = new ArrayList<Integer>();

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/503c0480/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 9c3c786..12408e9 100644
--- a/package.json
+++ b/package.json
@@ -1,21 +1,21 @@
 {
-  "name": "cordova-android",
-  "version": "3.5.1",
-  "description": "cordova-android release",
-  "main": "bin/create",
-  "repository": {
-    "type": "git",
-    "url": "https://git-wip-us.apache.org/repos/asf/cordova-android.git"
-  },
-  "keywords": [
-    "android",
-    "cordova",
-    "apache"
-  ],
-  "author": "Apache Software Foundation",
-  "license": "Apache version 2.0",
-  "dependencies": {
-    "q": "^0.9.0",
-    "shelljs": "^0.2.6"
-  }
-}
+    "name": "cordova-android",
+    "version": "3.5.0",
+    "description": "cordova-android release",
+    "main": "bin/create",
+    "repository": {
+        "type": "git",
+        "url": "https://git-wip-us.apache.org/repos/asf/cordova-android.git"
+    },
+    "keywords": [
+        "android",
+        "cordova",
+        "apache"
+    ],
+    "author": "Apache Software Foundation",
+    "license": "Apache version 2.0",
+    "dependencies": {
+        "q": "^0.9.0",
+        "shelljs": "^0.2.6"
+    }
+}
\ No newline at end of file


[4/5] android commit: Update JS snapshot to version 3.5.0 (via coho)

Posted by st...@apache.org.
Update JS snapshot to version 3.5.0 (via coho)


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

Branch: refs/heads/3.5.x
Commit: bd30fdbda8c07349bdb90f9caf1ef8f3cddd17d1
Parents: 5ed35ee
Author: Steven Gill <st...@gmail.com>
Authored: Mon Aug 18 17:15:26 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Aug 18 17:15:26 2014 -0700

----------------------------------------------------------------------
 framework/assets/www/cordova.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bd30fdbd/framework/assets/www/cordova.js
----------------------------------------------------------------------
diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js
index a791995..2c4b681 100644
--- a/framework/assets/www/cordova.js
+++ b/framework/assets/www/cordova.js
@@ -1,5 +1,5 @@
 // Platform: android
-// 3.6.0-dev-ff0358b
+// 6e7d6458852630c595a2e73c8e99da9b18fe8794
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-ff0358b';
+var PLATFORM_VERSION_BUILD_LABEL = '3.5.0';
 // file: src/scripts/require.js
 
 /*jshint -W079 */
@@ -175,7 +175,8 @@ function createEvent(type, data) {
 var cordova = {
     define:define,
     require:require,
-    version:CORDOVA_JS_BUILD_LABEL,
+    version:PLATFORM_VERSION_BUILD_LABEL,
+    platformVersion:PLATFORM_VERSION_BUILD_LABEL,
     platformId:platform.id,
     /**
      * Methods to add/remove your own addEventListener hijacking on document + window.


[5/5] android commit: Update JS snapshot to version 3.5.0 (via coho)

Posted by st...@apache.org.
Update JS snapshot to version 3.5.0 (via coho)


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

Branch: refs/heads/3.5.x
Commit: f89e63bc2e7a7a233e96491e96fc3e5ffe79392e
Parents: bd30fdb
Author: Steven Gill <st...@gmail.com>
Authored: Wed Aug 20 15:54:40 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Aug 20 15:54:40 2014 -0700

----------------------------------------------------------------------
 framework/assets/www/cordova.js | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f89e63bc/framework/assets/www/cordova.js
----------------------------------------------------------------------
diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js
index 2c4b681..a791995 100644
--- a/framework/assets/www/cordova.js
+++ b/framework/assets/www/cordova.js
@@ -1,5 +1,5 @@
 // Platform: android
-// 6e7d6458852630c595a2e73c8e99da9b18fe8794
+// 3.6.0-dev-ff0358b
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var PLATFORM_VERSION_BUILD_LABEL = '3.5.0';
+var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-ff0358b';
 // file: src/scripts/require.js
 
 /*jshint -W079 */
@@ -175,8 +175,7 @@ function createEvent(type, data) {
 var cordova = {
     define:define,
     require:require,
-    version:PLATFORM_VERSION_BUILD_LABEL,
-    platformVersion:PLATFORM_VERSION_BUILD_LABEL,
+    version:CORDOVA_JS_BUILD_LABEL,
     platformId:platform.id,
     /**
      * Methods to add/remove your own addEventListener hijacking on document + window.


[3/5] android commit: Update JS snapshot to version 3.5.0 (via coho)

Posted by st...@apache.org.
Update JS snapshot to version 3.5.0 (via coho)


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/5ed35eea
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/5ed35eea
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/5ed35eea

Branch: refs/heads/3.5.x
Commit: 5ed35eeabb417020e1c26a295809a0ad363725a1
Parents: 503c048
Author: Steven Gill <st...@gmail.com>
Authored: Mon Aug 18 17:06:06 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Aug 18 17:06:06 2014 -0700

----------------------------------------------------------------------
 framework/assets/www/cordova.js | 112 +++++++++++++++++++++++------------
 1 file changed, 75 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/5ed35eea/framework/assets/www/cordova.js
----------------------------------------------------------------------
diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js
index b2103fb..a791995 100644
--- a/framework/assets/www/cordova.js
+++ b/framework/assets/www/cordova.js
@@ -1,5 +1,5 @@
 // Platform: android
-// 3.5.0
+// 3.6.0-dev-ff0358b
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '3.5.0';
+var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-ff0358b';
 // file: src/scripts/require.js
 
 /*jshint -W079 */
@@ -265,7 +265,7 @@ var cordova = {
         try {
             cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback);
         } catch (e) {
-            console.log("Error in error callback: " + callbackId + " = "+e);
+            console.log("Error in success callback: " + callbackId + " = "+e);
         }
     },
 
@@ -344,18 +344,18 @@ define("cordova/android/promptbasednativeapi", function(require, exports, module
 
 /**
  * Implements the API of ExposedJsApi.java, but uses prompt() to communicate.
- * This is used only on the 2.3 simulator, where addJavascriptInterface() is broken.
+ * This is used pre-JellyBean, where addJavascriptInterface() is disabled.
  */
 
 module.exports = {
-    exec: function(service, action, callbackId, argsJson) {
-        return prompt(argsJson, 'gap:'+JSON.stringify([service, action, callbackId]));
+    exec: function(bridgeSecret, service, action, callbackId, argsJson) {
+        return prompt(argsJson, 'gap:'+JSON.stringify([bridgeSecret, service, action, callbackId]));
     },
-    setNativeToJsBridgeMode: function(value) {
-        prompt(value, 'gap_bridge_mode:');
+    setNativeToJsBridgeMode: function(bridgeSecret, value) {
+        prompt(value, 'gap_bridge_mode:' + bridgeSecret);
     },
-    retrieveJsMessages: function(fromOnlineEvent) {
-        return prompt(+fromOnlineEvent, 'gap_poll:');
+    retrieveJsMessages: function(bridgeSecret, fromOnlineEvent) {
+        return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret);
     }
 };
 
@@ -869,13 +869,10 @@ var cordova = require('cordova'),
     nativeApiProvider = require('cordova/android/nativeapiprovider'),
     utils = require('cordova/utils'),
     base64 = require('cordova/base64'),
+    channel = require('cordova/channel'),
     jsToNativeModes = {
         PROMPT: 0,
-        JS_OBJECT: 1,
-        // This mode is currently for benchmarking purposes only. It must be enabled
-        // on the native side through the ENABLE_LOCATION_CHANGE_EXEC_MODE
-        // constant within CordovaWebViewClient.java before it will work.
-        LOCATION_CHANGE: 2
+        JS_OBJECT: 1
     },
     nativeToJsModes = {
         // Polls for messages using the JS->Native bridge.
@@ -895,9 +892,17 @@ var cordova = require('cordova'),
     jsToNativeBridgeMode,  // Set lazily.
     nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT,
     pollEnabled = false,
-    messagesFromNative = [];
+    messagesFromNative = [],
+    bridgeSecret = -1;
 
 function androidExec(success, fail, service, action, args) {
+    if (bridgeSecret < 0) {
+        // If we ever catch this firing, we'll need to queue up exec()s
+        // and fire them once we get a secret. For now, I don't think
+        // it's possible for exec() to be called since plugins are parsed but
+        // not run until until after onNativeReady.
+        throw new Error('exec() called without bridgeSecret');
+    }
     // Set default bridge modes if they have not already been set.
     // By default, we use the failsafe, since addJavascriptInterface breaks too often
     if (jsToNativeBridgeMode === undefined) {
@@ -918,29 +923,35 @@ function androidExec(success, fail, service, action, args) {
         cordova.callbacks[callbackId] = {success:success, fail:fail};
     }
 
-    if (jsToNativeBridgeMode == jsToNativeModes.LOCATION_CHANGE) {
-        window.location = 'http://cdv_exec/' + service + '#' + action + '#' + callbackId + '#' + argsJson;
+    var messages = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson);
+    // If argsJson was received by Java as null, try again with the PROMPT bridge mode.
+    // This happens in rare circumstances, such as when certain Unicode characters are passed over the bridge on a Galaxy S2.  See CB-2666.
+    if (jsToNativeBridgeMode == jsToNativeModes.JS_OBJECT && messages === "@Null arguments.") {
+        androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT);
+        androidExec(success, fail, service, action, args);
+        androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
+        return;
     } else {
-        var messages = nativeApiProvider.get().exec(service, action, callbackId, argsJson);
-        // If argsJson was received by Java as null, try again with the PROMPT bridge mode.
-        // This happens in rare circumstances, such as when certain Unicode characters are passed over the bridge on a Galaxy S2.  See CB-2666.
-        if (jsToNativeBridgeMode == jsToNativeModes.JS_OBJECT && messages === "@Null arguments.") {
-            androidExec.setJsToNativeBridgeMode(jsToNativeModes.PROMPT);
-            androidExec(success, fail, service, action, args);
-            androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
-            return;
-        } else {
-            androidExec.processMessages(messages, true);
-        }
+        androidExec.processMessages(messages, true);
     }
 }
 
+androidExec.init = function() {
+    bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
+    channel.onNativeReady.fire();
+};
+
 function pollOnceFromOnlineEvent() {
     pollOnce(true);
 }
 
 function pollOnce(opt_fromOnlineEvent) {
-    var msg = nativeApiProvider.get().retrieveJsMessages(!!opt_fromOnlineEvent);
+    if (bridgeSecret < 0) {
+        // This can happen when the NativeToJsMessageQueue resets the online state on page transitions.
+        // We know there's nothing to retrieve, so no need to poll.
+        return;
+    }
+    var msg = nativeApiProvider.get().retrieveJsMessages(bridgeSecret, !!opt_fromOnlineEvent);
     androidExec.processMessages(msg);
 }
 
@@ -990,7 +1001,10 @@ androidExec.setNativeToJsBridgeMode = function(mode) {
 
     nativeToJsBridgeMode = mode;
     // Tell the native side to switch modes.
-    nativeApiProvider.get().setNativeToJsBridgeMode(mode);
+    // Otherwise, it will be set by androidExec.init()
+    if (bridgeSecret >= 0) {
+        nativeApiProvider.get().setNativeToJsBridgeMode(bridgeSecret, mode);
+    }
 
     if (mode == nativeToJsModes.POLLING) {
         pollEnabled = true;
@@ -1465,10 +1479,8 @@ module.exports = {
             exec = require('cordova/exec'),
             modulemapper = require('cordova/modulemapper');
 
-        // Tell the native code that a page change has occurred.
-        exec(null, null, 'PluginManager', 'startup', []);
-        // Tell the JS that the native side is ready.
-        channel.onNativeReady.fire();
+        // Get the shared secret needed to use the bridge.
+        exec.init();
 
         // TODO: Extract this as a proper plugin.
         modulemapper.clobbers('cordova/plugin/android/app', 'navigator.app');
@@ -1485,6 +1497,17 @@ module.exports = {
         cordova.addDocumentEventHandler('menubutton');
         cordova.addDocumentEventHandler('searchbutton');
 
+        function bindButtonChannel(buttonName) {
+            // generic button bind used for volumeup/volumedown buttons
+            var volumeButtonChannel = cordova.addDocumentEventHandler(buttonName + 'button');
+            volumeButtonChannel.onHasSubscribersChange = function() {
+                exec(null, null, "App", "overrideButton", [buttonName, this.numHandlers == 1]);
+            };
+        }
+        // Inject a listener for the volume buttons on the document.
+        bindButtonChannel('volumeup');
+        bindButtonChannel('volumedown');
+
         // Let native code know we are all done on the JS side.
         // Native code will then un-hide the WebView.
         channel.onCordovaReady.subscribe(function() {
@@ -1563,6 +1586,21 @@ module.exports = {
     },
 
     /**
+    * Override the default behavior of the Android volume button.
+    * If overridden, when the volume button is pressed, the "volume[up|down]button"
+    * JavaScript event will be fired.
+    *
+    * Note: The user should not have to call this method.  Instead, when the user
+    *       registers for the "volume[up|down]button" event, this is automatically done.
+    *
+    * @param button          volumeup, volumedown
+    * @param override        T=override, F=cancel override
+    */
+    overrideButton:function(button, override) {
+        exec(null, null, "App", "overrideButton", [button, override]);
+    },
+
+    /**
     * Exit and terminate the application.
     */
     exitApp:function() {
@@ -1655,11 +1693,11 @@ function handlePluginsObject(path, moduleList, finishPluginLoading) {
 function findCordovaPath() {
     var path = null;
     var scripts = document.getElementsByTagName('script');
-    var term = 'cordova.js';
+    var term = '/cordova.js';
     for (var n = scripts.length-1; n>-1; n--) {
         var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
         if (src.indexOf(term) == (src.length - term.length)) {
-            path = src.substring(0, src.length - term.length);
+            path = src.substring(0, src.length - term.length) + '/';
             break;
         }
     }