mobile-cli-lib
Version:
common lib used by different CLI
47 lines (46 loc) • 2.47 kB
JavaScript
;
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var android_livesync_service_1 = require("../../../mobile/android/android-livesync-service");
var path = require("path");
var helpers = require("../../../helpers");
var AppBuilderAndroidLiveSyncService = (function (_super) {
__extends(AppBuilderAndroidLiveSyncService, _super);
function AppBuilderAndroidLiveSyncService(_device, $fs, $mobileHelper, $options) {
_super.call(this, _device, $fs, $mobileHelper);
this._device = _device;
this.$options = $options;
}
AppBuilderAndroidLiveSyncService.prototype.refreshApplication = function (deviceAppData) {
var _this = this;
return (function () {
var commands = [_this.liveSyncCommands.SyncFilesCommand()];
if (_this.$options.watch || _this.$options.file) {
commands.push(_this.liveSyncCommands.RefreshCurrentViewCommand());
}
else {
commands.push(_this.liveSyncCommands.ReloadStartViewCommand());
}
_this.livesync(deviceAppData.appIdentifier, deviceAppData.deviceProjectRootPath, commands).wait();
}).future()();
};
AppBuilderAndroidLiveSyncService.prototype.removeFiles = function (appIdentifier, localToDevicePaths) {
var _this = this;
return (function () {
if (localToDevicePaths && localToDevicePaths.length) {
var deviceProjectRootPath_1 = localToDevicePaths[0].deviceProjectRootPath;
var commands = _.map(localToDevicePaths, function (ldp) {
var relativePath = path.relative(deviceProjectRootPath_1, ldp.getDevicePath()), unixPath = helpers.fromWindowsRelativePathToUnix(relativePath);
return _this.liveSyncCommands.DeleteFile(unixPath);
});
_this.livesync(appIdentifier, deviceProjectRootPath_1, commands).wait();
}
}).future()();
};
return AppBuilderAndroidLiveSyncService;
}(android_livesync_service_1.AndroidLiveSyncService));
exports.AppBuilderAndroidLiveSyncService = AppBuilderAndroidLiveSyncService;
$injector.register("androidLiveSyncServiceLocator", { factory: AppBuilderAndroidLiveSyncService });