cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [25/26] js commit: CB-8210 Use the correct plugin for App/CoreAndroid plugin based on platformVersion
Date Wed, 07 Jan 2015 01:27:24 GMT
CB-8210 Use the correct plugin for App/CoreAndroid plugin based on platformVersion


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

Branch: refs/heads/3.7.x
Commit: 76f8a5c0bfbb8effd2b90b17d735f87ed363bd7b
Parents: 3b066a6
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Mon Jan 5 22:07:57 2015 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Mon Jan 5 22:07:57 2015 -0500

----------------------------------------------------------------------
 src/android/platform.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/76f8a5c0/src/android/platform.js
----------------------------------------------------------------------
diff --git a/src/android/platform.js b/src/android/platform.js
index 10324a9..947cfb4 100644
--- a/src/android/platform.js
+++ b/src/android/platform.js
@@ -1,4 +1,4 @@
-/
+/*
  *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -33,12 +33,14 @@ module.exports = {
         // TODO: Extract this as a proper plugin.
         modulemapper.clobbers('cordova/plugin/android/app', 'navigator.app');
 
+        var APP_PLUGIN_NAME = Number(cordova.platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid'
: 'App';
+
         // Inject a listener for the backbutton on the document.
         var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
         backButtonChannel.onHasSubscribersChange = function() {
             // If we just attached the first handler or detached the last handler,
             // let native know we need to override the back button.
-            exec(null, null, "App", "overrideBackbutton", [this.numHandlers == 1]);
+            exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [this.numHandlers ==
1]);
         };
 
         // Add hardware MENU and SEARCH button handlers
@@ -49,7 +51,7 @@ module.exports = {
             // 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]);
+                exec(null, null, APP_PLUGIN_NAME, "overrideButton", [buttonName, this.numHandlers
== 1]);
             };
         }
         // Inject a listener for the volume buttons on the document.
@@ -59,8 +61,8 @@ module.exports = {
         // Let native code know we are all done on the JS side.
         // Native code will then un-hide the WebView.
         channel.onCordovaReady.subscribe(function() {
-            exec(onMessageFromNative, null, 'App', 'messageChannel', []);
-            exec(null, null, "App", "show", []);
+            exec(onMessageFromNative, null, APP_PLUGIN_NAME, 'messageChannel', []);
+            exec(null, null, APP_PLUGIN_NAME, "show", []);
         });
     }
 };


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


Mime
View raw message