all working 2.0.0
This commit is contained in:
		
							parent
							
								
									522d92c55f
								
							
						
					
					
						commit
						5268d10ae7
					
				@ -1,54 +0,0 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Google Fit",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Google/GoogleFit.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Google Maps",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Google/GoogleMaps.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Google Quick Search",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Google/GoogleQuickSearch.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Google TTS",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Google/GoogleTTS.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Google Translate",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Google/GoogleTranslate.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Google Wear Keyboard",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Google/WearKeyboard.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Google Calculator",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Google/GoogleCalc.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Google Clock",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Google/GoogleClock.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Google Services",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Google/GoogleServices.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Pujie Black",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Others/Pujie.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "AccuWeather",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Others/AccuWeather.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "Ultimate Alexa",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Others/UltimateAlexa.apk"
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "name": "MoreLocale",
 | 
			
		||||
    "url": "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/Others/MoreLocale.apk"
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -1,65 +1,73 @@
 | 
			
		||||
const inquirer = require("inquirer");
 | 
			
		||||
const files = require("./files");
 | 
			
		||||
const fs = require('fs')
 | 
			
		||||
const rp = require('request-promise-native')
 | 
			
		||||
 | 
			
		||||
let compatibleApps
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
  mainMenu: () => {
 | 
			
		||||
    const questions = [
 | 
			
		||||
      {
 | 
			
		||||
        type: "list",
 | 
			
		||||
        name: "mainMenu",
 | 
			
		||||
        message: "What do you want to do?",
 | 
			
		||||
        choices: [
 | 
			
		||||
          "Connect to MiWatch via Wifi",
 | 
			
		||||
          "Remove Xiaomi Apps",
 | 
			
		||||
          "Restore Xiaomi Apps",
 | 
			
		||||
          "Install Compatible Apps",
 | 
			
		||||
          "Quit"
 | 
			
		||||
        ],
 | 
			
		||||
        filter: function (val) {
 | 
			
		||||
          return val.toLowerCase();
 | 
			
		||||
        },
 | 
			
		||||
    const questions = [{
 | 
			
		||||
      type: "list",
 | 
			
		||||
      name: "mainMenu",
 | 
			
		||||
      message: "What do you want to do?",
 | 
			
		||||
      choices: [
 | 
			
		||||
        "Connect to MiWatch via Wifi",
 | 
			
		||||
        "Remove Xiaomi Apps",
 | 
			
		||||
        "Restore Xiaomi Apps",
 | 
			
		||||
        "Install Compatible Apps",
 | 
			
		||||
        "Quit"
 | 
			
		||||
      ],
 | 
			
		||||
      filter: function (val) {
 | 
			
		||||
        return val.toLowerCase();
 | 
			
		||||
      },
 | 
			
		||||
    ];
 | 
			
		||||
    }, ];
 | 
			
		||||
    return inquirer.prompt(questions);
 | 
			
		||||
  },
 | 
			
		||||
  connectWifi: () => {
 | 
			
		||||
    const questions = [
 | 
			
		||||
      {
 | 
			
		||||
        type: "input",
 | 
			
		||||
        name: "connectWifi",
 | 
			
		||||
        message: "What is your MiWatch IpAdress?",
 | 
			
		||||
      },
 | 
			
		||||
    ];
 | 
			
		||||
    const questions = [{
 | 
			
		||||
      type: "input",
 | 
			
		||||
      name: "connectWifi",
 | 
			
		||||
      message: "What is your MiWatch IpAdress?",
 | 
			
		||||
    }, ];
 | 
			
		||||
    return inquirer.prompt(questions);
 | 
			
		||||
  },
 | 
			
		||||
  removeAppsList: async () => {
 | 
			
		||||
    const packages = await files.loadPackageList();
 | 
			
		||||
 | 
			
		||||
    const questions = [
 | 
			
		||||
      {
 | 
			
		||||
        type: "checkbox",
 | 
			
		||||
        name: "removeAppsList",
 | 
			
		||||
        message: "What apps do you want to remove?",
 | 
			
		||||
        choices: packages.apps,
 | 
			
		||||
      },
 | 
			
		||||
    ];
 | 
			
		||||
    const questions = [{
 | 
			
		||||
      type: "checkbox",
 | 
			
		||||
      name: "removeAppsList",
 | 
			
		||||
      message: "What apps do you want to remove?",
 | 
			
		||||
      choices: packages.apps,
 | 
			
		||||
    }, ];
 | 
			
		||||
    return inquirer.prompt(questions);
 | 
			
		||||
  },
 | 
			
		||||
  compatibleApps: async () => {
 | 
			
		||||
    const compatibleApps = JSON.parse(fs.readFileSync('./data/compatibleApps.json', 'utf8'));
 | 
			
		||||
    await module.exports.getCompatibleApps()
 | 
			
		||||
    const appList = []
 | 
			
		||||
    for (let element of compatibleApps) {
 | 
			
		||||
        appList.push(element.name)
 | 
			
		||||
  }
 | 
			
		||||
    const questions = [
 | 
			
		||||
      {
 | 
			
		||||
        type: "checkbox",
 | 
			
		||||
        name: "removeAppsList",
 | 
			
		||||
        message: "What apps do you want to remove?",
 | 
			
		||||
        choices: appList,
 | 
			
		||||
      },
 | 
			
		||||
    ];
 | 
			
		||||
      appList.push(element.name)
 | 
			
		||||
    }
 | 
			
		||||
    const questions = [{
 | 
			
		||||
      type: "checkbox",
 | 
			
		||||
      name: "removeAppsList",
 | 
			
		||||
      message: "What apps do you want to remove?",
 | 
			
		||||
      choices: appList,
 | 
			
		||||
    }, ];
 | 
			
		||||
    return inquirer.prompt(questions);
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
  getCompatibleApps: async () => {
 | 
			
		||||
    var options = {
 | 
			
		||||
      method: 'GET',
 | 
			
		||||
      uri: 'http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/compatibleApps.json',
 | 
			
		||||
  };
 | 
			
		||||
  
 | 
			
		||||
  await rp(options)
 | 
			
		||||
      .then(function (response) {
 | 
			
		||||
          compatibleApps = JSON.parse(response)
 | 
			
		||||
      })
 | 
			
		||||
      .catch(function (err) {
 | 
			
		||||
        console.log('compatibleApps.json Not Found')
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										28
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										28
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -1025,11 +1025,6 @@
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
 | 
			
		||||
      "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="
 | 
			
		||||
    },
 | 
			
		||||
    "promise-android-tools": {
 | 
			
		||||
      "version": "2.0.4",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/promise-android-tools/-/promise-android-tools-2.0.4.tgz",
 | 
			
		||||
      "integrity": "sha512-1q3QA8TpDBNNEY3wXwJdjeb6cHYp+gse07cmYaxsjQQu8hGNv5gzbPq5beUwizXVkmSTf6jBxyezly2RhFP8WQ=="
 | 
			
		||||
    },
 | 
			
		||||
    "psl": {
 | 
			
		||||
      "version": "1.8.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
 | 
			
		||||
@ -1106,6 +1101,24 @@
 | 
			
		||||
        "throttleit": "^1.0.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "request-promise-core": {
 | 
			
		||||
      "version": "1.1.3",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz",
 | 
			
		||||
      "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==",
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "lodash": "^4.17.15"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "request-promise-native": {
 | 
			
		||||
      "version": "1.0.8",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz",
 | 
			
		||||
      "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==",
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "request-promise-core": "1.1.3",
 | 
			
		||||
        "stealthy-require": "^1.1.1",
 | 
			
		||||
        "tough-cookie": "^2.3.3"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "resolve": {
 | 
			
		||||
      "version": "1.17.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
 | 
			
		||||
@ -1201,6 +1214,11 @@
 | 
			
		||||
        "tweetnacl": "~0.14.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "stealthy-require": {
 | 
			
		||||
      "version": "1.1.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
 | 
			
		||||
      "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks="
 | 
			
		||||
    },
 | 
			
		||||
    "stream-meter": {
 | 
			
		||||
      "version": "1.0.4",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.4.tgz",
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,7 @@
 | 
			
		||||
    "path": "^0.12.7",
 | 
			
		||||
    "path-exists": "^4.0.0",
 | 
			
		||||
    "pkg": "^4.4.7",
 | 
			
		||||
    "promise-android-tools": "^2.0.4",
 | 
			
		||||
    "request-promise-native": "^1.0.8",
 | 
			
		||||
    "shell-exec": "^1.0.2"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -8,16 +8,36 @@ const {
 | 
			
		||||
    DownloaderHelper
 | 
			
		||||
} = require('node-downloader-helper');
 | 
			
		||||
const getFilesIn = require('get-files-in')
 | 
			
		||||
const http = require('http')
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
    compatibleApps: async () => {
 | 
			
		||||
        common.header('Install Compatible Apps')
 | 
			
		||||
        const compatibleApps = JSON.parse(fs.readFileSync('./data/compatibleApps.json', 'utf8'));
 | 
			
		||||
        let compatibleApps
 | 
			
		||||
        let url = "http://kithub.cf/Karl/MiWatchKleaner-APKs/raw/master/compatibleApps.json";
 | 
			
		||||
        http.get(url, (res) => {
 | 
			
		||||
            let body = "";
 | 
			
		||||
 | 
			
		||||
            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();
 | 
			
		||||
 | 
			
		||||
        await shellExec('rm ./data/apps/*.apk').then(function (result) {
 | 
			
		||||
            // console.log('Installing ' + element + ' - ' + result.stdout);
 | 
			
		||||
        });
 | 
			
		||||
        await shellExec('rm ./data/apps/*.apk').then(function (result) {});
 | 
			
		||||
 | 
			
		||||
        for (let element of value.removeAppsList) {
 | 
			
		||||
            for (let element2 of compatibleApps) {
 | 
			
		||||
@ -35,8 +55,9 @@ module.exports = {
 | 
			
		||||
        const apkList = await getFilesIn('./data/apps', matchFiletypes = ['apk'], checkSubDirectories = false)
 | 
			
		||||
 | 
			
		||||
        for (let element of apkList) {
 | 
			
		||||
            console.log('Installing ' + element)
 | 
			
		||||
            await shellExec('adb install -r ' + element).then(function (result) {
 | 
			
		||||
                console.log('Installing ' + element + ' - ' + result.stdout);
 | 
			
		||||
                console.log(element + ' - ' + result.stdout);
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        console.log(chalk.green('Compatible Apps Installed'))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user