"use strict";
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 Future = require("fibers/future");
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 () {
        return Future.fromResult();
    };
    return AppBuilderAndroidLiveSyncService;
})(android_livesync_service_1.AndroidLiveSyncService);
exports.AppBuilderAndroidLiveSyncService = AppBuilderAndroidLiveSyncService;
$injector.register("androidLiveSyncServiceLocator", { factory: AppBuilderAndroidLiveSyncService });
