Skip to content

Commit

Permalink
fix(cli): Avoid duplicate usesCleartextTraffic attribute (#3245)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jul 13, 2020
1 parent 3c64162 commit 861874f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cli/src/cordova.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,13 @@ export async function writeCordovaAndroidManifest(cordovaPlugins: Plugin[], conf
}
});
});
let cleartext = config.app.extConfig.server?.cleartext ? 'android:usesCleartextTraffic="true"' : '';
let cleartextString = 'android:usesCleartextTraffic="true"';
let cleartext = config.app.extConfig.server?.cleartext && !applicationXMLAttributes.includes(cleartextString) ? cleartextString : '';
let content = `<?xml version='1.0' encoding='utf-8'?>
<manifest package="capacitor.android.plugins"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:amazon="http://schemas.amazon.com/apk/res/android">
<application ${applicationXMLAttributes.join('\n')}${cleartext}>
<application ${applicationXMLAttributes.join('\n')} ${cleartext}>
${applicationXMLEntries.join('\n')}
</application>
${rootXMLEntries.join('\n')}
Expand Down

0 comments on commit 861874f

Please sign in to comment.