You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by fardjad <gi...@git.apache.org> on 2014/04/13 16:27:48 UTC

[GitHub] cordova-cli pull request: android-parser: Add launchMode preferenc...

GitHub user fardjad opened a pull request:

    https://github.com/apache/cordova-cli/pull/164

    android-parser: Add launchMode preference

    This allows users to set Android Activity launchMode from config.xml
    
    Related:
    https://groups.google.com/forum/#!topic/phonegap/8E5C6phqQA4
    https://groups.google.com/forum/#!topic/phonegap/R08vOZNm580

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/fardjad/cordova-cli android-launch-mode-support

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-cli/pull/164.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #164
    
----
commit 4082a956fed18f033b71a0d88c4ca10e7659166f
Author: Fardjad Davari <pu...@fardjad.com>
Date:   2014-04-13T14:09:37Z

    android-parser: Add launchMode preference
    
    This allows users to set Android Activity launchMode from config.xml

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41327034
  
    Shall I merge as is, or do you want to fix the ConfigParser?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41180908
  
    Thanks for the patch. I've created an issue for this:
    
    https://issues.apache.org/jira/browse/CB-6501


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11924705
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    +                case 'standard':
    +                    act.attrib["android:launchMode"] = 'standard';
    +                    break;
    +                case 'singleTop':
    +                    act.attrib["android:launchMode"] = 'singleTop';
    +                    break;
    +                case 'singleTask':
    +                    act.attrib["android:launchMode"] = 'singleTask';
    +                    break;
    +                case 'singleInstance':
    +                    act.attrib["android:launchMode"] = 'singleInstance';
    +                    break;
    +                case 'default':
    +                    delete act.attrib["android:launchMode"];
    --- End diff --
    
    As of this change: https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;h=298cd9e  there is a new default value for android projects for launchMode (singleTop).
    
    If we make this change, we are reverting to a default launchMode of standard, which I do not think is a great default for cordova apps.  We can solve the problem by changing the parser, or by setting the default launchMode in defaults.xml.  I'm happy with the second option!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41321647
  
    The casing is actually insensitive, but the other preferences don't have dashes, i.e. "WebViewBounce"


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41327152
  
    I'll fix that in a moment...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11925780
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    +                case 'standard':
    +                    act.attrib["android:launchMode"] = 'standard';
    +                    break;
    +                case 'singleTop':
    +                    act.attrib["android:launchMode"] = 'singleTop';
    +                    break;
    +                case 'singleTask':
    +                    act.attrib["android:launchMode"] = 'singleTask';
    +                    break;
    +                case 'singleInstance':
    +                    act.attrib["android:launchMode"] = 'singleInstance';
    +                    break;
    +                case 'default':
    +                    delete act.attrib["android:launchMode"];
    --- End diff --
    
    OK, so I'll change that **switch** statement to **if** and amend this commit. Then I'll add the default `launch-mode` preference to **default.xml** and submit a pull request to **cordova-android** repository.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11911288
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    +                case 'standard':
    +                    act.attrib["android:launchMode"] = 'standard';
    +                    break;
    +                case 'singleTop':
    +                    act.attrib["android:launchMode"] = 'singleTop';
    +                    break;
    +                case 'singleTask':
    +                    act.attrib["android:launchMode"] = 'singleTask';
    +                    break;
    +                case 'singleInstance':
    +                    act.attrib["android:launchMode"] = 'singleInstance';
    +                    break;
    +                case 'default':
    --- End diff --
    
    default isn't a valid mode (according to findLaunchModePreference)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41326953
  
    Thats simply an implicit API description that calls to `getPreference` must pass in lowercase names ;)  (Okay, so its probably just a bug).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad closed the pull request at:

    https://github.com/apache/cordova-cli/pull/164


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41321384
  
    Sure! But shouldn't we use small letters for the preference name (like `android-launch-mode`)?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41318383
  
    @mmocny Hello, I have amended the commit and submitted a pull request to **cordova-android** repository.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11924941
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    +                case 'standard':
    +                    act.attrib["android:launchMode"] = 'standard';
    +                    break;
    +                case 'singleTop':
    +                    act.attrib["android:launchMode"] = 'singleTop';
    +                    break;
    +                case 'singleTask':
    +                    act.attrib["android:launchMode"] = 'singleTask';
    +                    break;
    +                case 'singleInstance':
    +                    act.attrib["android:launchMode"] = 'singleInstance';
    +                    break;
    +                case 'default':
    +                    delete act.attrib["android:launchMode"];
    --- End diff --
    
    And I think I should also change the default case to set the `android:launchMode` value to `singleTop`. Right?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41319318
  
    Looks great.  Will need to remember to update android's defaults.xml.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11924083
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    --- End diff --
    
    I agree, I could use an **if** statement. Will fix that in my next commit after we discuss the [**default** case](https://github.com/apache/cordova-cli/pull/164#r11923593) a little bit more.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41320392
  
    I just added `<preference name="launch-mode" value="singleTop" />` to [defaults.xml](https://github.com/fardjad/cordova-android/commit/1b6298e6ec80c2810b336b21d4759f02a384f691). Is that how it's supposed to be? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41326597
  
    @mmocny I updated the commit.
    By the way the preference name matching in [**ConfigParser.js**](https://github.com/apache/cordova-cli/blob/master/src/ConfigParser.js#L93) is not (completely) case insensitive:
    
        if (preference.attrib.name.toLowerCase() === name)
    
    Is there any particular reason for that?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41320706
  
    Awesome.  One last tiny request: may we change the name of the preference to "AndroidLaunchMode"?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11911266
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    +                case 'standard':
    +                    act.attrib["android:launchMode"] = 'standard';
    +                    break;
    +                case 'singleTop':
    +                    act.attrib["android:launchMode"] = 'singleTop';
    +                    break;
    +                case 'singleTask':
    +                    act.attrib["android:launchMode"] = 'singleTask';
    +                    break;
    +                case 'singleInstance':
    +                    act.attrib["android:launchMode"] = 'singleInstance';
    +                    break;
    +                case 'default':
    +                    delete act.attrib["android:launchMode"];
    --- End diff --
    
    This would delete the default from our application template, right?  I think we would like to set a sensible default (thats the bug we fixed in the first place).
    
    However, an alternative way would be to leave this patch as-is and instead update defaults.xml to include a default preference for this.  Thoughts?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41322753
  
    I remember I saw an attribute in docs (probably older versions) that used dashes, anyways I'll change the preference name to `AndroidLaunchMode`.
    About the docs: Yes please :D



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41327534
  
    Done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11925400
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    +                case 'standard':
    +                    act.attrib["android:launchMode"] = 'standard';
    +                    break;
    +                case 'singleTop':
    +                    act.attrib["android:launchMode"] = 'singleTop';
    +                    break;
    +                case 'singleTask':
    +                    act.attrib["android:launchMode"] = 'singleTask';
    +                    break;
    +                case 'singleInstance':
    +                    act.attrib["android:launchMode"] = 'singleInstance';
    +                    break;
    +                case 'default':
    +                    delete act.attrib["android:launchMode"];
    --- End diff --
    
    I think the way it is is fine: if you explicitly set an invalid value for the preference in your application config, you get the default *android* application launchMode.  If you don't set any preference, you get the default *cordova* application launchMode.  That makes sense to me!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41321690
  
    Ah, I forgot, we will also need to update the docs (I can look at that if you prefer not to).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on the pull request:

    https://github.com/apache/cordova-cli/pull/164#issuecomment-41329099
  
    Thanks! Pulled in (will take a few minutes for this PR to auto-close as apache mirrors repo).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11923593
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    +                case 'standard':
    +                    act.attrib["android:launchMode"] = 'standard';
    +                    break;
    +                case 'singleTop':
    +                    act.attrib["android:launchMode"] = 'singleTop';
    +                    break;
    +                case 'singleTask':
    +                    act.attrib["android:launchMode"] = 'singleTask';
    +                    break;
    +                case 'singleInstance':
    +                    act.attrib["android:launchMode"] = 'singleInstance';
    +                    break;
    +                case 'default':
    +                    delete act.attrib["android:launchMode"];
    --- End diff --
    
    No, there's no `android:launchMode` default preference defined in application template. According to [<Activity> documentation] **launchMode** defaults to standard if not specified. What this default case does is that it removes previously set `android:launchMode` attribute when user specifies an invalid value for `launch-mode` in **config.xml**. It is essentially the same as setting it's value to **standard**.
    
    That case shouldn't happen when `launch-mode` is not specified or is one of the allowed values.
    
    The code is similar to `findOrientationPreference` which was already there. I just wanted to use the same coding style.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by fardjad <gi...@git.apache.org>.
Github user fardjad commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11923890
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    +                case 'standard':
    +                    act.attrib["android:launchMode"] = 'standard';
    +                    break;
    +                case 'singleTop':
    +                    act.attrib["android:launchMode"] = 'singleTop';
    +                    break;
    +                case 'singleTask':
    +                    act.attrib["android:launchMode"] = 'singleTask';
    +                    break;
    +                case 'singleInstance':
    +                    act.attrib["android:launchMode"] = 'singleInstance';
    +                    break;
    +                case 'default':
    --- End diff --
    
    That's right. As I said in my previous comment, I just wanted to make the code look like `findOrientationPreference()`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...

Posted by mmocny <gi...@git.apache.org>.
Github user mmocny commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11911345
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    --- End diff --
    
    Why this switch statement?  Couldn't you just `if (launchModePref) act.attrib["android:launchMode"] = launchModePref;` ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---