still not fixed

This commit is contained in:
karl.hudgell 2020-04-25 21:28:13 +01:00
parent 14050a1a04
commit 7464f9b4e9
5 changed files with 74 additions and 19 deletions

18
lib/adb.js Normal file
View File

@ -0,0 +1,18 @@
const gfin = require('get-files-in')
const shellExec = require('shell-exec')
module.exports = {
getListOfAPk: () => {
this.apkListToInstall = gfin('./data/apps', matchFiletypes = ["apk"], checkSubDirectories = false)
},
installApk: async () => {
await module.exports.getListOfAPk()
for (let element of this.apkListToInstall) {
await shellExec('adb install -r ' + element).then(function (result) {
console.log('Installing ' + element + ' - ' + result.stdout);
});
}
// console.log(chalk.green('Removal Complete'))
},
};

View File

@ -1,6 +1,10 @@
const fs = require('fs');
const path = require('path');
const dl = require('download-file-with-progressbar');
// const dl = require('download-file-with-progressbar');
const {
DownloaderHelper
} = require('node-downloader-helper');
module.exports = {
getCurrentDirectoryBase: () => {
@ -28,19 +32,36 @@ module.exports = {
console.log(err)
}
},
downloadFile: async (element) => {
option = {
dir: './data/apps',
onDone: (info)=>{
console.log('Latest ' + element.name + ' Downloaded')
},
onError: (err) => {
console.log('error', err);
},
onProgress: (curr, total) => {
},
}
var dd = dl(element.url, option);
}
};
downloadFile: (element) => {
// option = {
// dir: './data/apps',
// onDone: (info) => {
// console.log('Latest ' + element.name + ' Downloaded')
// },
// onError: (err) => {
// console.log('error', err);
// },
// onProgress: (curr, total) => {},
// }
// dl(element.url, option);
// }
// const options = {
// override: true,
// }
// const dl = new DownloaderHelper(element.url, './data/apps', options);
// dl.on('end', () => console.log('Download Completed'))
// dl.start();
var promise = new Promise(function (resolve, reject) {
setTimeout(function () {
resolve('hello world');
}, 2000);
});
promise.then(function (data) {
console.log(data);
});
},
}

10
package-lock.json generated
View File

@ -547,6 +547,11 @@
"universalify": "^0.1.0"
}
},
"get-files-in": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/get-files-in/-/get-files-in-1.2.0.tgz",
"integrity": "sha512-bufY50S4KnOmEVG9yeioI1QTBAIb1B3c6Ks+1ysu0zScfrld8dmhdGB7Fw/rQSTE6ryVrra+AkznvgiR3H4zRA=="
},
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
@ -857,6 +862,11 @@
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
"integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw="
},
"node-downloader-helper": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/node-downloader-helper/-/node-downloader-helper-1.0.12.tgz",
"integrity": "sha512-2t3h3g3xK5kxhRbwD+0WgKotHyoVEQlE+V93rn97tqzUtbw8cFpHn0uhsc2LeKkDlsQI1iy5XZoS3vACzBdW8A=="
},
"oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",

View File

@ -20,9 +20,11 @@
"figlet": "^1.3.0",
"foreachasync": "^5.1.3",
"fs": "0.0.1-security",
"get-files-in": "^1.2.0",
"inquirer": "^7.1.0",
"lodash": "^4.17.15",
"minimist": "^1.2.5",
"node-downloader-helper": "^1.0.12",
"path": "^0.12.7",
"path-exists": "^4.0.0",
"pkg": "^4.4.7",

View File

@ -4,19 +4,23 @@ const inquirer = require('../lib/inquirer');
const shellExec = require('shell-exec')
const files = require('../lib/files')
const fs = require('fs')
const adb = require('../lib/adb')
module.exports = {
compatibleApps: async () => {
common.header('Install Compatible Apps')
const compatibleApps = JSON.parse(fs.readFileSync('./data/compatibleApps.json', 'utf8'));
const value = await inquirer.compatibleApps();
for (let element of value.removeAppsList) {
for (let element2 of compatibleApps) {
if (element === element2.name) {
await files.downloadFile(element2)
files.downloadFile(element2)
}
}
// console.log(element)
}
// await adb.installApk()
console.log('finished')
},
removeApps: async () => {
common.header('Remove Apps')