Skip to content

Commit

Permalink
chore(app-vite/app-webpack): simplify cleartext call for Cordova
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Sep 19, 2024
1 parent 8aed7b0 commit b3ce52c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
8 changes: 3 additions & 5 deletions app-vite/lib/modes/cordova/android-cleartext.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import fs from 'node:fs'
* To be used for Capacitor v1 & v2 only
*/

export function fixAndroidCleartext (appPaths, mode, action) {
const androidManifestPath = appPaths.resolve[ mode ](
mode === 'cordova'
? 'platforms/android/app/src/main/AndroidManifest.xml'
: 'android/app/src/main/AndroidManifest.xml'
export function fixAndroidCleartext (appPaths, action) {
const androidManifestPath = appPaths.resolve.cordova(
'platforms/android/app/src/main/AndroidManifest.xml'
)

if (fs.existsSync(androidManifestPath) === false) return
Expand Down
2 changes: 1 addition & 1 deletion app-vite/lib/modes/cordova/cordova-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class QuasarModeBuilder extends AppBuilder {
const { appPaths } = this.ctx

if (target === 'android') {
fixAndroidCleartext(appPaths, 'cordova', 'remove')
fixAndroidCleartext(appPaths, 'remove')
}

const cordovaContext = {
Expand Down
2 changes: 1 addition & 1 deletion app-vite/lib/modes/cordova/cordova-devserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class QuasarModeDevserver extends AppDevserver {
this.#target = this.ctx.targetName

if (this.#target === 'android') {
fixAndroidCleartext(this.ctx.appPaths, 'cordova', 'add')
fixAndroidCleartext(this.ctx.appPaths, 'add')
}

onShutdown(() => {
Expand Down
8 changes: 3 additions & 5 deletions app-webpack/lib/modes/cordova/android-cleartext.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
const fs = require('node:fs')

module.exports.fixAndroidCleartext = function fixAndroidCleartext (appPaths, mode, action) {
const androidManifestPath = appPaths.resolve[ mode ](
mode === 'cordova'
? 'platforms/android/app/src/main/AndroidManifest.xml'
: 'android/app/src/main/AndroidManifest.xml'
module.exports.fixAndroidCleartext = function fixAndroidCleartext (appPaths, action) {
const androidManifestPath = appPaths.resolve.cordova(
'platforms/android/app/src/main/AndroidManifest.xml'
)

if (fs.existsSync(androidManifestPath) === false) return
Expand Down
2 changes: 1 addition & 1 deletion app-webpack/lib/modes/cordova/cordova-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports.QuasarModeBuilder = class QuasarModeBuilder extends AppBuilder {
const { appPaths } = this.ctx

if (target === 'android') {
fixAndroidCleartext(appPaths, 'cordova', 'remove')
fixAndroidCleartext(appPaths, 'remove')
}

const cordovaContext = {
Expand Down
2 changes: 1 addition & 1 deletion app-webpack/lib/modes/cordova/cordova-devserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports.QuasarModeDevserver = class QuasarModeDevserver extends AppDevser
this.#target = this.ctx.targetName

if (this.#target === 'android') {
fixAndroidCleartext(this.ctx.appPaths, 'cordova', 'add')
fixAndroidCleartext(this.ctx.appPaths, 'add')
}

onShutdown(() => {
Expand Down

0 comments on commit b3ce52c

Please sign in to comment.