-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ajit Kumar
authored and
Ajit Kumar
committed
Mar 2, 2024
1 parent
0146df2
commit d944181
Showing
66 changed files
with
1,431 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"plugins":["cordova-plugin-buildinfo","cordova-plugin-device","cordova-plugin-file","cordova-plugin-ftp","cordova-plugin-iap","cordova-plugin-server","cordova-plugin-sftp","cordova-clipboard","cordova-plugin-vibration","cordova-plugin-system","cordova-plugin-browser","cordova-plugin-sdcard"]} | ||
{"plugins":["cordova-plugin-buildinfo","cordova-plugin-device","cordova-plugin-file","cordova-plugin-browser","cordova-plugin-ftp","cordova-plugin-iap","cordova-plugin-sdcard","cordova-plugin-server","cordova-plugin-sftp","cordova-clipboard","cordova-plugin-vibration","cordova-plugin-system"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
ext.cdvCompileSdkVersion = 31 | ||
|
||
configurations { | ||
all { | ||
exclude module: 'commons-logging' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,118 @@ | ||
/* eslint-disable no-console */ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
const resPath = path.resolve( | ||
const buildFilePath = path.resolve(__dirname, '../build.json'); | ||
const copyToPath = path.resolve(__dirname, '../platforms/android/build.json'); | ||
const gradleFilePath = path.resolve(__dirname, '../build-extras.gradle'); | ||
const androidGradleFilePath = path.resolve( | ||
__dirname, | ||
'../platforms/android/app/src/main/res/' | ||
'../platforms/android/app/build-extras.gradle' | ||
); | ||
const resPath = path.resolve(__dirname, '../platforms/android/app/src/main/res/'); | ||
const localResPath = path.resolve(__dirname, '../res/android/'); | ||
|
||
const splashScreens = [ | ||
'mipmap-ldpi', | ||
'mipmap-hdpi-v26', | ||
'mipmap-ldpi-v26', | ||
'mipmap-mdpi-v26', | ||
'mipmap-xhdpi-v26', | ||
'mipmap-xxhdpi-v26', | ||
'mipmap-xxxhdpi-v26', | ||
'drawable-land-hdpi', | ||
'drawable-land-ldpi', | ||
'drawable-land-mdpi', | ||
'drawable-land-xhdpi', | ||
'drawable-land-xxhdpi', | ||
'drawable-land-xxxhdpi', | ||
'drawable-port-hdpi', | ||
'drawable-port-ldpi', | ||
'drawable-port-mdpi', | ||
'drawable-port-xhdpi', | ||
'drawable-port-xxhdpi', | ||
'drawable-port-xxxhdpi', | ||
]; | ||
|
||
for (let splashScreen of splashScreens) { | ||
const file = path.join(resPath, splashScreen); | ||
if (fs.existsSync(file)) { | ||
fs.rmSync(file, { | ||
recursive: true, | ||
if ( | ||
!fs.existsSync(copyToPath) | ||
&& fs.existsSync(buildFilePath) | ||
) fs.copyFileSync(buildFilePath, copyToPath); | ||
|
||
if (fs.existsSync(androidGradleFilePath)) fs.unlinkSync(androidGradleFilePath); | ||
fs.copyFileSync(gradleFilePath, androidGradleFilePath); | ||
|
||
deleteDirRecursively(resPath, [ | ||
path.join('values', 'strings.xml'), | ||
path.join('values', 'colors.xml'), | ||
path.join('values', 'styles.xml'), | ||
'anim', | ||
'xml', | ||
]); | ||
copyDirRecursively(localResPath, resPath); | ||
|
||
/** | ||
* Copy directory recursively | ||
* @param {string} src Source directory | ||
* @param {string} dest Destination directory | ||
* @param {string[]} skip Files to not copy | ||
*/ | ||
function copyDirRecursively(src, dest, skip = [], currPath = '') { | ||
const exists = fs.existsSync(src); | ||
const stats = exists && fs.statSync(src); | ||
const isDirectory = exists && stats.isDirectory(); | ||
|
||
if (!exists) { | ||
console.log(`File ${src} does not exist`); | ||
return; | ||
} | ||
|
||
if (!fs.existsSync(dest) && isDirectory) { | ||
fs.mkdirSync(dest); | ||
} | ||
|
||
if (exists && isDirectory) { | ||
fs.mkdirSync(dest, { recursive: true }); | ||
fs.readdirSync(src).forEach((childItemName) => { | ||
const relativePath = path.join(currPath, childItemName); | ||
if (childItemName.startsWith('.')) return; | ||
if (skip.includes(childItemName) || skip.includes(relativePath)) return; | ||
copyDirRecursively( | ||
path.join(src, childItemName), | ||
path.join(dest, childItemName), | ||
skip, | ||
childItemName, | ||
); | ||
}); | ||
} else { | ||
fs.copyFileSync(src, dest); | ||
|
||
// log | ||
const message = `copied: ${path.basename(src)}`; | ||
console.log('\x1b[32m%s\x1b[0m', message); // green | ||
} | ||
} | ||
|
||
/** | ||
* Delete directory recursively | ||
* @param {string} dir Directory to delete | ||
* @param {string[]} except Files to not delete | ||
*/ | ||
function deleteDirRecursively(dir, except = [], currPath = '') { | ||
const exists = fs.existsSync(dir); | ||
const stats = exists && fs.statSync(dir); | ||
const isDirectory = exists && stats.isDirectory(); | ||
|
||
if (!exists) { | ||
console.log(`File ${dir} does not exist`); | ||
return; | ||
} | ||
|
||
if (exists && isDirectory) { | ||
let deleteDir = true; | ||
fs.readdirSync(dir).forEach((childItemName) => { | ||
const relativePath = path.join(currPath, childItemName); | ||
if ( | ||
childItemName.startsWith('.') | ||
|| except.includes(childItemName) | ||
|| except.includes(relativePath) | ||
) { | ||
console.log('\x1b[33m%s\x1b[0m', `skipped: ${relativePath}`); // yellow | ||
deleteDir = false; | ||
return; | ||
} | ||
|
||
deleteDirRecursively( | ||
path.join(dir, childItemName), | ||
except, | ||
childItemName, | ||
); | ||
}); | ||
console.log('Removed: ', splashScreen); | ||
|
||
if (deleteDir) { | ||
console.log('\x1b[31m%s\x1b[0m', `deleted: ${currPath || path.basename(dir)}`); // red | ||
fs.rmSync(dir, { recursive: true }); | ||
} | ||
} else { | ||
console.log('\x1b[31m%s\x1b[0m', `deleted: ${currPath || path.basename(dir)}`); // red | ||
fs.rmSync(dir); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.