cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manuel Rauber (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CB-12381) Cordova's prepare command does not work reliably when it comes to restoring the platforms & plugins via config.xml
Date Sun, 22 Jan 2017 22:07:26 GMT

     [ https://issues.apache.org/jira/browse/CB-12381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Manuel Rauber updated CB-12381:
-------------------------------
    Description: 
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*

# Install cordova via {{npm install cordova}} into an empty folder
# Run {{$(npm bin)/cordova create sampleProject}} to create a new cordova project
# Open the folder {{sampleProject}}
# Run {{$(npm bin)/cordova platform add ios --save}} to add ios
# Run {{$(npm bin)/cordova plugin add cordova-plugin-statusbar --save}} to add the status
bar plugin
# Open the {{config.xml}} and add this before the last closing tag: {{<preference name="StatusBarOverlaysWebView"
value="false"/>}}
# 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
# Run {{$(npm bin)/cordova prepare}} to restore 
# Open {{platforms/ios/HelloCordova.xcodeproj}} in XCode
# Start it (simulator is ok)
# Notice, that the status bar *does* overlay the WebView
# Run {{$(npm bin)/cordova prepare}} again
# Start the project in XCode again
# 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" />
    <feature name="StatusBar">
        <param name="ios-package" value="CDVStatusBar" />
        <param name="onload" value="true" />
    </feature>
    <preference name="StatusBarOverlaysWebView" value="true" />
    <preference name="StatusBarStyle" value="lightcontent" />
</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 two things: The first is, that {{<feature name="StatusBar">}} has been moved
to the top in the second file. *But* in the first file (so after the first time {{prepare}})
the setting {{StatusBarOverlaysWebView}} has been defined twice. The first time with value
{{false}} what we actually want and the second time with value {{true}}, which we don't want,
but is the default of the plugin. For sure, this second setting overwrites the value we want
to have.
The second {{prepare}} command then *removes* the setting with the value {{true}}, so the
config.xml has that setting only once with the value we want. 

  was:
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*

# Install cordova via {{npm install cordova}} into an empty folder
# Run {{$(npm bin)/cordova create sampleProject}} to create a new cordova project
# Open the folder {{sampleProject}}
# Run {{$(npm bin)/cordova platform add ios --save}} to add ios
# Run {{$(npm bin)/cordova plugin add cordova-plugin-statusbar --save}} to add the status
bar plugin
# Open the {{config.xml}} and add this before the last closing tag: {{<preference name="StatusBarOverlaysWebView"
value="false"/>}}
# 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
# Run {{$(npm bin)/cordova prepare}} to restore 
# Open {{platforms/ios/HelloCordova.xcodeproj}} in XCode
# Start it (simulator is ok)
# Notice, that the status bar *does* overlay the WebView
# Run {{$(npm bin)//cordova prepare}} again
# Start the project in XCode again
# 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" />
    <feature name="StatusBar">
        <param name="ios-package" value="CDVStatusBar" />
        <param name="onload" value="true" />
    </feature>
    <preference name="StatusBarOverlaysWebView" value="true" />
    <preference name="StatusBarStyle" value="lightcontent" />
</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 two things: The first is, that {{<feature name="StatusBar">}} has been moved
to the top in the second file. *But* in the first file (so after the first time {{prepare}})
the setting {{StatusBarOverlaysWebView}} has been defined twice. The first time with value
{{false}} what we actually want and the second time with value {{true}}, which we don't want,
but is the default of the plugin. For sure, this second setting overwrites the value we want
to have.
The second {{prepare}} command then *removes* the setting with the value {{true}}, so the
config.xml has that setting only once with the value we want. 


> Cordova's prepare command does not work reliably 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
>         Attachments: Result of Step 10.png, Result of Step 13.png
>
>
> 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*
> # Install cordova via {{npm install cordova}} into an empty folder
> # Run {{$(npm bin)/cordova create sampleProject}} to create a new cordova project
> # Open the folder {{sampleProject}}
> # Run {{$(npm bin)/cordova platform add ios --save}} to add ios
> # Run {{$(npm bin)/cordova plugin add cordova-plugin-statusbar --save}} to add the status
bar plugin
> # Open the {{config.xml}} and add this before the last closing tag: {{<preference
name="StatusBarOverlaysWebView" value="false"/>}}
> # 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
> # Run {{$(npm bin)/cordova prepare}} to restore 
> # Open {{platforms/ios/HelloCordova.xcodeproj}} in XCode
> # Start it (simulator is ok)
> # Notice, that the status bar *does* overlay the WebView
> # Run {{$(npm bin)/cordova prepare}} again
> # Start the project in XCode again
> # 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" />
>     <feature name="StatusBar">
>         <param name="ios-package" value="CDVStatusBar" />
>         <param name="onload" value="true" />
>     </feature>
>     <preference name="StatusBarOverlaysWebView" value="true" />
>     <preference name="StatusBarStyle" value="lightcontent" />
> </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 two things: The first is, that {{<feature name="StatusBar">}} has been
moved to the top in the second file. *But* in the first file (so after the first time {{prepare}})
the setting {{StatusBarOverlaysWebView}} has been defined twice. The first time with value
{{false}} what we actually want and the second time with value {{true}}, which we don't want,
but is the default of the plugin. For sure, this second setting overwrites the value we want
to have.
> The second {{prepare}} command then *removes* the setting with the value {{true}}, so
the config.xml has that setting only once with the value we want. 



--
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


Mime
View raw message