This repository was archived by the owner on Feb 2, 2021. It is now read-only.
File tree 4 files changed +14
-5
lines changed 4 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -406,7 +406,7 @@ declare module Mobile {
406
406
startDeviceDetectionInterval ( ) : Promise < void > ;
407
407
getDeviceByIdentifier ( identifier : string ) : Mobile . IDevice ;
408
408
mapAbstractToTcpPort ( deviceIdentifier : string , appIdentifier : string , framework : string ) : Promise < string > ;
409
- detectCurrentlyAttachedDevices ( ) : Promise < void > ;
409
+ detectCurrentlyAttachedDevices ( options ?: Mobile . IDeviceLookingOptions ) : Promise < void > ;
410
410
startEmulator ( platform ?: string , emulatorImage ?: string ) : Promise < void > ;
411
411
isCompanionAppInstalledOnDevices ( deviceIdentifiers : string [ ] , framework : string ) : Promise < IAppInstalledInfo > [ ] ;
412
412
getDebuggableApps ( deviceIdentifiers : string [ ] ) : Promise < Mobile . IDeviceApplicationInformation [ ] > [ ] ;
Original file line number Diff line number Diff line change @@ -255,8 +255,8 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi
255
255
* Method expects running devices.
256
256
* @param identifier parameter passed by the user to --device flag
257
257
*/
258
- private async getDevice ( deviceOption : string ) : Promise < Mobile . IDevice > {
259
- await this . detectCurrentlyAttachedDevices ( ) ;
258
+ private async getDevice ( deviceOption : string , platform ?: string ) : Promise < Mobile . IDevice > {
259
+ await this . detectCurrentlyAttachedDevices ( { shouldReturnImmediateResult : false , platform : this . _platform } ) ;
260
260
let device : Mobile . IDevice = null ;
261
261
262
262
let emulatorIdentifier = null ;
@@ -442,7 +442,7 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi
442
442
443
443
if ( platform && deviceOption ) {
444
444
this . _platform = this . getPlatform ( data . platform ) ;
445
- this . _device = await this . getDevice ( deviceOption ) ;
445
+ this . _device = await this . getDevice ( deviceOption , this . _platform ) ;
446
446
if ( this . _device . deviceInfo . platform !== this . _platform ) {
447
447
this . $errors . fail ( constants . ERROR_CANNOT_RESOLVE_DEVICE ) ;
448
448
}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export class IOSDeviceDiscovery extends DeviceDiscovery {
7
7
constructor ( private $injector : IInjector ,
8
8
private $logger : ILogger ,
9
9
private $iTunesValidator : Mobile . IiTunesValidator ,
10
+ private $mobileHelper : Mobile . IMobileHelper ,
10
11
private $iosDeviceOperations : IIOSDeviceOperations ) {
11
12
super ( ) ;
12
13
}
@@ -24,6 +25,9 @@ export class IOSDeviceDiscovery extends DeviceDiscovery {
24
25
}
25
26
26
27
public async startLookingForDevices ( options ?: Mobile . IDeviceLookingOptions ) : Promise < void > {
28
+ if ( options && options . platform && ! this . $mobileHelper . isiOSPlatform ( options . platform ) ) {
29
+ return ;
30
+ }
27
31
if ( this . validateiTunes ( ) ) {
28
32
await this . $iosDeviceOperations . startLookingForDevices ( ( deviceInfo : IOSDeviceLib . IDeviceActionInfo ) => {
29
33
this . createAndAddDevice ( deviceInfo ) ;
Original file line number Diff line number Diff line change @@ -7,11 +7,16 @@ export class IOSSimulatorDiscovery extends DeviceDiscovery {
7
7
constructor ( private $injector : IInjector ,
8
8
private $childProcess : IChildProcess ,
9
9
private $iOSSimResolver : Mobile . IiOSSimResolver ,
10
+ private $mobileHelper : Mobile . IMobileHelper ,
10
11
private $hostInfo : IHostInfo ) {
11
12
super ( ) ;
12
13
}
13
14
14
- public async startLookingForDevices ( ) : Promise < void > {
15
+ public async startLookingForDevices ( options ?: Mobile . IDeviceLookingOptions ) : Promise < void > {
16
+ if ( options && options . platform && ! this . $mobileHelper . isiOSPlatform ( options . platform ) ) {
17
+ return ;
18
+ }
19
+
15
20
return new Promise < void > ( ( resolve , reject ) => {
16
21
return this . checkForDevices ( resolve , reject ) ;
17
22
} ) ;
You can’t perform that action at this time.
0 commit comments