working install/uninstall

This commit is contained in:
karl.hudgell 2020-04-25 11:06:05 +01:00
parent 3bb1959855
commit d1b5adb8aa
2 changed files with 18 additions and 3 deletions

View File

@ -27,7 +27,7 @@ module.exports = {
const questions = [ {
type: 'checkbox',
name: 'Remove Apps List',
name: 'removeAppsList',
message: 'What apps do you want to remove?',
choices: packages.apps
}]

View File

@ -4,12 +4,24 @@ const inquirer = require('../lib/inquirer');
const shellExec = require('shell-exec')
const files = require('../lib/files')
module.exports = {
removeApps: async () => {
common.header('Remove Apps')
const value = await inquirer.removeAppsList();
console.log(value)
value.removeAppsList.forEach(element => {
shellExec('adb shell pm uninstall -k --user 0 ' + element).then(async function (result) {
console.log('Removing ' + element + ' - ' + result.stdout)
}).catch()
});
},
restoreApps: async () => {
common.header('Restore Apps')
const value = await inquirer.removeAppsList();
value.removeAppsList.forEach(element => {
shellExec('adb shell cmd package install-existing ' + element).then(async function (result) {
console.log('Installing ' + element + ' - ' + result.stdout)
}).catch()
});
},
connectWifi: async () => {
common.header('Connect Wifi')
@ -46,6 +58,9 @@ module.exports = {
case 'remove install xiaomi apps':
module.exports.removeApps()
break;
case 'restore uninstalled apps':
module.exports.restoreApps()
break;
default:
// code block
}