123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- const inquirer = require("inquirer");
- const files = require("./files");
- const common = require("./common");
- const Language = require("@shypes/language-translator");
- const globalVariables = require('../lib/globalVars');
- const settings = require("settings-store");
- module.exports = {
- mainMenu: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const questions = [{
- type: "list",
- name: "mainMenu",
- message: await Language.get('main-menu-question'),
- choices: [
- '-----------------------',
- await Language.get('main-menu-item-1'),
- await Language.get('main-menu-item-12'),
- await Language.get('main-menu-item-11'),
- await Language.get('main-menu-item-4'),
- await Language.get('main-menu-item-5'),
- await Language.get('main-menu-item-6'),
- await Language.get('main-menu-item-7'),
- await Language.get('main-menu-item-8'),
- await Language.get('main-menu-item-10'),
- await Language.get('main-menu-item-9'),
- ],
- filter: function (val) {
- return val.toLowerCase();
- },
- },];
- return inquirer.prompt(questions);
- },
- LanguageSelect: async () => {
- langList = files.getLanguageFiles()
- langList = langList.map(s => s.slice(5, -5));
- const questions = [{
- type: "list",
- name: "selection",
- message: await Language.get('Select Language'),
- choices: langList,
- filter: function (val) {
- return val.toLowerCase();
- },
- },];
- return inquirer.prompt(questions);
- },
- connectionType: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const questions = [{
- type: "list",
- name: "connection",
- message: await Language.get('connection-type-message'),
- choices: [
- "USB",
- "Wifi"
- ],
- filter: function (val) {
- return val.toLowerCase();
- },
- },];
- return inquirer.prompt(questions);
- },
- connectWifi: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const questions = [{
- type: "input",
- name: "connectWifi",
- message: await Language.get('connect-wifi-message'),
- },];
- return inquirer.prompt(questions);
- },
- setDPI: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const questions = [{
- type: "input",
- name: "setDPI",
- message: await Language.get('set-dpi-message'),
- },];
- return inquirer.prompt(questions);
- },
- xiaomiAppsList: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const packages = await files.loadPackageList();
- let appList = []
- packages.forEach(element => {
- appList.push(element.name)
- });
- const questions = [{
- type: "checkbox",
- name: "appList",
- message: await Language.get('restore-app-message'),
- choices: appList,
- },];
- return inquirer.prompt(questions);
- },
- compatibleApps: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const compatibleApps = await common.getCompatibleAppsList()
- const appList = []
- for (let element of compatibleApps) {
- appList.push(element.name)
- }
- const questions = [{
- type: "checkbox",
- name: "removeAppsList",
- message: await Language.get('install-compatible-apps-message'),
- choices: appList,
- },];
- return inquirer.prompt(questions);
- },
- installedApps: async (installedApps) => {
- Language.setActiveLang(await settings.value("Lang"))
- const questions = [{
- type: "checkbox",
- name: "removeAppsList",
- message: await Language.get('remove-installed-apps-message'),
- choices: installedApps,
- },];
- return inquirer.prompt(questions);
- },
- restoreAnyApp: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const questions = [{
- type: "input",
- name: "restoreAnyApp",
- message: await Language.get('restore-any-app-message'),
- },];
- return inquirer.prompt(questions);
- },
- removeAnyApp: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const questions = [{
- type: "input",
- name: "removeAnyApp",
- message: await Language.get('remove-any-app-message'),
- },];
- return inquirer.prompt(questions);
- },
- globalMenu: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const questions = [{
- type: "list",
- name: "globalSelection",
- message: await Language.get('main-menu-item-11'),
- choices: [
- await Language.get('enable-global-theme'),
- await Language.get('disable-global-theme')
- ],
- filter: function (val) {
- return val.toLowerCase();
- },
- },];
- return inquirer.prompt(questions);
- },
- xiaomiMenu: async () => {
- Language.setActiveLang(await settings.value("Lang"))
- const questions = [{
- type: "list",
- name: "xiaomiSelection",
- message: await Language.get('main-menu-item-12'),
- choices: [
- await Language.get('main-menu-item-2'),
- await Language.get('main-menu-item-3')
- ],
- filter: function (val) {
- return val.toLowerCase();
- },
- },];
- return inquirer.prompt(questions);
- },
- };
|