Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 262FF177AB for ; Wed, 28 Jan 2015 14:58:58 +0000 (UTC) Received: (qmail 26058 invoked by uid 500); 28 Jan 2015 14:58:56 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 25977 invoked by uid 500); 28 Jan 2015 14:58:56 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 24961 invoked by uid 99); 28 Jan 2015 14:58:55 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Jan 2015 14:58:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 60F6DE0F0D; Wed, 28 Jan 2015 14:58:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agrieve@apache.org To: commits@cordova.apache.org Date: Wed, 28 Jan 2015 14:59:27 -0000 Message-Id: <64dc9d7df6ac44ef9ecc4a5a579ddebe@git.apache.org> In-Reply-To: <59ed5c2c3de641fd9b5294e70076860f@git.apache.org> References: <59ed5c2c3de641fd9b5294e70076860f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [36/50] [abbrv] android commit: CB-8210 Update JS snapshot with 4.0.x-specific platformVersion to fix CoreAndroid vs App plugin name CB-8210 Update JS snapshot with 4.0.x-specific platformVersion to fix CoreAndroid vs App plugin name Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/df4fbc27 Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/df4fbc27 Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/df4fbc27 Branch: refs/heads/master Commit: df4fbc272a1d585ba7a1385ec9e7532b8458530c Parents: 9698a99 Author: Andrew Grieve Authored: Mon Jan 5 22:09:12 2015 -0500 Committer: Andrew Grieve Committed: Mon Jan 5 22:09:12 2015 -0500 ---------------------------------------------------------------------- framework/assets/www/cordova.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-android/blob/df4fbc27/framework/assets/www/cordova.js ---------------------------------------------------------------------- diff --git a/framework/assets/www/cordova.js b/framework/assets/www/cordova.js index 4c90865..9d9f78e 100644 --- a/framework/assets/www/cordova.js +++ b/framework/assets/www/cordova.js @@ -1,5 +1,5 @@ // Platform: android -// 07125ef9d481fab81c2c29eafec253846f05a8ca +// 3b066a6856fd4d01806a332f2ab57eb7d340fe35 /* 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.7.0-dev'; +var PLATFORM_VERSION_BUILD_LABEL = '4.0.x'; // file: src/scripts/require.js /*jshint -W079 */ @@ -1517,12 +1517,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 @@ -1533,7 +1535,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. @@ -1543,8 +1545,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", []); }); } }; @@ -1568,11 +1570,7 @@ function onMessageFromNative(msg) { // Volume events case 'volumedownbutton': case 'volumeupbutton': - try { - cordova.fireDocumentEvent(action); - } catch(e) { - console.log('exception firing ' + action + ' event from native:' + e); - } + cordova.fireDocumentEvent(action); break; default: throw new Error('Unknown event action ' + action); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org