cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject js commit: android: Use correct plugin name for navigator.app exec() calls
Date Sun, 18 Jan 2015 02:21:40 GMT
Repository: cordova-js
Updated Branches:
  refs/heads/master a6245af9b -> 9c9610f2f


android: Use correct plugin name for navigator.app exec() calls


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

Branch: refs/heads/master
Commit: 9c9610f2f115c266585ad34fd453e138b371f2af
Parents: a6245af
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Sat Jan 17 21:21:07 2015 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Sat Jan 17 21:21:07 2015 -0500

----------------------------------------------------------------------
 src/android/plugin/android/app.js | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/9c9610f2/src/android/plugin/android/app.js
----------------------------------------------------------------------
diff --git a/src/android/plugin/android/app.js b/src/android/plugin/android/app.js
index 7fccc40..22cf96e 100644
--- a/src/android/plugin/android/app.js
+++ b/src/android/plugin/android/app.js
@@ -20,13 +20,14 @@
 */
 
 var exec = require('cordova/exec');
+var APP_PLUGIN_NAME = Number(require('cordova').platformVersion.split('.')[0]) >= 4 ?
'CoreAndroid' : 'App';
 
 module.exports = {
     /**
     * Clear the resource cache.
     */
     clearCache:function() {
-        exec(null, null, "App", "clearCache", []);
+        exec(null, null, APP_PLUGIN_NAME, "clearCache", []);
     },
 
     /**
@@ -44,14 +45,14 @@ module.exports = {
     *      navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading
App", loadUrlTimeoutValue: 60000});
     */
     loadUrl:function(url, props) {
-        exec(null, null, "App", "loadUrl", [url, props]);
+        exec(null, null, APP_PLUGIN_NAME, "loadUrl", [url, props]);
     },
 
     /**
     * Cancel loadUrl that is waiting to be loaded.
     */
     cancelLoadUrl:function() {
-        exec(null, null, "App", "cancelLoadUrl", []);
+        exec(null, null, APP_PLUGIN_NAME, "cancelLoadUrl", []);
     },
 
     /**
@@ -59,7 +60,7 @@ module.exports = {
     * Instead of BACK button loading the previous web page, it will exit the app.
     */
     clearHistory:function() {
-        exec(null, null, "App", "clearHistory", []);
+        exec(null, null, APP_PLUGIN_NAME, "clearHistory", []);
     },
 
     /**
@@ -67,7 +68,7 @@ module.exports = {
     * This is the same as pressing the backbutton on Android device.
     */
     backHistory:function() {
-        exec(null, null, "App", "backHistory", []);
+        exec(null, null, APP_PLUGIN_NAME, "backHistory", []);
     },
 
     /**
@@ -80,7 +81,7 @@ module.exports = {
     * @param override        T=override, F=cancel override
     */
     overrideBackbutton:function(override) {
-        exec(null, null, "App", "overrideBackbutton", [override]);
+        exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [override]);
     },
 
     /**
@@ -95,13 +96,13 @@ module.exports = {
     * @param override        T=override, F=cancel override
     */
     overrideButton:function(button, override) {
-        exec(null, null, "App", "overrideButton", [button, override]);
+        exec(null, null, APP_PLUGIN_NAME, "overrideButton", [button, override]);
     },
 
     /**
     * Exit and terminate the application.
     */
     exitApp:function() {
-        return exec(null, null, "App", "exitApp", []);
+        return exec(null, null, APP_PLUGIN_NAME, "exitApp", []);
     }
 };


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


Mime
View raw message