From 134edee2abe7eba7af14e21648a31225eed1282b Mon Sep 17 00:00:00 2001 From: Dimitar Kerezov Date: Mon, 14 Aug 2017 11:14:49 +0300 Subject: [PATCH 1/2] Extract some interfaces --- declarations.d.ts | 14 +++++++++----- definitions/mobile.d.ts | 31 +++++++++---------------------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/declarations.d.ts b/declarations.d.ts index e3ce420f..e2eaea13 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -525,8 +525,11 @@ interface ISpawnFromEventOptions { } } -interface IProjectHelper { +interface IProjectDir { projectDir: string; +} + +interface IProjectHelper extends IProjectDir { generateDefaultAppId(appName: string, baseAppId: string): string; sanitizeName(appName: string): string; } @@ -931,8 +934,11 @@ interface ISyncBatch { syncFiles(syncAction: (filesToSync: string[]) => Promise): Promise; } -interface ILiveSyncData { +interface IPlatform { platform: string; +} + +interface ILiveSyncData extends IPlatform { /** Application identifier */ appIdentifier: string; /** The path to a directory that contains prepared project files for sync */ @@ -973,13 +979,11 @@ interface IDeviceLiveSyncService extends IDeviceLiveSyncServiceBase { afterInstallApplicationAction?(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): Promise; } -interface ISysInfoData { +interface ISysInfoData extends IPlatform { /** name and version of the CLI app itself */ procInfo: string; // os stuff - /** os platform flavour, reported by os.platform */ - platform: string; /** Full os name, like `uname -a` on unix, registry query on win */ os: string; /** .net version, applicable to windows only */ diff --git a/definitions/mobile.d.ts b/definitions/mobile.d.ts index 54ba32f8..94a5c7bf 100644 --- a/definitions/mobile.d.ts +++ b/definitions/mobile.d.ts @@ -7,7 +7,7 @@ declare module Mobile { /** * Describes available information for a device. */ - interface IDeviceInfo { + interface IDeviceInfo extends IPlatform { /** * Unique identifier of the device. */ @@ -41,12 +41,6 @@ declare module Mobile { */ vendor: string; - /** - * Device's platform. - * Can be Android or iOS. - */ - platform: string; - /** * Status of device describing if you can work with this device or there's communication error. * Can be Connected or Unauthorized. @@ -85,7 +79,9 @@ declare module Mobile { activeArchitecture?: string; } - interface IDeviceError extends Error { + interface IDeviceError extends Error, IDeviceIdentifier { } + + interface IDeviceIdentifier { deviceIdentifier: string; } @@ -113,10 +109,9 @@ declare module Mobile { interface IiOSSimulator extends IDevice { } - interface IDeviceAppData { + interface IDeviceAppData extends IPlatform { appIdentifier: string; device: Mobile.IDevice; - platform: string; getDeviceProjectRootPath(): Promise; deviceSyncZipPath?: string; isLiveSyncSupported(): Promise; @@ -360,12 +355,11 @@ declare module Mobile { skipEmulatorStart?: boolean; } - interface IDeviceActionResult { - deviceIdentifier: string; + interface IDeviceActionResult extends IDeviceIdentifier { result: T; } - interface IDevicesService extends NodeJS.EventEmitter { + interface IDevicesService extends NodeJS.EventEmitter, IPlatform { hasDevices: boolean; deviceCount: number; @@ -391,7 +385,6 @@ declare module Mobile { * @return {void} */ addDeviceDiscovery(deviceDiscovery: IDeviceDiscovery): void; - platform: string; getDevices(): Mobile.IDeviceInfo[]; /** @@ -612,10 +605,9 @@ declare module Mobile { } //todo: plamen5kov: this is a duplicate of an interface (IEmulatorInfo) fix after 3.0-RC nativescript-cli/lib/definitions/emulator-platform-service.d.ts - interface IEmulatorInfo { + interface IEmulatorInfo extends IPlatform { name: string; version: string; - platform: string; id: string; type: string; isRunning?: boolean; @@ -756,12 +748,7 @@ declare module Mobile { /** * Describes basic information about application on device. */ - interface IDeviceApplicationInformationBase { - /** - * The device identifier. - */ - deviceIdentifier: string; - + interface IDeviceApplicationInformationBase extends IDeviceIdentifier { /** * The application identifier. */ From 4a1f77e0aa0458b6cbb249fdd0424315d8e883a0 Mon Sep 17 00:00:00 2001 From: Dimitar Kerezov Date: Tue, 22 Aug 2017 13:01:57 +0300 Subject: [PATCH 2/2] Enable starting on windows --- mobile/ios/device/ios-application-manager.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mobile/ios/device/ios-application-manager.ts b/mobile/ios/device/ios-application-manager.ts index 2d6e97ac..090d5500 100644 --- a/mobile/ios/device/ios-application-manager.ts +++ b/mobile/ios/device/ios-application-manager.ts @@ -76,10 +76,6 @@ export class IOSApplicationManager extends ApplicationManagerBase { } public async startApplication(appIdentifier: string): Promise { - if (this.$hostInfo.isWindows && !this.$staticConfig.enableDeviceRunCommandOnWindows) { - this.$errors.fail("$%s device run command is not supported on Windows for iOS devices.", this.$staticConfig.CLIENT_NAME.toLowerCase()); - } - if (!await this.isApplicationInstalled(appIdentifier)) { this.$errors.failWithoutHelp("Invalid application id: %s. All available application ids are: %s%s ", appIdentifier, EOL, this.applicationsLiveSyncInfos.join(EOL)); }