combative code for connections

This commit is contained in:
karl.hudgell 2020-04-29 09:09:01 +01:00
parent a131a1ddfd
commit 74fa89e795
2 changed files with 31 additions and 20 deletions

View File

@ -1,6 +1,6 @@
{
"name": "miwatchkleaner2.0",
"version": "2.0.2",
"version": "2.0.3",
"description": "MiWatch Cleaning Tool",
"main": "app.js",
"bin": "app.js",
@ -18,8 +18,6 @@
"chalk": "^4.0.0",
"clear": "^0.1.0",
"clui": "^0.3.6",
"download-file": "^0.1.5",
"download-file-with-progressbar": "^1.2.3",
"figlet": "^1.3.0",
"get-files-in": "^1.2.0",
"inquirer": "^7.1.0",
@ -27,13 +25,13 @@
"pkg": "^4.4.7",
"request-promise-native": "^1.0.8",
"shell-exec": "^1.0.2",
"shelljs": "^0.8.4",
"zip": "^1.2.0"
"shelljs": "^0.8.4"
},
"pkg": {
"scripts": [],
"assets": [
"node_modules/figlet/fonts/Standard.flf"
"node_modules/figlet/fonts/Standard.flf",
"data/packageList.json"
],
"targets": [
"node12-linux-x64",

View File

@ -18,13 +18,22 @@ module.exports = {
let installedAppList
common.header('Remove Installed Apps')
await shellExec(adbRun + ' shell pm list packages -3').then(async function (result) {
if (result.stderr.includes('error')) {
console.log(chalk.red('Device not authorised'))
common.pause(3000)
await shellExec(adbRun + ' kill-server').then(async function (result) {
console.log('Please reconnect to watch')
common.pause(3000)
module.exports.mainMenu()
})
} else {
if (process.platform === 'win32' || process.platform === 'win64') {
installedAppList = result.stdout.split('\r\n'); // split string on comma space
installedAppList.splice(-1, 1)
} else {
installedAppList = result.stdout.split('\n'); // split string on comma space
}
installedAppList.splice(-1, 1)
});
}
const value = await inquirer.installedApps(installedAppList);
for (let element of value.removeAppsList) {
@ -34,9 +43,12 @@ module.exports = {
console.log(element + ' - ' + result.stdout);
});
}
// });
console.log(chalk.green('Removed Selected User Apps'))
await common.pause(2000)
module.exports.mainMenu()
}
})
},
compatibleApps: async () => {
common.header('Install Compatible Apps')
@ -133,6 +145,7 @@ module.exports = {
} else {
console.log(chalk.red('MiWatch not found'))
await common.pause(2000)
files.writeIpAddress('')
console.log(chalk.white('Try Again'))
await common.pause(1000)
module.exports.connectWifi()