Skip to content

Commit

Permalink
fix(app-webpack): Capacitor & Android -> usesCleartextTraffic attribu…
Browse files Browse the repository at this point in the history
…te is always true in the AndroidManifest.xml file #17219
  • Loading branch information
rstoenescu committed Sep 19, 2024
1 parent ef7be7d commit f4c425f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 7 additions & 3 deletions app-webpack/lib/capacitor/capacitor-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CapacitorConfig {
this.tamperedFiles.push({
path: capJsonPath,
name: 'capacitor.config.json',
content: this.#updateCapJson(quasarConf, capJson),
content: this.#updateCapJson(quasarConf, capJson, target),
originalContent: JSON.stringify(capJson, null, 2)
})

Expand All @@ -101,7 +101,7 @@ class CapacitorConfig {
})
}

#updateCapJson (quasarConf, originalCapCfg) {
#updateCapJson (quasarConf, originalCapCfg, target) {
const capJson = { ...originalCapCfg }

capJson.appName = quasarConf.capacitor.appName || this.pkg.productName || 'Quasar App'
Expand All @@ -113,13 +113,17 @@ class CapacitorConfig {
if (quasarConf.ctx.dev) {
capJson.server = capJson.server || {}
capJson.server.url = quasarConf.build.APP_URL
if (target === 'android' && capVersion >= 2) {
capJson.server.cleartext = true
}
}
else {
capJson.webDir = 'www'

// ensure we don't run from a remote server
if (capJson.server && capJson.server.url) {
if (capJson.server) {
delete capJson.server.url
delete capJson.server.cleartext
}
}

Expand Down
4 changes: 0 additions & 4 deletions app-webpack/lib/capacitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class CapacitorRunner {
init (ctx) {
this.ctx = ctx
this.target = ctx.targetName

if (this.target === 'android') {
require('../helpers/fix-android-cleartext')('capacitor')
}
}

async run (quasarConfFile) {
Expand Down

0 comments on commit f4c425f

Please sign in to comment.