This repository was archived by the owner on Feb 2, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,7 @@ declare module Mobile {
340
340
getDevicesForPlatform ( platform : string ) : Mobile . IDevice [ ] ;
341
341
getDeviceInstances ( ) : Mobile . IDevice [ ] ;
342
342
getDeviceByDeviceOption ( ) : Mobile . IDevice ;
343
+ getDeviceByName ( name : string ) : Mobile . IDevice ;
343
344
isAndroidDevice ( device : Mobile . IDevice ) : boolean ;
344
345
isiOSDevice ( device : Mobile . IDevice ) : boolean ;
345
346
isiOSSimulator ( device : Mobile . IDevice ) : boolean ;
Original file line number Diff line number Diff line change @@ -213,6 +213,10 @@ export class DevicesService implements Mobile.IDevicesService {
213
213
return searchedDevice ;
214
214
}
215
215
216
+ public getDeviceByName ( name : string ) : Mobile . IDevice {
217
+ return _ . find ( this . getDeviceInstances ( ) , ( device : Mobile . IDevice ) => { return device . deviceInfo . displayName === name ; } ) ;
218
+ }
219
+
216
220
private startLookingForDevices ( ) : IFuture < void > {
217
221
return ( ( ) => {
218
222
this . $logger . trace ( "startLookingForDevices; platform is %s" , this . _platform ) ;
@@ -244,6 +248,8 @@ export class DevicesService implements Mobile.IDevicesService {
244
248
device = this . getDeviceByIdentifier ( deviceOption ) ;
245
249
} else if ( helpers . isNumber ( deviceOption ) ) {
246
250
device = this . getDeviceByIndex ( parseInt ( deviceOption , 10 ) ) ;
251
+ } else {
252
+ device = this . getDeviceByName ( deviceOption ) ;
247
253
}
248
254
249
255
if ( ! device ) {
You can’t perform that action at this time.
0 commit comments