code cleanup
This commit is contained in:
parent
198183d008
commit
4ce21de180
797
package-lock.json
generated
797
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@
|
|||||||
"node_modules/figlet/fonts/Standard.flf"
|
"node_modules/figlet/fonts/Standard.flf"
|
||||||
],
|
],
|
||||||
"targets": [
|
"targets": [
|
||||||
"node12-linux-x86",
|
"node12-linux-x64",
|
||||||
"node12-macos-x64",
|
"node12-macos-x64",
|
||||||
"node12-win-x86"
|
"node12-win-x86"
|
||||||
]
|
]
|
||||||
|
111
pages/pages.js
111
pages/pages.js
@ -115,60 +115,31 @@ module.exports = {
|
|||||||
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('unable to connect')) {
|
if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
files.writeIpAddress('')
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else if (result.stdout.includes('cannot connect')) {
|
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
files.writeIpAddress('')
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else if (result.stdout.includes('cannot resolve host')) {
|
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
files.writeIpAddress('')
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else {
|
|
||||||
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()
|
}).catch()
|
||||||
} else {
|
} else {
|
||||||
shellExec('./adb connect ' + miwatchData.ipAddress).then(async function (result) {
|
shellExec('./adb connect ' + miwatchData.ipAddress).then(async function (result) {
|
||||||
if (result.stdout.includes('unable to connect')) {
|
if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
files.writeIpAddress('')
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else if (result.stdout.includes('cannot connect')) {
|
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
files.writeIpAddress('')
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else if (result.stdout.includes('cannot resolve host')) {
|
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
files.writeIpAddress('')
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else {
|
|
||||||
console.log(chalk.green('MiWatch Connected'))
|
console.log(chalk.green('MiWatch Connected'))
|
||||||
|
files.writeIpAddress(miWatchIpaddress)
|
||||||
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()
|
}).catch()
|
||||||
}
|
}
|
||||||
@ -177,56 +148,32 @@ module.exports = {
|
|||||||
const miWatchIpaddress = value.connectWifi
|
const miWatchIpaddress = value.connectWifi
|
||||||
if (process.platform === 'win32' || process.platform === 'win64') {
|
if (process.platform === 'win32' || process.platform === 'win64') {
|
||||||
shellExec('adb connect ' + miWatchIpaddress).then(async function (result) {
|
shellExec('adb connect ' + miWatchIpaddress).then(async function (result) {
|
||||||
if (result.stdout.includes('unable to connect')) {
|
if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else if (result.stdout.includes('cannot connect')) {
|
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else if (result.stdout.includes('cannot resolve host')) {
|
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else {
|
|
||||||
console.log(chalk.green('MiWatch Connected'))
|
console.log(chalk.green('MiWatch Connected'))
|
||||||
files.writeIpAddress(miWatchIpaddress)
|
files.writeIpAddress(miWatchIpaddress)
|
||||||
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()
|
}).catch()
|
||||||
} else {
|
} else {
|
||||||
shellExec('./adb connect ' + miWatchIpaddress).then(async function (result) {
|
shellExec('./adb connect ' + miWatchIpaddress).then(async function (result) {
|
||||||
if (result.stdout.includes('unable to connect')) {
|
if (result.stdout.includes('already connected') || result.stdout.includes('connected to ')) {
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else if (result.stdout.includes('cannot connect')) {
|
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else if (result.stdout.includes('cannot resolve host')) {
|
|
||||||
console.log(chalk.red('MiWatch not found'))
|
|
||||||
await common.pause(2000)
|
|
||||||
console.log(chalk.white('Try Again'))
|
|
||||||
await common.pause(1000)
|
|
||||||
module.exports.connectWifi()
|
|
||||||
} else {
|
|
||||||
console.log(chalk.green('MiWatch Connected'))
|
console.log(chalk.green('MiWatch Connected'))
|
||||||
files.writeIpAddress(miWatchIpaddress)
|
files.writeIpAddress(miWatchIpaddress)
|
||||||
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()
|
}).catch()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user