UNPKG

nativescript

Version:

Command-line interface for building NativeScript projects

56 lines 3.39 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AndroidLiveSyncService = void 0; const android_device_livesync_service_1 = require("./android-device-livesync-service"); const android_device_livesync_sockets_service_1 = require("./android-device-livesync-sockets-service"); const platform_livesync_service_base_1 = require("./platform-livesync-service-base"); const decorators_1 = require("../../common/decorators"); const semver = require("semver"); const _ = require("lodash"); const yok_1 = require("../../common/yok"); class AndroidLiveSyncService extends platform_livesync_service_base_1.PlatformLiveSyncServiceBase { constructor($platformsDataService, $projectFilesManager, $injector, $devicePathProvider, $fs, $logger, $options) { super($fs, $logger, $platformsDataService, $projectFilesManager, $devicePathProvider, $options); this.$platformsDataService = $platformsDataService; this.$projectFilesManager = $projectFilesManager; this.$injector = $injector; } _getDeviceLiveSyncService(device, data, frameworkVersion) { if (semver.gt(frameworkVersion, AndroidLiveSyncService.MIN_SOCKETS_LIVESYNC_RUNTIME_VERSION)) { return this.$injector.resolve(android_device_livesync_sockets_service_1.AndroidDeviceSocketsLiveSyncService, { device, data }); } return this.$injector.resolve(android_device_livesync_service_1.AndroidDeviceLiveSyncService, { device, data }); } async liveSyncWatchAction(device, liveSyncInfo) { const liveSyncResult = await super.liveSyncWatchAction(device, liveSyncInfo); const result = await this.finalizeSync(device, liveSyncInfo.projectData, liveSyncResult); return result; } async fullSync(syncInfo) { const liveSyncResult = await super.fullSync(syncInfo); const result = await this.finalizeSync(syncInfo.device, syncInfo.projectData, liveSyncResult); return result; } async finalizeSync(device, projectData, liveSyncResult) { const liveSyncService = (this.getDeviceLiveSyncService(device, projectData)); const finalizeResult = await liveSyncService.finalizeSync(liveSyncResult, projectData); const result = _.extend(liveSyncResult, finalizeResult); return result; } } exports.AndroidLiveSyncService = AndroidLiveSyncService; AndroidLiveSyncService.MIN_SOCKETS_LIVESYNC_RUNTIME_VERSION = "4.2.0-2018-07-20-02"; __decorate([ (0, decorators_1.performanceLog)() ], AndroidLiveSyncService.prototype, "liveSyncWatchAction", null); __decorate([ (0, decorators_1.performanceLog)() ], AndroidLiveSyncService.prototype, "fullSync", null); yok_1.injector.register("androidLiveSyncService", AndroidLiveSyncService); //# sourceMappingURL=android-livesync-service.js.map