combative code for connections
This commit is contained in:
		
							parent
							
								
									a131a1ddfd
								
							
						
					
					
						commit
						74fa89e795
					
				
							
								
								
									
										10
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								package.json
									
									
									
									
									
								
							@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "miwatchkleaner2.0",
 | 
					  "name": "miwatchkleaner2.0",
 | 
				
			||||||
  "version": "2.0.2",
 | 
					  "version": "2.0.3",
 | 
				
			||||||
  "description": "MiWatch Cleaning Tool",
 | 
					  "description": "MiWatch Cleaning Tool",
 | 
				
			||||||
  "main": "app.js",
 | 
					  "main": "app.js",
 | 
				
			||||||
  "bin": "app.js",
 | 
					  "bin": "app.js",
 | 
				
			||||||
@ -18,8 +18,6 @@
 | 
				
			|||||||
    "chalk": "^4.0.0",
 | 
					    "chalk": "^4.0.0",
 | 
				
			||||||
    "clear": "^0.1.0",
 | 
					    "clear": "^0.1.0",
 | 
				
			||||||
    "clui": "^0.3.6",
 | 
					    "clui": "^0.3.6",
 | 
				
			||||||
    "download-file": "^0.1.5",
 | 
					 | 
				
			||||||
    "download-file-with-progressbar": "^1.2.3",
 | 
					 | 
				
			||||||
    "figlet": "^1.3.0",
 | 
					    "figlet": "^1.3.0",
 | 
				
			||||||
    "get-files-in": "^1.2.0",
 | 
					    "get-files-in": "^1.2.0",
 | 
				
			||||||
    "inquirer": "^7.1.0",
 | 
					    "inquirer": "^7.1.0",
 | 
				
			||||||
@ -27,13 +25,13 @@
 | 
				
			|||||||
    "pkg": "^4.4.7",
 | 
					    "pkg": "^4.4.7",
 | 
				
			||||||
    "request-promise-native": "^1.0.8",
 | 
					    "request-promise-native": "^1.0.8",
 | 
				
			||||||
    "shell-exec": "^1.0.2",
 | 
					    "shell-exec": "^1.0.2",
 | 
				
			||||||
    "shelljs": "^0.8.4",
 | 
					    "shelljs": "^0.8.4"
 | 
				
			||||||
    "zip": "^1.2.0"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "pkg": {
 | 
					  "pkg": {
 | 
				
			||||||
    "scripts": [],
 | 
					    "scripts": [],
 | 
				
			||||||
    "assets": [
 | 
					    "assets": [
 | 
				
			||||||
      "node_modules/figlet/fonts/Standard.flf"
 | 
					      "node_modules/figlet/fonts/Standard.flf",
 | 
				
			||||||
 | 
					      "data/packageList.json"
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    "targets": [
 | 
					    "targets": [
 | 
				
			||||||
      "node12-linux-x64",
 | 
					      "node12-linux-x64",
 | 
				
			||||||
 | 
				
			|||||||
@ -18,25 +18,37 @@ module.exports = {
 | 
				
			|||||||
        let installedAppList
 | 
					        let installedAppList
 | 
				
			||||||
        common.header('Remove Installed Apps')
 | 
					        common.header('Remove Installed Apps')
 | 
				
			||||||
        await shellExec(adbRun + ' shell pm list packages -3').then(async function (result) {
 | 
					        await shellExec(adbRun + ' shell pm list packages -3').then(async function (result) {
 | 
				
			||||||
            if (process.platform === 'win32' || process.platform === 'win64') {
 | 
					            if (result.stderr.includes('error')) {
 | 
				
			||||||
                installedAppList = result.stdout.split('\r\n'); // split string on comma space
 | 
					                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 {
 | 
					            } else {
 | 
				
			||||||
                installedAppList = result.stdout.split('\n'); // split string on comma space
 | 
					                if (process.platform === 'win32' || process.platform === 'win64') {
 | 
				
			||||||
            }
 | 
					                    installedAppList = result.stdout.split('\r\n'); // split string on comma space
 | 
				
			||||||
            installedAppList.splice(-1, 1)
 | 
					                    installedAppList.splice(-1, 1)
 | 
				
			||||||
        });
 | 
					                } else {
 | 
				
			||||||
        const value = await inquirer.installedApps(installedAppList);
 | 
					                    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) {
 | 
					            for (let element of value.removeAppsList) {
 | 
				
			||||||
            console.log('Removing ' + element)
 | 
					                console.log('Removing ' + element)
 | 
				
			||||||
            const package = element.substring(8)
 | 
					                const package = element.substring(8)
 | 
				
			||||||
            await shellExec(adbRun + ' uninstall ' + package).then(async function (result) {
 | 
					                await shellExec(adbRun + ' uninstall ' + package).then(async function (result) {
 | 
				
			||||||
                console.log(element + ' - ' + result.stdout);
 | 
					                    console.log(element + ' - ' + result.stdout);
 | 
				
			||||||
            });
 | 
					                });
 | 
				
			||||||
        }
 | 
					            }
 | 
				
			||||||
 | 
					        // });
 | 
				
			||||||
        console.log(chalk.green('Removed Selected User Apps'))
 | 
					        console.log(chalk.green('Removed Selected User Apps'))
 | 
				
			||||||
        await common.pause(2000)
 | 
					        await common.pause(2000)
 | 
				
			||||||
        module.exports.mainMenu()
 | 
					        module.exports.mainMenu()
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            })
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    compatibleApps: async () => {
 | 
					    compatibleApps: async () => {
 | 
				
			||||||
        common.header('Install Compatible Apps')
 | 
					        common.header('Install Compatible Apps')
 | 
				
			||||||
@ -133,6 +145,7 @@ module.exports = {
 | 
				
			|||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    console.log(chalk.red('MiWatch not found'))
 | 
					                    console.log(chalk.red('MiWatch not found'))
 | 
				
			||||||
                    await common.pause(2000)
 | 
					                    await common.pause(2000)
 | 
				
			||||||
 | 
					                    files.writeIpAddress('')
 | 
				
			||||||
                    console.log(chalk.white('Try Again'))
 | 
					                    console.log(chalk.white('Try Again'))
 | 
				
			||||||
                    await common.pause(1000)
 | 
					                    await common.pause(1000)
 | 
				
			||||||
                    module.exports.connectWifi()
 | 
					                    module.exports.connectWifi()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user