activate moreLocale

This commit is contained in:
karl.hudgell 2020-04-27 12:20:12 +01:00
parent 4ce21de180
commit f531e0641f

View File

@ -59,20 +59,31 @@ module.exports = {
for (let element of apkList) { for (let element of apkList) {
console.log('Installing ' + element) console.log('Installing ' + element)
if (process.platform === 'win32' || process.platform === 'win64') { if (process.platform === 'win32' || process.platform === 'win64') {
await shellExec('adb install -r ' + element).then(function (result) { await shellExec('adb install -r ' + element).then(async function (result) {
console.log(element + ' - ' + result.stdout); console.log(element + ' - ' + result.stdout);
if (element === "data\\apps\\MoreLocale.apk") {
await shellExec('adb shell pm grant jp.co.c_lis.ccl.morelocale android.permission.CHANGE_CONFIGURATION').then(function (result) {
console.log('moreLocale Activated On Watch');
});
}
}); });
} else { } else {
await shellExec('./adb install -r ' + element).then(function (result) { await shellExec('./adb install -r ' + element).then(function (result) {
console.log(element + ' - ' + result.stdout); console.log(element + ' - ' + result.stdout);
if (element === "data\\apps\\MoreLocale.apk") {
await shellExec('./adb 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')) }
await common.pause(2000) console.log(chalk.green('Compatible Apps Installed'))
module.exports.mainMenu() await common.pause(2000)
}, module.exports.mainMenu()
removeApps: async () => { },
removeApps: async () => {
common.header('Remove Apps') common.header('Remove Apps')
const value = await inquirer.removeAppsList(); const value = await inquirer.removeAppsList();
for (let element of value.removeAppsList) { for (let element of value.removeAppsList) {
@ -91,114 +102,114 @@ module.exports = {
module.exports.mainMenu() module.exports.mainMenu()
}, },
restoreApps: async () => { restoreApps: async () => {
common.header('Restore Apps') common.header('Restore Apps')
const value = await inquirer.removeAppsList(); const value = await inquirer.removeAppsList();
for (let element of value.removeAppsList) { for (let element of value.removeAppsList) {
if (process.platform === 'win32' || process.platform === 'win64') { if (process.platform === 'win32' || process.platform === 'win64') {
await shellExec('adb shell cmd package install-existing ' + element).then(function (result) { await shellExec('adb shell cmd package install-existing ' + element).then(function (result) {
console.log('Restoring ' + element + ' - ' + result.stdout); console.log('Restoring ' + element + ' - ' + result.stdout);
}); });
} else { } else {
await shellExec('./adb shell cmd package install-existing ' + element).then(function (result) { await shellExec('./adb shell cmd package install-existing ' + element).then(function (result) {
console.log('Restoring ' + element + ' - ' + result.stdout); console.log('Restoring ' + element + ' - ' + result.stdout);
}); });
}
} }
} console.log(chalk.green('Restore Complete'))
console.log(chalk.green('Restore Complete')) await common.pause(2000)
await common.pause(2000) module.exports.mainMenu()
module.exports.mainMenu() },
}, connectWifi: async () => {
connectWifi: async () => { const miwatchData = JSON.parse(fs.readFileSync('./data/MiWatch.json', 'utf8'));
const miwatchData = JSON.parse(fs.readFileSync('./data/MiWatch.json', 'utf8')); common.header('Connect Wifi')
common.header('Connect Wifi') if (miwatchData.ipAddress !== "") {
if (miwatchData.ipAddress !== "") { console.log('Trying to connect with stored ipAddress')
console.log('Trying to connect with stored ipAddress') if (process.platform === 'win32' || process.platform === 'win64') {
if (process.platform === 'win32' || process.platform === 'win64') { shellExec('adb connect ' + miwatchData.ipAddress).then(async function (result) {
shellExec('adb connect ' + miwatchData.ipAddress).then(async function (result) { if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) { console.log(chalk.green('MiWatch Connected'))
console.log(chalk.green('MiWatch Connected')) await common.pause(3000)
await common.pause(3000) module.exports.mainMenu()
module.exports.mainMenu() } else {
console.log(chalk.red('MiWatch not found'))
await common.pause(2000)
console.log(chalk.white('Try Again'))
await common.pause(1000)
module.exports.connectWifi()
}
}).catch()
} else { } else {
console.log(chalk.red('MiWatch not found')) shellExec('./adb connect ' + miwatchData.ipAddress).then(async function (result) {
await common.pause(2000) if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
console.log(chalk.white('Try Again')) console.log(chalk.green('MiWatch Connected'))
await common.pause(1000) files.writeIpAddress(miWatchIpaddress)
module.exports.connectWifi() await common.pause(3000)
module.exports.mainMenu()
} else {
console.log(chalk.red('MiWatch not found'))
await common.pause(2000)
console.log(chalk.white('Try Again'))
await common.pause(1000)
module.exports.connectWifi()
}
}).catch()
} }
}).catch() } else {
} else { const value = await inquirer.connectWifi();
shellExec('./adb connect ' + miwatchData.ipAddress).then(async function (result) { const miWatchIpaddress = value.connectWifi
if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) { if (process.platform === 'win32' || process.platform === 'win64') {
console.log(chalk.green('MiWatch Connected')) shellExec('adb connect ' + miWatchIpaddress).then(async function (result) {
files.writeIpAddress(miWatchIpaddress) if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
await common.pause(3000) console.log(chalk.green('MiWatch Connected'))
module.exports.mainMenu() files.writeIpAddress(miWatchIpaddress)
await common.pause(3000)
module.exports.mainMenu()
} else {
console.log(chalk.red('MiWatch not found'))
await common.pause(2000)
console.log(chalk.white('Try Again'))
await common.pause(1000)
module.exports.connectWifi()
}
}).catch()
} else { } else {
console.log(chalk.red('MiWatch not found')) shellExec('./adb connect ' + miWatchIpaddress).then(async function (result) {
await common.pause(2000) if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
console.log(chalk.white('Try Again')) console.log(chalk.green('MiWatch Connected'))
await common.pause(1000) files.writeIpAddress(miWatchIpaddress)
module.exports.connectWifi() await common.pause(3000)
module.exports.mainMenu()
} else {
console.log(chalk.red('MiWatch not found'))
await common.pause(2000)
console.log(chalk.white('Try Again'))
await common.pause(1000)
module.exports.connectWifi()
}
}).catch()
} }
}).catch() }
},
mainMenu: async () => {
common.header('Main Menu')
const mainMenuSelection = await inquirer.mainMenu();
switch (mainMenuSelection.mainMenu) {
case 'connect to miwatch via wifi':
module.exports.connectWifi()
break;
case 'remove xiaomi apps':
module.exports.removeApps()
break;
case 'restore xiaomi apps':
module.exports.restoreApps()
break;
case 'install compatible apps':
module.exports.compatibleApps()
break;
case 'quit':
break;
default:
// code block
}
} }
} else {
const value = await inquirer.connectWifi();
const miWatchIpaddress = value.connectWifi
if (process.platform === 'win32' || process.platform === 'win64') {
shellExec('adb connect ' + miWatchIpaddress).then(async function (result) {
if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
console.log(chalk.green('MiWatch Connected'))
files.writeIpAddress(miWatchIpaddress)
await common.pause(3000)
module.exports.mainMenu()
} else {
console.log(chalk.red('MiWatch not found'))
await common.pause(2000)
console.log(chalk.white('Try Again'))
await common.pause(1000)
module.exports.connectWifi()
}
}).catch()
} else {
shellExec('./adb connect ' + miWatchIpaddress).then(async function (result) {
if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
console.log(chalk.green('MiWatch Connected'))
files.writeIpAddress(miWatchIpaddress)
await common.pause(3000)
module.exports.mainMenu()
} else {
console.log(chalk.red('MiWatch not found'))
await common.pause(2000)
console.log(chalk.white('Try Again'))
await common.pause(1000)
module.exports.connectWifi()
}
}).catch()
}
}
},
mainMenu: async () => {
common.header('Main Menu')
const mainMenuSelection = await inquirer.mainMenu();
switch (mainMenuSelection.mainMenu) {
case 'connect to miwatch via wifi':
module.exports.connectWifi()
break;
case 'remove xiaomi apps':
module.exports.removeApps()
break;
case 'restore xiaomi apps':
module.exports.restoreApps()
break;
case 'install compatible apps':
module.exports.compatibleApps()
break;
case 'quit':
break;
default:
// code block
}
}
}; };