@@ -4,30 +4,15 @@ import { IInjector } from "../../definitions/yok";
44import { injector } from "../../yok" ;
55
66export class IOSDeviceDiscovery extends DeviceDiscovery {
7- private _iTunesErrorMessage : string ;
8-
97 constructor (
108 private $injector : IInjector ,
119 private $logger : ILogger ,
12- private $iTunesValidator : Mobile . IiTunesValidator ,
1310 private $mobileHelper : Mobile . IMobileHelper ,
1411 private $iosDeviceOperations : IIOSDeviceOperations
1512 ) {
1613 super ( ) ;
1714 }
1815
19- private validateiTunes ( ) : boolean {
20- if ( ! this . _iTunesErrorMessage ) {
21- this . _iTunesErrorMessage = this . $iTunesValidator . getError ( ) ;
22-
23- if ( this . _iTunesErrorMessage ) {
24- this . $logger . warn ( this . _iTunesErrorMessage ) ;
25- }
26- }
27-
28- return ! this . _iTunesErrorMessage ;
29- }
30-
3116 public async startLookingForDevices (
3217 options ?: Mobile . IDeviceLookingOptions
3318 ) : Promise < void > {
@@ -41,28 +26,26 @@ export class IOSDeviceDiscovery extends DeviceDiscovery {
4126 return ;
4227 }
4328
44- if ( this . validateiTunes ( ) ) {
45- await this . $iosDeviceOperations . startLookingForDevices (
46- ( deviceInfo : IOSDeviceLib . IDeviceActionInfo ) => {
29+ await this . $iosDeviceOperations . startLookingForDevices (
30+ ( deviceInfo : IOSDeviceLib . IDeviceActionInfo ) => {
31+ const device = this . createDevice ( deviceInfo ) ;
32+ this . addDevice ( device ) ;
33+ } ,
34+ ( deviceInfo : IOSDeviceLib . IDeviceActionInfo ) => {
35+ const currentDevice = this . getDevice ( deviceInfo . deviceId ) ;
36+ if ( currentDevice ) {
37+ const device = this . createDevice ( deviceInfo ) ;
38+ this . updateDeviceInfo ( device ) ;
39+ } else {
4740 const device = this . createDevice ( deviceInfo ) ;
4841 this . addDevice ( device ) ;
49- } ,
50- ( deviceInfo : IOSDeviceLib . IDeviceActionInfo ) => {
51- const currentDevice = this . getDevice ( deviceInfo . deviceId ) ;
52- if ( currentDevice ) {
53- const device = this . createDevice ( deviceInfo ) ;
54- this . updateDeviceInfo ( device ) ;
55- } else {
56- const device = this . createDevice ( deviceInfo ) ;
57- this . addDevice ( device ) ;
58- }
59- } ,
60- ( deviceInfo : IOSDeviceLib . IDeviceActionInfo ) => {
61- this . removeDevice ( deviceInfo . deviceId ) ;
62- } ,
63- options
64- ) ;
65- }
42+ }
43+ } ,
44+ ( deviceInfo : IOSDeviceLib . IDeviceActionInfo ) => {
45+ this . removeDevice ( deviceInfo . deviceId ) ;
46+ } ,
47+ options
48+ ) ;
6649 }
6750
6851 private createDevice (
0 commit comments