dpa99c / cordova-custom-config

Cordova/Phonegap plugin to update platform configuration files based on preferences and config-file data defined in config.xml
318 stars 84 forks source link

Question: is this plugin needed for UISupportedInterfaceOrientations? #166

Closed l3ender closed 4 years ago

l3ender commented 4 years ago

I'm having trouble determining if this plugin is needed for configuring UISupportedInterfaceOrientations and UISupportedInterfaceOrientations~ipad and am wondering if someone could provide guidance.

It seems like the customization for orientations should be supported with edit-config or config-file options in config.xml file, but I haven't had any luck. Additionally, we have a custom Cordova plugin where I've tried the same and I am not seeing my customizations reflected in the final plist file.

-> cordova -v
9.0.0 (cordova-lib@9.0.1)

I've tried the following in both config.xml and our custom plugin's plugin.xml:

<config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations">
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</config-file>
<config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations~ipad">
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</config-file>

and

<edit-config file="*-Info.plist" mode="overwrite" target="UISupportedInterfaceOrientations">
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</edit-config>
<edit-config file="*-Info.plist" mode="overwrite" target="UISupportedInterfaceOrientations~ipad">
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</edit-config>

So I wanted to see if this plugin is required for the above configuration, or if can be successfully accomplished with core/base Cordova configuration.

Many thanks!

dpa99c commented 4 years ago

You should be able to use <config-file> blocks to specify custom orientation settings and Cordova will pick up and apply those. Be sure not to specify <preference name="Orientation" /> in yourconfig.xmlas this will take precedence. If you encounter issues, you can use this plugin to apply a` block.

l3ender commented 4 years ago

Did some more research, and editing array plist entries (like UISupportedInterfaceOrientations) is not currently supported by Cordova. See https://github.com/apache/cordova-ios/issues/613.