You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mm...@apache.org on 2014/05/29 20:49:42 UTC

git commit: CB-6772 Provide a default for AndroidLaunchMode

Repository: cordova-lib
Updated Branches:
  refs/heads/master 5b1941757 -> 9dc05de9c


CB-6772 Provide a default for AndroidLaunchMode


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

Branch: refs/heads/master
Commit: 9dc05de9c2861fe7d295b2d8c2da3cc515b489f3
Parents: 5b19417
Author: Michal Mocny <mm...@gmail.com>
Authored: Thu May 29 14:42:24 2014 -0400
Committer: Michal Mocny <mm...@gmail.com>
Committed: Thu May 29 14:49:32 2014 -0400

----------------------------------------------------------------------
 .../src/cordova/metadata/android_parser.js       | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/9dc05de9/cordova-lib/src/cordova/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/metadata/android_parser.js b/cordova-lib/src/cordova/metadata/android_parser.js
index 2a5e51e..8a0020b 100644
--- a/cordova-lib/src/cordova/metadata/android_parser.js
+++ b/cordova-lib/src/cordova/metadata/android_parser.js
@@ -60,14 +60,21 @@ module.exports.prototype = {
     },
 
     findAndroidLaunchModePreference: function(config) {
-        var ret = config.getPreference('AndroidLaunchMode');
-        var valid = ['standard', 'singleTop', 'singleTask', 'singleInstance'].indexOf(ret) !== -1;
-        if (ret && !valid) {
-            events.emit('warn', 'Unknown value for launchMode preference: ' + ret);
-            ret = null;
+        var launchMode = config.getPreference('AndroidLaunchMode');
+        if (!launchMode) {
+            // Return a default value
+            return 'singleTop';
         }
 
-        return ret;
+        var expectedValues = ['standard', 'singleTop', 'singleTask', 'singleInstance'];
+        var valid = expectedValues.indexOf(launchMode) !== -1;
+        if (!valid) {
+            events.emit('warn', 'Unrecognized value for AndroidLaunchMode preference: ' + launchMode);
+            events.emit('warn', '  Expected values are: ' + expectedValues.join(', '));
+            // Note: warn, but leave the launch mode as developer wanted, in case the list of options changes in the future
+        }
+
+        return launchMode;
     },
 
     update_from_config:function(config) {