cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [1/2] android commit: Update JS.
Date Thu, 25 Oct 2012 19:02:39 GMT
Updated Branches:
  refs/heads/master 0eee2293d -> 011b512f2


Update JS.


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

Branch: refs/heads/master
Commit: 011b512f28e6cd96b3516fb0bed938184db679ae
Parents: aa2d17e
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Oct 25 15:02:26 2012 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Oct 25 15:02:26 2012 -0400

----------------------------------------------------------------------
 framework/assets/js/cordova.android.js |   38 ++++++++++++++++++--------
 1 files changed, 26 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/011b512f/framework/assets/js/cordova.android.js
----------------------------------------------------------------------
diff --git a/framework/assets/js/cordova.android.js b/framework/assets/js/cordova.android.js
index 693baa4..5efbd04 100644
--- a/framework/assets/js/cordova.android.js
+++ b/framework/assets/js/cordova.android.js
@@ -1,6 +1,6 @@
-// commit 6881d72b96f476a1e8cd6e03fe1465a0fb88b000
+// commit 8119d0b96958dfa3a0ce8590a90b24242ec4e31a
 
-// File generated at :: Wed Oct 24 2012 16:27:17 GMT-0400 (EDT)
+// File generated at :: Thu Oct 25 2012 15:01:24 GMT-0400 (EDT)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -966,22 +966,32 @@ function androidExec(success, fail, service, action, args) {
     }
 
     var callbackId = service + cordova.callbackId++,
-        argsJson = JSON.stringify(args);
-    if (success || fail) {
-        cordova.callbacks[callbackId] = {success:success, fail:fail};
+        argsJson = JSON.stringify(args),
+        returnValue;
+
+    // TODO: Returning the payload of a synchronous call was deprecated in 2.2.0.
+    // Remove it after 6 months.
+    function captureReturnValue(value) {
+        returnValue = value;
+        success(value);
     }
 
+    cordova.callbacks[callbackId] = {success:captureReturnValue, fail:fail};
+
     if (jsToNativeBridgeMode == jsToNativeModes.LOCATION_CHANGE) {
         window.location = 'http://cdv_exec/' + service + '#' + action + '#' + callbackId
+ '#' + argsJson;
     } else {
         var messages = nativeApiProvider.get().exec(service, action, callbackId, argsJson);
-        // Explicit cast to string is required on Android 2.1 to convert from
-        // a Java string to a JS string.
-        if (messages) {
-            messages = String(messages);
-        }
         androidExec.processMessages(messages);
     }
+    if (cordova.callbacks[callbackId]) {
+        if (success || fail) {
+            cordova.callbacks[callbackId].success = success;
+        } else {
+            delete cordova.callbacks[callbackId];
+        }
+    }
+    return returnValue;
 }
 
 function pollOnce() {
@@ -1065,6 +1075,8 @@ function processMessage(message) {
                 payload = true;
             } else if (payloadKind == 'f') {
                 payload = false;
+            } else if (payloadKind == 'N') {
+                payload = null;
             } else if (payloadKind == 'n') {
                 payload = +message.slice(nextSpaceIdx + 2);
             } else {
@@ -1095,8 +1107,6 @@ androidExec.processMessages = function(messages) {
                 window.setTimeout(pollOnce, 0);
                 break;
             }
-            // Needed for Android 2.2
-            messages = "" + messages;
             var spaceIdx = messages.indexOf(' ');
             var msgLen = +messages.slice(0, spaceIdx);
             var message = messages.substr(spaceIdx + 1, msgLen);
@@ -3940,6 +3950,10 @@ module.exports = {
     get: function() { return currentApi; },
     setPreferPrompt: function(value) {
         currentApi = value ? require('cordova/plugin/android/promptbasednativeapi') : nativeApi;
+    },
+    // Used only by tests.
+    set: function(value) {
+        currentApi = value;
     }
 };
 


Mime
View raw message