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

Fixed: Option --device {DeviceName} not working for emulate/run/debug… #855

Merged
merged 1 commit into from
Dec 16, 2016
Merged
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
1 change: 1 addition & 0 deletions definitions/mobile.d.ts
Original file line number Diff line number Diff line change
@@ -340,6 +340,7 @@ declare module Mobile {
getDevicesForPlatform(platform: string): Mobile.IDevice[];
getDeviceInstances(): Mobile.IDevice[];
getDeviceByDeviceOption(): Mobile.IDevice;
getDeviceByName(name: string): Mobile.IDevice;
isAndroidDevice(device: Mobile.IDevice): boolean;
isiOSDevice(device: Mobile.IDevice): boolean;
isiOSSimulator(device: Mobile.IDevice): boolean;
6 changes: 6 additions & 0 deletions mobile/mobile-core/devices-service.ts
Original file line number Diff line number Diff line change
@@ -213,6 +213,10 @@ export class DevicesService implements Mobile.IDevicesService {
return searchedDevice;
}

public getDeviceByName(name: string): Mobile.IDevice {
return _.find(this.getDeviceInstances(), (device: Mobile.IDevice) => { return device.deviceInfo.displayName === name; });
}

private startLookingForDevices(): IFuture<void> {
return (() => {
this.$logger.trace("startLookingForDevices; platform is %s", this._platform);
@@ -244,6 +248,8 @@ export class DevicesService implements Mobile.IDevicesService {
device = this.getDeviceByIdentifier(deviceOption);
} else if (helpers.isNumber(deviceOption)) {
device = this.getDeviceByIndex(parseInt(deviceOption, 10));
} else {
device = this.getDeviceByName(deviceOption);
}

if (!device) {