You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Manuel Rauber (JIRA)" <ji...@apache.org> on 2017/01/22 21:52:26 UTC

[jira] [Created] (CB-12381) Cordova's prepare command does not work reliable when it comes to restoring the platforms & plugins via config.xml

Manuel Rauber created CB-12381:
----------------------------------

             Summary: Cordova's prepare command does not work reliable when it comes to restoring the platforms & plugins via config.xml
                 Key: CB-12381
                 URL: https://issues.apache.org/jira/browse/CB-12381
             Project: Apache Cordova
          Issue Type: Bug
          Components: CLI, iOS
    Affects Versions: 6.4.0
         Environment: macOS Sierra 10.12.2, current versions of cordova and cordova-ios
            Reporter: Manuel Rauber


Howdy,

I just figured out, that the cordova prepare command does not work reliably when it restores everything from the config.xml. 

*Steps to reproduce*

1. Install cordova via {{npm install cordova}} into an empty folder
2. Run {{./node_modules/.bin/cordova create sampleProject}} to create a new cordova project
3. Open the folder {{sampleProject}}
4. Run {{$(npm bin)/cordova platform add ios --save}} to add ios
5. Run {{$(npm bin)//cordova plugin add cordova-plugin-statusbar --save}} to add the status bar plugin
6. Open the {{config.xml}} and add this before the last closing tag: {{<preference name="StatusBarOverlaysWebView" value="false"/>}}
7. Remove the folders {{platform}} and {{plugins}}. Now you have a project, which you normally check in into your source control system, since cordova is able to restore everything from config.xml
8. Run {{$(npm bin)//cordova prepare}} to restore 
9. Open {{platforms/ios/HelloCordova.xcodeproj}} in XCode
10. Start it (simulator is ok)
11. Notice, that the status bar *does* overlay the WebView
12. Run {{$(npm bin)//cordova prepare}} again
13. Start the project in XCode again
14. Notice, that the status bar *does not* overlay the WebView

*What happened?*

In step 8 the file {{platforms/ios/HelloCordova/config.xml}} was created by cordova looking like that:

{code:xml}
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <feature name="LocalStorage">
        <param name="ios-package" value="CDVLocalStorage" />
    </feature>
    <feature name="HandleOpenUrl">
        <param name="ios-package" value="CDVHandleOpenURL" />
        <param name="onload" value="true" />
    </feature>
    <feature name="IntentAndNavigationFilter">
        <param name="ios-package" value="CDVIntentAndNavigationFilter" />
        <param name="onload" value="true" />
    </feature>
    <feature name="GestureHandler">
        <param name="ios-package" value="CDVGestureHandler" />
        <param name="onload" value="true" />
    </feature>
    <name>HelloCordova</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
    <preference name="AllowInlineMediaPlayback" value="false" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="DisallowOverscroll" value="false" />
    <preference name="EnableViewportScale" value="false" />
    <preference name="KeyboardDisplayRequiresUserAction" value="true" />
    <preference name="MediaPlaybackRequiresUserAction" value="false" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="SuppressesLongPressGesture" value="false" />
    <preference name="Suppresses3DTouchGesture" value="false" />
    <preference name="GapBetweenPages" value="0" />
    <preference name="PageLength" value="0" />
    <preference name="PaginationBreakingMode" value="page" />
    <preference name="PaginationMode" value="unpaginated" />
    <preference name="StatusBarOverlaysWebView" value="false" />
    <preference name="StatusBarStyle" value="lightcontent" />
    <feature name="StatusBar">
        <param name="ios-package" value="CDVStatusBar" />
        <param name="onload" value="true" />
    </feature>
</widget>
{code}

But, if you run the prepare command another time (which we did in step 12) the file looks like this:

{code:xml}
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <feature name="LocalStorage">
        <param name="ios-package" value="CDVLocalStorage" />
    </feature>
    <feature name="HandleOpenUrl">
        <param name="ios-package" value="CDVHandleOpenURL" />
        <param name="onload" value="true" />
    </feature>
    <feature name="IntentAndNavigationFilter">
        <param name="ios-package" value="CDVIntentAndNavigationFilter" />
        <param name="onload" value="true" />
    </feature>
    <feature name="GestureHandler">
        <param name="ios-package" value="CDVGestureHandler" />
        <param name="onload" value="true" />
    </feature>
    <feature name="StatusBar">
        <param name="ios-package" value="CDVStatusBar" />
        <param name="onload" value="true" />
    </feature>
    <name>HelloCordova</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
    <preference name="AllowInlineMediaPlayback" value="false" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="DisallowOverscroll" value="false" />
    <preference name="EnableViewportScale" value="false" />
    <preference name="KeyboardDisplayRequiresUserAction" value="true" />
    <preference name="MediaPlaybackRequiresUserAction" value="false" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="SuppressesLongPressGesture" value="false" />
    <preference name="Suppresses3DTouchGesture" value="false" />
    <preference name="GapBetweenPages" value="0" />
    <preference name="PageLength" value="0" />
    <preference name="PaginationBreakingMode" value="page" />
    <preference name="PaginationMode" value="unpaginated" />
    <preference name="StatusBarOverlaysWebView" value="false" />
    <preference name="StatusBarStyle" value="lightcontent" />
</widget>
{code}

Please note, that the entry {{<feature name="StatusBar">}} has been *moved* to the top, where all other features are defined. That's the only change happening when running the prepare command a second time. And it's the change needed, to make it actually work.

I'm not quite sure, if this is a CLI problem or a config loading problem, since that's XML and no matter where you define it, it should work.

Since that's the only change, you can actually cut&paste the feature entry between its two places to see that it's not working when defined at the end of the file.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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