cordova-custom-config icon indicating copy to clipboard operation
cordova-custom-config copied to clipboard

Cannot insert new Item to the section on AndroidManifest

Open WuglyakBolgoink opened this issue 2 years ago • 0 comments

Bug report

Current behavior:

  • create new project
  • add cordova-android@latest platform
  • add cordova-plugin-camera@latest plugin
  • add cordova-custom-config@latest plugin
  • update config.xml
<custom-config-file parent="./queries" target="AndroidManifest.xml">
            <intent>
                <action android:name="android.support.customtabs.action.CustomTabsService" />
            </intent>
</custom-config-file>
  • do cordova prepare
  • check manifest file - ok
  • do cordova prepare again
  • check manifest file - not OK, manifest contain multiple sections queries

example

AndroidManifest
<queries>
        <intent>
            <action android:name="android.support.customtabs.action.CustomTabsService" />
        </intent>
        <intent>
            <action android:name="android.intent.action.GET_CONTENT" />
        </intent>
        <intent>
            <action android:name="android.intent.action.PICK" />
        </intent>
        <intent>
            <action android:name="com.android.camera.action.CROP" />
            <data android:mimeType="image/*" android:scheme="content" />
        </intent>
    </queries>
    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
        <intent>
            <action android:name="android.intent.action.GET_CONTENT" />
        </intent>
        <intent>
            <action android:name="android.intent.action.PICK" />
        </intent>
        <intent>
            <action android:name="com.android.camera.action.CROP" />
            <data android:mimeType="image/*" android:scheme="content" />
        </intent>
    </queries>


Expected behavior: plugin should replace the value in the section

Environment information

  • Cordova CLI version
    • cordova -v - 10.0.0
  • Cordova platform version
    • cordova platform ls
  • Plugins & versions installed in project (including this plugin)
    • cordova plugin ls
  • Dev machine OS and version, e.g.
    • OSX
      • 12.0.1 (21A559)

Android build issue:

  • Node JS version
    • node -v - v14.18.1

Related code:

insert any relevant code here such as plugin API calls / input parameters

Console output

with `mode="add"` plugin duplicate original section and add the item into other section every time on `cordova prepare`
<queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
        <intent>
            <action android:name="android.intent.action.GET_CONTENT" />
        </intent>
        <intent>
            <action android:name="android.intent.action.PICK" />
        </intent>
        <intent>
            <action android:name="com.android.camera.action.CROP" />
            <data android:mimeType="image/*" android:scheme="content" />
        </intent>
        <intent>
            <action android:name="android.support.customtabs.action.CustomTabsService" />
        </intent>
        <intent>
            <action android:name="android.support.customtabs.action.CustomTabsService" />
        </intent>
        <intent>
            <action android:name="android.support.customtabs.action.CustomTabsService" />
        </intent>
        <intent>
            <action android:name="android.support.customtabs.action.CustomTabsService" />
        </intent>
    </queries>
    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
        <intent>
            <action android:name="android.intent.action.GET_CONTENT" />
        </intent>
        <intent>
            <action android:name="android.intent.action.PICK" />
        </intent>
        <intent>
            <action android:name="com.android.camera.action.CROP" />
            <data android:mimeType="image/*" android:scheme="content" />
        </intent>
    </queries>


WuglyakBolgoink avatar Dec 06 '21 13:12 WuglyakBolgoink