Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Extract some interfaces #1001

Merged
merged 2 commits into from
Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -931,8 +934,11 @@ interface ISyncBatch {
syncFiles(syncAction: (filesToSync: string[]) => Promise<void>): Promise<void>;
}

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 */
Expand Down Expand Up @@ -973,13 +979,11 @@ interface IDeviceLiveSyncService extends IDeviceLiveSyncServiceBase {
afterInstallApplicationAction?(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): Promise<boolean>;
}

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 */
Expand Down
31 changes: 9 additions & 22 deletions definitions/mobile.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ declare module Mobile {
/**
* Describes available information for a device.
*/
interface IDeviceInfo {
interface IDeviceInfo extends IPlatform {
/**
* Unique identifier of the device.
*/
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -85,7 +79,9 @@ declare module Mobile {
activeArchitecture?: string;
}

interface IDeviceError extends Error {
interface IDeviceError extends Error, IDeviceIdentifier { }

interface IDeviceIdentifier {
deviceIdentifier: string;
}

Expand Down Expand Up @@ -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<string>;
deviceSyncZipPath?: string;
isLiveSyncSupported(): Promise<boolean>;
Expand Down Expand Up @@ -360,12 +355,11 @@ declare module Mobile {
skipEmulatorStart?: boolean;
}

interface IDeviceActionResult<T> {
deviceIdentifier: string;
interface IDeviceActionResult<T> extends IDeviceIdentifier {
result: T;
}

interface IDevicesService extends NodeJS.EventEmitter {
interface IDevicesService extends NodeJS.EventEmitter, IPlatform {
hasDevices: boolean;
deviceCount: number;

Expand All @@ -391,7 +385,6 @@ declare module Mobile {
* @return {void}
*/
addDeviceDiscovery(deviceDiscovery: IDeviceDiscovery): void;
platform: string;
getDevices(): Mobile.IDeviceInfo[];

/**
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*/
Expand Down
4 changes: 0 additions & 4 deletions mobile/ios/device/ios-application-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ export class IOSApplicationManager extends ApplicationManagerBase {
}

public async startApplication(appIdentifier: string): Promise<void> {
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));
}
Expand Down