working remove installed, using actual watch
This commit is contained in:
parent
b9a5570680
commit
01c96c8b72
@ -15,7 +15,7 @@ module.exports = {
|
|||||||
"Remove Xiaomi Apps",
|
"Remove Xiaomi Apps",
|
||||||
"Restore Xiaomi Apps",
|
"Restore Xiaomi Apps",
|
||||||
"Install Compatible Apps",
|
"Install Compatible Apps",
|
||||||
// "Remove Compatible Apps",
|
"Remove Installed Apps",
|
||||||
"Quit"
|
"Quit"
|
||||||
],
|
],
|
||||||
filter: function (val) {
|
filter: function (val) {
|
||||||
@ -57,6 +57,15 @@ module.exports = {
|
|||||||
}, ];
|
}, ];
|
||||||
return inquirer.prompt(questions);
|
return inquirer.prompt(questions);
|
||||||
},
|
},
|
||||||
|
installedApps: async (installedApps) => {
|
||||||
|
const questions = [{
|
||||||
|
type: "checkbox",
|
||||||
|
name: "removeAppsList",
|
||||||
|
message: "What Installed apps do you want to remove?",
|
||||||
|
choices: installedApps,
|
||||||
|
}, ];
|
||||||
|
return inquirer.prompt(questions);
|
||||||
|
},
|
||||||
getCompatibleApps: async () => {
|
getCompatibleApps: async () => {
|
||||||
var options = {
|
var options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "miwatchkleaner2.0",
|
"name": "miwatchkleaner2.0",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"description": "MiWatch Cleaning Tool",
|
"description": "MiWatch Cleaning Tool",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"bin": "app.js",
|
"bin": "app.js",
|
||||||
|
@ -15,41 +15,22 @@ let adbRun
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
removeCompatibleApps: async () => {
|
removeCompatibleApps: async () => {
|
||||||
common.header('Remove Compatible Apps')
|
let installedAppList
|
||||||
let compatibleApps
|
common.header('Remove Installed Apps')
|
||||||
let url = "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/compatibleApps.json";
|
await shellExec(adbRun + ' shell pm list packages -3').then(async function (result) {
|
||||||
http.get(url, (res) => {
|
installedAppList = result.stdout.split('\r\n'); // split string on comma space
|
||||||
let body = "";
|
installedAppList.splice(-1, 1)
|
||||||
|
|
||||||
res.on("data", (chunk) => {
|
|
||||||
body += chunk;
|
|
||||||
});
|
|
||||||
|
|
||||||
res.on("end", () => {
|
|
||||||
try {
|
|
||||||
compatibleApps = JSON.parse(body);
|
|
||||||
// do something with JSON
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error.message);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
}).on("error", (error) => {
|
|
||||||
console.error(error.message);
|
|
||||||
});
|
});
|
||||||
const value = await inquirer.compatibleApps();
|
const value = await inquirer.installedApps(installedAppList);
|
||||||
|
|
||||||
for (let element of value.removeAppsList) {
|
for (let element of value.removeAppsList) {
|
||||||
console.log('Installing ' + element)
|
console.log('Removing ' + element)
|
||||||
await shellExec(adbRun + ' install -r ' + element).then(async function (result) {
|
const package = element.substring(8)
|
||||||
|
await shellExec(adbRun + ' uninstall ' + package).then(async function (result) {
|
||||||
console.log(element + ' - ' + result.stdout);
|
console.log(element + ' - ' + result.stdout);
|
||||||
if (element === "data\\apps\\MoreLocale.apk") {
|
|
||||||
await shellExec(adbRun + ' shell pm grant jp.co.c_lis.ccl.morelocale android.permission.CHANGE_CONFIGURATION').then(function (result) {
|
|
||||||
console.log('moreLocale Activated On Watch');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log(chalk.green('Compatible Apps Installed'))
|
console.log(chalk.green('Removed Selected User Apps'))
|
||||||
await common.pause(2000)
|
await common.pause(2000)
|
||||||
module.exports.mainMenu()
|
module.exports.mainMenu()
|
||||||
},
|
},
|
||||||
@ -193,7 +174,7 @@ module.exports = {
|
|||||||
case 'install compatible apps':
|
case 'install compatible apps':
|
||||||
module.exports.compatibleApps()
|
module.exports.compatibleApps()
|
||||||
break;
|
break;
|
||||||
case 'remove compatible apps':
|
case 'remove installed apps':
|
||||||
module.exports.removeCompatibleApps()
|
module.exports.removeCompatibleApps()
|
||||||
break;
|
break;
|
||||||
case 'quit':
|
case 'quit':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user