1- import { DEBUGGER_PORT_FOUND_EVENT_NAME , STARTING_IOS_APPLICATION_EVENT_NAME } from "../common/constants" ;
1+ import { DEBUGGER_PORT_FOUND_EVENT_NAME , ATTACH_REQUEST_EVENT_NAME } from "../common/constants" ;
22import { cache } from "../common/decorators" ;
33import * as semver from "semver" ;
44
55export class IOSDebuggerPortService implements IIOSDebuggerPortService {
66 private mapDebuggerPortData : IDictionary < IIOSDebuggerPortStoredData > = { } ;
77 private static DEFAULT_PORT = 18181 ;
8- private static MIN_REQUIRED_FRAMEWORK_VERSION = "4.0.0 " ;
8+ private static MIN_REQUIRED_FRAMEWORK_VERSION = "4.0.1 " ;
99
1010 constructor ( private $iOSLogParserService : IIOSLogParserService ,
1111 private $iOSProjectService : IPlatformProjectService ,
@@ -40,14 +40,14 @@ export class IOSDebuggerPortService implements IIOSDebuggerPortService {
4040 }
4141
4242 this . attachToDebuggerPortFoundEventCore ( ) ;
43- this . attachToStartingApplicationEvent ( device ) ;
43+ this . attachToAttachRequestEvent ( device ) ;
4444
45- this . $iOSLogParserService . startLookingForDebuggerPort ( device ) ;
45+ this . $iOSLogParserService . startParsingLog ( device ) ;
4646 }
4747
4848 private canStartLookingForDebuggerPort ( ) : boolean {
4949 const frameworkVersion = this . $iOSProjectService . getFrameworkVersion ( this . $projectData ) ;
50- return semver . gte ( frameworkVersion , IOSDebuggerPortService . MIN_REQUIRED_FRAMEWORK_VERSION ) ;
50+ return semver . gt ( frameworkVersion , IOSDebuggerPortService . MIN_REQUIRED_FRAMEWORK_VERSION ) ;
5151 }
5252
5353 @cache ( )
@@ -60,13 +60,13 @@ export class IOSDebuggerPortService implements IIOSDebuggerPortService {
6060 }
6161
6262 @cache ( )
63- private attachToStartingApplicationEvent ( device : Mobile . IDevice ) : void {
64- device . applicationManager . on ( STARTING_IOS_APPLICATION_EVENT_NAME , ( data : IIOSDebuggerPortData ) => {
65- this . $logger . trace ( STARTING_IOS_APPLICATION_EVENT_NAME , data ) ;
63+ private attachToAttachRequestEvent ( device : Mobile . IDevice ) : void {
64+ device . applicationManager . on ( ATTACH_REQUEST_EVENT_NAME , ( data : IIOSDebuggerPortData ) => {
65+ this . $logger . trace ( ATTACH_REQUEST_EVENT_NAME , data ) ;
6666 const timer = setTimeout ( ( ) => {
6767 this . clearTimeout ( data ) ;
6868 if ( ! this . getPortByKey ( `${ data . deviceId } ${ data . appId } ` ) ) {
69- this . $logger . warn ( " NativeScript debugger was not able to get inspector socket port." ) ;
69+ this . $logger . warn ( ` NativeScript debugger was not able to get inspector socket port on device ${ data . deviceId } for application ${ data . appId } .` ) ;
7070 }
7171 } , 5000 ) ;
7272
0 commit comments