You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by na...@apache.org on 2014/05/06 22:59:11 UTC

[01/11] git commit: Updated cordova.js after upleveling cordova-js from android port.

Repository: cordova-amazon-fireos
Updated Branches:
  refs/heads/master 037f7757b -> b3011d3b6


Updated cordova.js after upleveling cordova-js from android port.


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

Branch: refs/heads/master
Commit: ca48cf569c13692c4e9d0b7eb7f55f362bede587
Parents: 31bfe2d
Author: Archana Naik <na...@lab126.com>
Authored: Mon May 5 14:03:46 2014 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:46 2014 -0700

----------------------------------------------------------------------
 framework/assets/www/cordova.js | 274 ++++++++++++++++++++++++++---------
 1 file changed, 202 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/ca48cf56/framework/assets/www/cordova.js
----------------------------------------------------------------------
diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js
index 1cbf794..086b289 100644
--- a/framework/assets/www/cordova.js
+++ b/framework/assets/www/cordova.js
@@ -1,5 +1,5 @@
 // Platform: amazon-fireos
-// 3.5.0-dev-ddf13aa
+// 3.6.0-dev-d019540
 /*
  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-dev-ddf13aa';
+var CORDOVA_JS_BUILD_LABEL = '3.6.0-dev-d019540';
 // file: src/scripts/require.js
 
 /*jshint -W079 */
@@ -437,6 +437,16 @@ base64.fromArrayBuffer = function(arrayBuffer) {
     return uint8ToBase64(array);
 };
 
+base64.toArrayBuffer = function(str) {
+    var decodedStr = typeof atob != 'undefined' ? atob(str) : new Buffer(str,'base64').toString('binary');
+    var arrayBuffer = new ArrayBuffer(decodedStr.length);
+    var array = new Uint8Array(arrayBuffer);
+    for (var i=0, len=decodedStr.length; i < len; i++) {
+        array[i] = decodedStr.charCodeAt(i);
+    }
+    return arrayBuffer;
+};
+
 //------------------------------------------------------------------------------
 
 /* This code is based on the performance tests at http://jsperf.com/b64tests
@@ -815,6 +825,7 @@ channel.createSticky('onNativeReady');
 channel.createSticky('onCordovaReady');
 
 // Event to indicate that all automatically loaded JS plugins are loaded and ready.
+// FIXME remove this
 channel.createSticky('onPluginsReady');
 
 // Event to indicate that Cordova is ready
@@ -919,7 +930,7 @@ function androidExec(success, fail, service, action, args) {
             androidExec.setJsToNativeBridgeMode(jsToNativeModes.JS_OBJECT);
             return;
         } else {
-            androidExec.processMessages(messages);
+            androidExec.processMessages(messages, true);
         }
     }
 }
@@ -963,7 +974,6 @@ androidExec.nativeToJsModes = nativeToJsModes;
 
 androidExec.setJsToNativeBridgeMode = function(mode) {
     if (mode == jsToNativeModes.JS_OBJECT && !window._cordovaNative) {
-        console.log('Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only.');
         mode = jsToNativeModes.PROMPT;
     }
     nativeApiProvider.setPreferPrompt(mode == jsToNativeModes.PROMPT);
@@ -1028,48 +1038,64 @@ function processMessage(message) {
             }
             cordova.callbackFromNative(callbackId, success, status, [payload], keepCallback);
         } else {
-            console.log("processMessage failed: invalid message:" + message);
+            console.log("processMessage failed: invalid message: " + JSON.stringify(message));
         }
     } catch (e) {
-        console.log("processMessage failed: Message: " + message);
         console.log("processMessage failed: Error: " + e);
         console.log("processMessage failed: Stack: " + e.stack);
+        console.log("processMessage failed: Message: " + message);
     }
 }
 
+var isProcessing = false;
+
 // This is called from the NativeToJsMessageQueue.java.
-androidExec.processMessages = function(messages) {
+androidExec.processMessages = function(messages, opt_useTimeout) {
     if (messages) {
         messagesFromNative.push(messages);
-        // Check for the reentrant case, and enqueue the message if that's the case.
-        if (messagesFromNative.length > 1) {
-            return;
-        }
+    }
+    // Check for the reentrant case.
+    if (isProcessing) {
+        return;
+    }
+    if (opt_useTimeout) {
+        window.setTimeout(androidExec.processMessages, 0);
+        return;
+    }
+    isProcessing = true;
+    try {
+        // TODO: add setImmediate polyfill and process only one message at a time.
         while (messagesFromNative.length) {
-            // Don't unshift until the end so that reentrancy can be detected.
-            messages = messagesFromNative[0];
+            var msg = popMessageFromQueue();
             // The Java side can send a * message to indicate that it
             // still has messages waiting to be retrieved.
-            if (messages == '*') {
-                messagesFromNative.shift();
-                window.setTimeout(pollOnce, 0);
+            if (msg == '*' && messagesFromNative.length === 0) {
+                setTimeout(pollOnce, 0);
                 return;
             }
-
-            var spaceIdx = messages.indexOf(' ');
-            var msgLen = +messages.slice(0, spaceIdx);
-            var message = messages.substr(spaceIdx + 1, msgLen);
-            messages = messages.slice(spaceIdx + msgLen + 1);
-            processMessage(message);
-            if (messages) {
-                messagesFromNative[0] = messages;
-            } else {
-                messagesFromNative.shift();
-            }
+            processMessage(msg);
         }
+    } finally {
+        isProcessing = false;
     }
 };
 
+function popMessageFromQueue() {
+    var messageBatch = messagesFromNative.shift();
+    if (messageBatch == '*') {
+        return '*';
+    }
+
+    var spaceIdx = messageBatch.indexOf(' ');
+    var msgLen = +messageBatch.slice(0, spaceIdx);
+    var message = messageBatch.substr(spaceIdx + 1, msgLen);
+    messageBatch = messageBatch.slice(spaceIdx + msgLen + 1);
+    if (messageBatch) {
+        messagesFromNative.unshift(messageBatch);
+    }
+    return message;
+}
+
 module.exports = androidExec;
 
 });
@@ -1191,9 +1217,13 @@ modulemapper.clobbers('cordova/exec', 'Cordova.exec');
 // Call the platform-specific initialization.
 platform.bootstrap && platform.bootstrap();
 
-pluginloader.load(function() {
-    channel.onPluginsReady.fire();
-});
+// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js.
+// The delay allows the attached modules to be defined before the plugin loader looks for them.
+setTimeout(function() {
+    pluginloader.load(function() {
+        channel.onPluginsReady.fire();
+    });
+}, 0);
 
 /**
  * Create all cordova objects once native side is ready.
@@ -1218,6 +1248,111 @@ channel.join(function() {
 
 });
 
+// file: src/common/init_b.js
+define("cordova/init_b", function(require, exports, module) {
+
+var channel = require('cordova/channel');
+var cordova = require('cordova');
+var platform = require('cordova/platform');
+
+var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady];
+
+// setting exec
+cordova.exec = require('cordova/exec');
+
+function logUnfiredChannels(arr) {
+    for (var i = 0; i < arr.length; ++i) {
+        if (arr[i].state != 2) {
+            console.log('Channel not fired: ' + arr[i].type);
+        }
+    }
+}
+
+window.setTimeout(function() {
+    if (channel.onDeviceReady.state != 2) {
+        console.log('deviceready has not fired after 5 seconds.');
+        logUnfiredChannels(platformInitChannelsArray);
+        logUnfiredChannels(channel.deviceReadyChannelsArray);
+    }
+}, 5000);
+
+// Replace navigator before any modules are required(), to ensure it happens as soon as possible.
+// We replace it so that properties that can't be clobbered can instead be overridden.
+function replaceNavigator(origNavigator) {
+    var CordovaNavigator = function() {};
+    CordovaNavigator.prototype = origNavigator;
+    var newNavigator = new CordovaNavigator();
+    // This work-around really only applies to new APIs that are newer than Function.bind.
+    // Without it, APIs such as getGamepads() break.
+    if (CordovaNavigator.bind) {
+        for (var key in origNavigator) {
+            if (typeof origNavigator[key] == 'function') {
+                newNavigator[key] = origNavigator[key].bind(origNavigator);
+            }
+        }
+    }
+    return newNavigator;
+}
+if (window.navigator) {
+    window.navigator = replaceNavigator(window.navigator);
+}
+
+if (!window.console) {
+    window.console = {
+        log: function(){}
+    };
+}
+if (!window.console.warn) {
+    window.console.warn = function(msg) {
+        this.log("warn: " + msg);
+    };
+}
+
+// Register pause, resume and deviceready channels as events on document.
+channel.onPause = cordova.addDocumentEventHandler('pause');
+channel.onResume = cordova.addDocumentEventHandler('resume');
+channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
+
+// Listen for DOMContentLoaded and notify our channel subscribers.
+if (document.readyState == 'complete' || document.readyState == 'interactive') {
+    channel.onDOMContentLoaded.fire();
+} else {
+    document.addEventListener('DOMContentLoaded', function() {
+        channel.onDOMContentLoaded.fire();
+    }, false);
+}
+
+// _nativeReady is global variable that the native side can set
+// to signify that the native code is ready. It is a global since
+// it may be called before any cordova JS is ready.
+if (window._nativeReady) {
+    channel.onNativeReady.fire();
+}
+
+// Call the platform-specific initialization.
+platform.bootstrap && platform.bootstrap();
+
+/**
+ * Create all cordova objects once native side is ready.
+ */
+channel.join(function() {
+    
+    platform.initialize && platform.initialize();
+
+    // Fire event to notify that all objects are created
+    channel.onCordovaReady.fire();
+
+    // Fire onDeviceReady event once page has fully loaded, all
+    // constructors have run and cordova info has been received from native
+    // side.
+    channel.join(function() {
+        require('cordova').fireDocumentEvent('deviceready');
+    }, channel.deviceReadyChannelsArray);
+
+}, platformInitChannelsArray);
+
+});
+
 // file: src/common/modulemapper.js
 define("cordova/modulemapper", function(require, exports, module) {
 
@@ -1444,43 +1579,51 @@ var modulemapper = require('cordova/modulemapper');
 var urlutil = require('cordova/urlutil');
 
 // Helper function to inject a <script> tag.
-function injectScript(url, onload, onerror) {
+// Exported for testing.
+exports.injectScript = function(url, onload, onerror) {
     var script = document.createElement("script");
     // onload fires even when script fails loads with an error.
     script.onload = onload;
-    script.onerror = onerror || onload;
+    // onerror fires for malformed URLs.
+    script.onerror = onerror;
     script.src = url;
     document.head.appendChild(script);
+};
+
+function injectIfNecessary(id, url, onload, onerror) {
+    onerror = onerror || onload;
+    if (id in define.moduleMap) {
+        onload();
+    } else {
+        exports.injectScript(url, function() {
+            if (id in define.moduleMap) {
+                onload();
+            } else {
+                onerror();
+            }
+        }, onerror);
+    }
 }
 
 function onScriptLoadingComplete(moduleList, finishPluginLoading) {
     // Loop through all the plugins and then through their clobbers and merges.
     for (var i = 0, module; module = moduleList[i]; i++) {
-        if (module) {
-            try {
-                if (module.clobbers && module.clobbers.length) {
-                    for (var j = 0; j < module.clobbers.length; j++) {
-                        modulemapper.clobbers(module.id, module.clobbers[j]);
-                    }
-                }
-
-                if (module.merges && module.merges.length) {
-                    for (var k = 0; k < module.merges.length; k++) {
-                        modulemapper.merges(module.id, module.merges[k]);
-                    }
-                }
-
-                // Finally, if runs is truthy we want to simply require() the module.
-                // This can be skipped if it had any merges or clobbers, though,
-                // since the mapper will already have required the module.
-                if (module.runs && !(module.clobbers && module.clobbers.length) && !(module.merges && module.merges.length)) {
-                    modulemapper.runs(module.id);
-                }
+        if (module.clobbers && module.clobbers.length) {
+            for (var j = 0; j < module.clobbers.length; j++) {
+                modulemapper.clobbers(module.id, module.clobbers[j]);
             }
-            catch(err) {
-                // error with module, most likely clobbers, should we continue?
+        }
+
+        if (module.merges && module.merges.length) {
+            for (var k = 0; k < module.merges.length; k++) {
+                modulemapper.merges(module.id, module.merges[k]);
             }
         }
+
+        // Finally, if runs is truthy we want to simply require() the module.
+        if (module.runs) {
+            modulemapper.runs(module.id);
+        }
     }
 
     finishPluginLoading();
@@ -1505,26 +1648,10 @@ function handlePluginsObject(path, moduleList, finishPluginLoading) {
     }
 
     for (var i = 0; i < moduleList.length; i++) {
-        injectScript(path + moduleList[i].file, scriptLoadedCallback);
+        injectIfNecessary(moduleList[i].id, path + moduleList[i].file, scriptLoadedCallback);
     }
 }
 
-function injectPluginScript(pathPrefix, finishPluginLoading) {
-    var pluginPath = pathPrefix + 'cordova_plugins.js';
-
-    injectScript(pluginPath, function() {
-        try {
-            var moduleList = require("cordova/plugin_list");
-            handlePluginsObject(pathPrefix, moduleList, finishPluginLoading);
-        }
-        catch (e) {
-            // Error loading cordova_plugins.js, file not found or something
-            // this is an acceptable error, pre-3.0.0, so we just move on.
-            finishPluginLoading();
-        }
-    }, finishPluginLoading); // also, add script load error handler for file not found
-}
-
 function findCordovaPath() {
     var path = null;
     var scripts = document.getElementsByTagName('script');
@@ -1548,7 +1675,10 @@ exports.load = function(callback) {
         console.log('Could not find cordova.js script tag. Plugin loading may fail.');
         pathPrefix = '';
     }
-    injectPluginScript(pathPrefix, callback);
+    injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function() {
+        var moduleList = require("cordova/plugin_list");
+        handlePluginsObject(pathPrefix, moduleList, callback);
+    }, callback);
 };
 
 


[08/11] git commit: CB-6491 add CONTRIBUTING.md

Posted by na...@apache.org.
CB-6491 add CONTRIBUTING.md


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

Branch: refs/heads/master
Commit: f48457e20cec481a9758dc6b79e87e0457bd781b
Parents: 18c6752
Author: Marcel Kinard <cm...@gmail.com>
Authored: Wed Apr 30 08:44:21 2014 -0400
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:47 2014 -0700

----------------------------------------------------------------------
 CONTRIBUTING.md | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/f48457e2/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..1594d12
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,16 @@
+# Contributing to Apache Cordova
+
+Anyone can contribute to Cordova. And we need your contributions.
+
+There are multiple ways to contribute: report bugs, improve the docs, and
+contribute code.
+
+For instructions on this, start with the 
+[contribution overview](http://cordova.apache.org/#contribute).
+
+The details are explained there, but the important items are:
+ - Sign and submit an Apache ICLA (Contributor License Agreement).
+ - Have a Jira issue open that corresponds to your contribution.
+ - Run the tests so your patch doesn't break existing functionality.
+
+We look forward to your contributions!


[04/11] git commit: Fixes 2 issues while adding amazon-fireos platform after fresh cordova install. 1. create.js updated to create "libs" folder before copying it to the project's platform folder. 2. check_reqs.js updated to report error and abort if awv

Posted by na...@apache.org.
Fixes 2 issues while adding amazon-fireos platform after fresh cordova install.
1. create.js updated to create "libs" folder before copying it to the project's platform folder.
2. check_reqs.js updated to report error and abort if awv_interface.jar is missing from libs folder.


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/09b340fd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/09b340fd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/09b340fd

Branch: refs/heads/master
Commit: 09b340fd9090f1ff08dfd2153e009ba9d37f6341
Parents: 037f775
Author: Archana Naik <na...@lab126.com>
Authored: Wed Apr 2 13:06:51 2014 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:46 2014 -0700

----------------------------------------------------------------------
 bin/lib/check_reqs.js | 7 ++++++-
 bin/lib/create.js     | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/09b340fd/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index b15a9b6..3525aa8 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -79,7 +79,12 @@ module.exports.check_android = function() {
     return d.promise.then(function(output) {
         if (!output.match(valid_target)) {
             return Q.reject(new Error('Please install Android target ' + valid_target.split('-')[1] + ' (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run \"android\" from your command-line to install/update any missing SDKs or tools.'));
-        } 
+        } else {
+            var awv_interface_expected_path=path.join(ROOT, 'framework','libs');
+            if (!fs.existsSync(path.join(awv_interface_expected_path,awv_interface))) {
+                return Q.reject(new Error('awv_interface.jar not found in ' + awv_interface_expected_path +' folder. \nPlease download the AmazonWebView SDK from http://developer.amazon.com/sdk/fire/IntegratingAWV.html#installawv and copy the awv_interface.jar file to this folder:' + awv_interface_expected_path + ' and re-run cordova platform add amazon-fireos command.'));
+                }
+        }
         return Q();
     }, function(stderr) {
         if (stderr.match(/command\snot\sfound/)) {

http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/09b340fd/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 1eacdfb..42911e7 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -69,6 +69,7 @@ function copyJsAndLibrary(projectPath, shared, projectName) {
     });
     if (!shared) {
         shell.mkdir('-p', nestedCordovaLibPath);
+        shell.mkdir('-p', path.join(ROOT, 'framework', 'libs'));
         shell.cp('-f', path.join(ROOT, 'framework', 'AndroidManifest.xml'), nestedCordovaLibPath);
         shell.cp('-f', path.join(ROOT, 'framework', 'project.properties'), nestedCordovaLibPath);
         shell.cp('-r', path.join(ROOT, 'framework', 'src'), nestedCordovaLibPath);


[11/11] git commit: CB-6543 Fix cordova/run failure when no custom_rules.xml available

Posted by na...@apache.org.
CB-6543 Fix cordova/run failure when no custom_rules.xml available

Github: Close #99


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/18c6752c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/18c6752c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/18c6752c

Branch: refs/heads/master
Commit: 18c6752c6fff86b8db4be638338c9e95bc98e267
Parents: b9d9a75
Author: Ningxin Hu <ni...@intel.com>
Authored: Thu Apr 24 16:05:42 2014 +0800
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:47 2014 -0700

----------------------------------------------------------------------
 bin/templates/cordova/lib/build.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/18c6752c/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index 7e0df2f..6336ecf 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -74,7 +74,12 @@ module.exports.run = function(build_type) {
  * the script will error out. (should we error or just return undefined?)
  */
 module.exports.get_apk = function() {
-    var binDir = path.join(ROOT, 'ant-build');
+    var binDir = '';
+    if(!hasCustomRules()) {
+        binDir = path.join(ROOT, 'bin');
+    } else {
+        binDir = path.join(ROOT, 'ant-build');
+    }
     if (fs.existsSync(binDir)) {
         var candidates = fs.readdirSync(binDir).filter(function(p) {
             // Need to choose between release and debug .apk.
@@ -87,13 +92,13 @@ module.exports.get_apk = function() {
                    a.t < b.t ? 1 : 0;
         });
         if (candidates.length === 0) {
-            console.error('ERROR : No .apk found in \'ant-build\' directory');
+            console.error('ERROR : No .apk found in ' + binDir + ' directory');
             process.exit(2);
         }
         console.log('Using apk: ' + candidates[0].p);
         return candidates[0].p;
     } else {
-        console.error('ERROR : unable to find project ant-build directory, could not locate .apk');
+        console.error('ERROR : unable to find project ' + binDir + ' directory, could not locate .apk');
         process.exit(2);
     }
 }


[07/11] git commit: Add JavaDoc for CordovaResourceApi

Posted by na...@apache.org.
Add JavaDoc for CordovaResourceApi


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

Branch: refs/heads/master
Commit: 7e98ec98ecd7362da2909bf8bae63a32e1a1666e
Parents: ca48cf5
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Apr 17 15:47:10 2014 -0400
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:47 2014 -0700

----------------------------------------------------------------------
 .../org/apache/cordova/CordovaResourceApi.java  | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/7e98ec98/framework/src/org/apache/cordova/CordovaResourceApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java b/framework/src/org/apache/cordova/CordovaResourceApi.java
index ca4c965..f1770fd 100644
--- a/framework/src/org/apache/cordova/CordovaResourceApi.java
+++ b/framework/src/org/apache/cordova/CordovaResourceApi.java
@@ -45,6 +45,27 @@ import java.net.URL;
 import java.nio.channels.FileChannel;
 import java.util.Locale;
 
+/**
+ * What this class provides:
+ * 1. Helpers for reading & writing to URLs.
+ *   - E.g. handles assets, resources, content providers, files, data URIs, http[s]
+ *   - E.g. Can be used to query for mime-type & content length.
+ *
+ * 2. To allow plugins to redirect URLs (via remapUrl).
+ *   - All plugins should call remapUrl() on URLs they receive from JS *before*
+ *     passing the URL onto other utility functions in this class.
+ *   - For an example usage of this, refer to the org.apache.cordova.file plugin.
+ *
+ * 3. It exposes a way to use the OkHttp library that ships with Cordova.
+ *   - Through createHttpConnection().
+ *
+ * Future Work:
+ *   - Consider using a Cursor to query content URLs for their size (like the file plugin does).
+ *   - Allow plugins to remapUri to "cdv-plugin://plugin-name/$ID", which CordovaResourceApi
+ *     would then delegate to pluginManager.getPlugin(plugin-name).openForRead($ID)
+ *     - Currently, plugins *can* do this by remapping to a data: URL, but it's inefficient
+ *       for large payloads.
+ */
 public class CordovaResourceApi {
     @SuppressWarnings("unused")
     private static final String LOG_TAG = "CordovaResourceApi";


[03/11] git commit: [CB-6392]Addig amazon-fireos platform fails with not so good error reporting Fixes 2 issues while adding amazon-fireos platform after fresh cordova install. 1. create.js updated to create "libs" folder before copying it to the project

Posted by na...@apache.org.
[CB-6392]Addig amazon-fireos platform fails with not so good error reporting
Fixes 2 issues while adding amazon-fireos platform after fresh cordova install.
1. create.js updated to create "libs" folder before copying it to the project's platform folder. Also, checking for awv_interface.jar existance is moved to create_project().
2. check_reqs.js no longer checks for awv_interface.jar.


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/280fc863
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/280fc863
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/280fc863

Branch: refs/heads/master
Commit: 280fc8633237a26398bb65bc848997d2e0212daf
Parents: 09b340f
Author: Archana Naik <na...@lab126.com>
Authored: Wed Apr 2 13:06:51 2014 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:46 2014 -0700

----------------------------------------------------------------------
 bin/lib/check_reqs.js | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/280fc863/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 3525aa8..b15a9b6 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -79,12 +79,7 @@ module.exports.check_android = function() {
     return d.promise.then(function(output) {
         if (!output.match(valid_target)) {
             return Q.reject(new Error('Please install Android target ' + valid_target.split('-')[1] + ' (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run \"android\" from your command-line to install/update any missing SDKs or tools.'));
-        } else {
-            var awv_interface_expected_path=path.join(ROOT, 'framework','libs');
-            if (!fs.existsSync(path.join(awv_interface_expected_path,awv_interface))) {
-                return Q.reject(new Error('awv_interface.jar not found in ' + awv_interface_expected_path +' folder. \nPlease download the AmazonWebView SDK from http://developer.amazon.com/sdk/fire/IntegratingAWV.html#installawv and copy the awv_interface.jar file to this folder:' + awv_interface_expected_path + ' and re-run cordova platform add amazon-fireos command.'));
-                }
-        }
+        } 
         return Q();
     }, function(stderr) {
         if (stderr.match(/command\snot\sfound/)) {


[06/11] git commit: [CB-6487]WebView not found in Chrome remote debugging

Posted by na...@apache.org.
[CB-6487]WebView not found in Chrome remote debugging

Enabling Chrome Devtools support for debug builds. It is disabled for release mode.


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

Branch: refs/heads/master
Commit: b3011d3b654b63c630e99dd801007059ad27342a
Parents: 5f2692f
Author: Archana Naik <na...@lab126.com>
Authored: Tue May 6 13:24:23 2014 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:47 2014 -0700

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaActivity.java | 26 +++++++++++++++++---
 1 file changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b3011d3b/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 6e8b04a..c9694b5 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -37,6 +37,9 @@ import android.app.ProgressDialog;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.res.Configuration;
 import android.graphics.Color;
 import android.media.AudioManager;
@@ -331,7 +334,8 @@ public class CordovaActivity extends Activity implements CordovaInterface {
         try {
             
             if (!sFactoryInit) {
-                // To override the default factory (Chromium-based or Android WebKit factory), uncomment one of the following lines:
+                // To override the default factory (Chromium-based or Android WebKit factory), uncomment one of the
+                // following lines:
                 // AmazonWebKitFactories.setDefaultFactory("com.amazon.android.webkit.embedded.EmbeddedWebKitFactory");
                 // AmazonWebKitFactories.setDefaultFactory("com.amazon.android.webkit.android.AndroidWebKitFactory");
                 // Select the default factory based on the preferred backend set on the Config class.
@@ -342,13 +346,27 @@ public class CordovaActivity extends Activity implements CordovaInterface {
                 }
                 aFactory.setNativeLibraryPackage(AMAZON_WEBVIEW_LIB_PACKAGE);
                 aFactory.initialize(this);
-                aFactory.disableDeveloperTools();
+                
+                // Determine whether we're in debug or release mode, and turn on developer tools !
+                // To use, run this on the command line (needs Android SDK), replace com.example.helloworld with your packageName(printed in log):
+                // adb forward tcp:9222 localabstract:com.example.helloworld.devtools
+                // Then, open this URL: http://localhost:9222 in your browser
+                final String packageName = this.getPackageName();
+                ApplicationInfo appInfo = this.getPackageManager().getApplicationInfo(packageName, PackageManager.GET_META_DATA);
+                
+                if (((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) &&
+                    (aFactory.getWebKitCapabilities().isDeveloperToolsSupported())) {
+                    aFactory.enableDeveloperToolsUnix(packageName + ".devtools");
+                    LOG.d(TAG,"DevTools available on localabstract:" + packageName + ".devtools");
+                } else {
+                    aFactory.disableDeveloperTools();
+                }
                 // factory configuration
                 aFactory.getCookieManager().setAcceptCookie(true);
                 sFactoryInit = true;
             } else {
                 aFactory = AmazonWebKitFactories.getDefaultFactory();
-            }        
+            }
 
         } catch (ExceptionInInitializerError e) {
             LOG.e(TAG, "WebKit factory initialization failed. Make sure you have android_interface.jar in libs folder.");
@@ -367,7 +385,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
      * Create and initialize web container with default web view objects.
      */
     public void init() {
-        if (factory != null && this.appView == null) {
+    	if (factory != null) {
     		CordovaWebView webView = makeWebView();
     		this.init(webView, makeWebViewClient(webView), makeChromeClient(webView));
     	}


[10/11] git commit: defaults.xml: Add AndroidLaunchMode preference

Posted by na...@apache.org.
defaults.xml: Add AndroidLaunchMode preference


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

Branch: refs/heads/master
Commit: b9d9a75fd966c24ff9125b921545abada5c6fb4f
Parents: 7e98ec9
Author: Fardjad Davari <pu...@fardjad.com>
Authored: Thu Apr 24 03:01:33 2014 +0430
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:47 2014 -0700

----------------------------------------------------------------------
 bin/templates/cordova/defaults.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b9d9a75f/bin/templates/cordova/defaults.xml
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/defaults.xml b/bin/templates/cordova/defaults.xml
index 1654c13..25a878b 100644
--- a/bin/templates/cordova/defaults.xml
+++ b/bin/templates/cordova/defaults.xml
@@ -23,6 +23,7 @@
 
     <!-- Preferences for Android -->
     <preference name="loglevel" value="DEBUG" />
+    <preference name="AndroidLaunchMode" value="singleTop" />
 
     <!-- This is required for native Android hooks -->
     <feature name="App">


[05/11] git commit: Added amazon xmlns to project's template AndroidManifest.xml.

Posted by na...@apache.org.
Added amazon xmlns to project's template AndroidManifest.xml.


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

Branch: refs/heads/master
Commit: b3c4d5824a810d74f1dcab9af036e13d67c96ab4
Parents: 280fc86
Author: Archana Naik <na...@lab126.com>
Authored: Thu May 1 11:37:30 2014 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:46 2014 -0700

----------------------------------------------------------------------
 bin/templates/project/AndroidManifest.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b3c4d582/bin/templates/project/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/AndroidManifest.xml b/bin/templates/project/AndroidManifest.xml
index e8a8583..7e7a532 100644
--- a/bin/templates/project/AndroidManifest.xml
+++ b/bin/templates/project/AndroidManifest.xml
@@ -17,7 +17,7 @@
        specific language governing permissions and limitations
        under the License.
 -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:amazon="http://schemas.amazon.com/apk/res/android" android:windowSoftInputMode="adjustPan"
       package="__PACKAGE__" android:versionName="1.0" android:versionCode="1" android:hardwareAccelerated="true">
     <supports-screens
         android:largeScreens="true"


[09/11] git commit: [CB-6636][amazon-fireos]Need to destroy webview properly Added destroy() call in webview's handleDestroy() method.

Posted by na...@apache.org.
[CB-6636][amazon-fireos]Need to destroy webview properly
Added destroy() call in webview's handleDestroy() method.


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

Branch: refs/heads/master
Commit: 5f2692f7c01c2bdbaabc85e5f3769bd3c61519aa
Parents: f48457e
Author: Archana Naik <na...@lab126.com>
Authored: Mon May 5 16:31:32 2014 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:47 2014 -0700

----------------------------------------------------------------------
 framework/src/org/apache/cordova/CordovaWebView.java | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/5f2692f7/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 aa80def..092e711 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -961,6 +961,8 @@ public class CordovaWebView extends AmazonWebView {
                 Log.e(TAG, "Error unregistering configuration receiver: " + e.getMessage(), e);
             }
         }
+        
+        this.destroy();
     }
     
     public void onNewIntent(Intent intent)


[02/11] git commit: Updated log statement - android=>amazon-fireos.

Posted by na...@apache.org.
Updated log statement - android=>amazon-fireos.


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/31bfe2dd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/31bfe2dd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/31bfe2dd

Branch: refs/heads/master
Commit: 31bfe2ddc10c04d646a2be7e677a2372b4800ac9
Parents: b3c4d58
Author: Archana Naik <na...@lab126.com>
Authored: Thu May 1 15:38:42 2014 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Tue May 6 13:58:46 2014 -0700

----------------------------------------------------------------------
 bin/create | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/31bfe2dd/bin/create
----------------------------------------------------------------------
diff --git a/bin/create b/bin/create
index 7b64d5f..0e2da85 100755
--- a/bin/create
+++ b/bin/create
@@ -24,7 +24,7 @@ var args  = require('./lib/simpleargs').getArgs(process.argv);
 
 if (args['--help'] || args._.length === 0) {
     console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name> [<template_path>] [--shared]');
-    console.log('    <path_to_new_project>: Path to your new Cordova Android project');
+    console.log('    <path_to_new_project>: Path to your new Cordova amazon-fireos project');
     console.log('    <package_name>: Package name, following reverse-domain style convention');
     console.log('    <project_name>: Project name');
     console.log('    <template_path>: Path to a custom application template to use');