UNPKG

nativescript

Version:

Command-line interface for building NativeScript projects

88 lines 3.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EmulatorHelper = void 0; const constants_1 = require("../constants"); const _ = require("lodash"); const yok_1 = require("../yok"); class EmulatorHelper { constructor() { // https://developer.android.com/guide/topics/manifest/uses-sdk-element this.mapAndroidApiLevelToVersion = { "android-35": "15.0.0", "android-34": "14.0.0", "android-33": "13.0.0", "android-32": "12.0.0", "android-31": "12.0.0", "android-30": "11.0.0", "android-29": "10.0.0", "android-28": "9.0.0", "android-27": "8.1.0", "android-26": "8.0.0", "android-25": "7.1.1", "android-24": "7.0.0", "android-23": "6.0.0", "android-22": "5.1.0", "android-21": "5.0.0", "android-20": "4.4.0", "android-19": "4.4.0", "android-18": "4.3.0", "android-17": "4.2.2", }; } getEmulatorsFromAvailableEmulatorsOutput(availableEmulatorsOutput) { return _(availableEmulatorsOutput) .valuesIn() .map((value) => value.devices) .concat() .flatten() .value(); } getErrorsFromAvailableEmulatorsOutput(availableEmulatorsOutput) { return _(availableEmulatorsOutput) .valuesIn() .map((value) => value.errors) .concat() .flatten() .value(); } getEmulatorByImageIdentifier(imageIdentifier, emulators) { const imagerIdentifierLowerCase = imageIdentifier && imageIdentifier.toLowerCase(); return _.find(emulators, (emulator) => emulator && emulator.imageIdentifier && imageIdentifier && emulator.imageIdentifier.toLowerCase() === imagerIdentifierLowerCase); } getEmulatorByIdOrName(emulatorIdOrName, emulators) { const emulatorIdOrNameLowerCase = emulatorIdOrName && emulatorIdOrName.toLowerCase(); return _.find(emulators, (emulator) => emulator && emulatorIdOrNameLowerCase && ((emulator.identifier && emulator.identifier.toLowerCase() === emulatorIdOrNameLowerCase) || emulator.displayName.toLowerCase() === emulatorIdOrNameLowerCase)); } isEmulatorRunning(emulator) { return emulator && emulator.status === constants_1.RUNNING_EMULATOR_STATUS; } getEmulatorByStartEmulatorOptions(options, emulators) { let result = null; if (options.emulator) { result = options.emulator; } if (!result && options.imageIdentifier) { result = this.getEmulatorByImageIdentifier(options.imageIdentifier, emulators); } if (!result && options.emulatorIdOrName) { result = this.getEmulatorByIdOrName(options.emulatorIdOrName, emulators); } return result; } setRunningAndroidEmulatorProperties(emulatorId, emulator) { emulator.identifier = emulatorId; emulator.status = constants_1.RUNNING_EMULATOR_STATUS; emulator.type = constants_1.DeviceTypes.Device; //emulator.isTablet; // TODO: consider to do this here!!! } } exports.EmulatorHelper = EmulatorHelper; yok_1.injector.register("emulatorHelper", EmulatorHelper); //# sourceMappingURL=emulator-helper.js.map