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

Commit 71ab400

Browse files
author
Tsvetan Raikov
committed
Fixed: Option --device {DeviceName} not working for emulate/run/debug/deploy
1 parent c10c9de commit 71ab400

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

definitions/mobile.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ declare module Mobile {
340340
getDevicesForPlatform(platform: string): Mobile.IDevice[];
341341
getDeviceInstances(): Mobile.IDevice[];
342342
getDeviceByDeviceOption(): Mobile.IDevice;
343+
getDeviceByName(name: string): Mobile.IDevice;
343344
isAndroidDevice(device: Mobile.IDevice): boolean;
344345
isiOSDevice(device: Mobile.IDevice): boolean;
345346
isiOSSimulator(device: Mobile.IDevice): boolean;

mobile/mobile-core/devices-service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ export class DevicesService implements Mobile.IDevicesService {
213213
return searchedDevice;
214214
}
215215

216+
public getDeviceByName(name: string): Mobile.IDevice {
217+
return _.find(this.getDeviceInstances(), (device: Mobile.IDevice) => { return device.deviceInfo.displayName === name; });
218+
}
219+
216220
private startLookingForDevices(): IFuture<void> {
217221
return (() => {
218222
this.$logger.trace("startLookingForDevices; platform is %s", this._platform);
@@ -244,6 +248,8 @@ export class DevicesService implements Mobile.IDevicesService {
244248
device = this.getDeviceByIdentifier(deviceOption);
245249
} else if (helpers.isNumber(deviceOption)) {
246250
device = this.getDeviceByIndex(parseInt(deviceOption, 10));
251+
} else {
252+
device = this.getDeviceByName(deviceOption);
247253
}
248254

249255
if (!device) {

0 commit comments

Comments
 (0)