@@ -26,11 +26,11 @@ export class IPhoneInteropSimulatorBase {
26
26
27
27
private static DEFAULT_TIMEOUT_IN_SECONDS = 90 ;
28
28
29
- public run ( appPath : string ) : IFuture < void > {
30
- return this . execute ( this . launch , { canRunMainLoop : true , appPath : appPath } ) ;
29
+ public run ( appPath : string , applicationIdentifier : string ) : IFuture < void > {
30
+ return this . execute ( this . launch , { canRunMainLoop : true , appPath : appPath , applicationIdentifier : applicationIdentifier } ) ;
31
31
}
32
-
33
- private setupSessionDelegate ( appPath : string ) : any {
32
+
33
+ private setupSessionDelegate ( appPath : string , applicationIdentifier : string ) : any {
34
34
let sessionDelegate = $ . NSObject . extend ( "DTiPhoneSimulatorSessionDelegate" ) ;
35
35
sessionDelegate . addMethod ( "session:didEndWithError:" , "v@:@@" , function ( self : any , sel : any , sess : any , error : any ) {
36
36
IPhoneInteropSimulatorBase . logSessionInfo ( error , "Session ended without errors." , "Session ended with error " ) ;
@@ -39,16 +39,16 @@ export class IPhoneInteropSimulatorBase {
39
39
sessionDelegate . addMethod ( "session:didStart:withError:" , "v@:@c@" , function ( self : any , sel : string , session : any , started : boolean , error :any ) {
40
40
IPhoneInteropSimulatorBase . logSessionInfo ( error , "Session started without errors." , "Session started with error " ) ;
41
41
42
- console . log ( `${ appPath } : ${ session ( "simulatedApplicationPID" ) } ` ) ;
42
+ console . log ( `${ applicationIdentifier } : ${ session ( "simulatedApplicationPID" ) } ` ) ;
43
43
if ( options . exit ) {
44
44
process . exit ( 0 ) ;
45
45
}
46
46
} ) ;
47
47
sessionDelegate . register ( ) ;
48
-
48
+
49
49
return sessionDelegate ;
50
50
}
51
-
51
+
52
52
private getTimeout ( ) : number {
53
53
let timeoutParam = IPhoneInteropSimulatorBase . DEFAULT_TIMEOUT_IN_SECONDS ;
54
54
if ( options . timeout || options . timeout === 0 ) {
@@ -62,7 +62,7 @@ export class IPhoneInteropSimulatorBase {
62
62
}
63
63
return timeoutParam ;
64
64
}
65
-
65
+
66
66
private validateDevice ( ) {
67
67
if ( options . device ) {
68
68
let devices = this . simulator . getDevices ( ) . wait ( ) ;
@@ -73,8 +73,8 @@ export class IPhoneInteropSimulatorBase {
73
73
}
74
74
}
75
75
76
- private launch ( appPath : string ) : void {
77
- let sessionDelegate = this . setupSessionDelegate ( appPath ) ;
76
+ private launch ( appPath : string , applicationIdentifier : string ) : void {
77
+ let sessionDelegate = this . setupSessionDelegate ( appPath , applicationIdentifier ) ;
78
78
79
79
let appSpec = this . getClassByName ( "DTiPhoneSimulatorApplicationSpecifier" ) ( "specifierWithApplicationPath" , $ ( appPath ) ) ;
80
80
let config = this . getClassByName ( "DTiPhoneSimulatorSessionConfig" ) ( "alloc" ) ( "init" ) ( "autorelease" ) ;
@@ -125,7 +125,7 @@ export class IPhoneInteropSimulatorBase {
125
125
}
126
126
}
127
127
128
- protected execute ( action : ( appPath ?: string ) => any , opts : IExecuteOptions ) : IFuture < any > {
128
+ protected execute ( action : ( appPath ?: string , applicationIdentifier ?: string ) => any , opts : IExecuteOptions ) : IFuture < any > {
129
129
$ . importFramework ( IPhoneInteropSimulatorBase . FOUNDATION_FRAMEWORK_NAME ) ;
130
130
$ . importFramework ( IPhoneInteropSimulatorBase . APPKIT_FRAMEWORK_NAME ) ;
131
131
@@ -136,14 +136,14 @@ export class IPhoneInteropSimulatorBase {
136
136
137
137
this . loadFrameworks ( developerDirectoryPath ) ;
138
138
139
- let result = action . apply ( this , [ opts . appPath ] ) ;
139
+ let result = action . apply ( this , [ opts . appPath , opts . applicationIdentifier ] ) ;
140
140
return this . runCFLoop ( opts . canRunMainLoop , result ) ;
141
141
}
142
-
142
+
143
143
private runCFLoop ( canRunMainLoop : boolean , result : any ) : IFuture < any > {
144
144
let pool = $ . NSAutoreleasePool ( "alloc" ) ( "init" ) ;
145
145
let future = new Future < any > ( ) ;
146
-
146
+
147
147
if ( canRunMainLoop ) {
148
148
// Keeps the Node loop running
149
149
( function runLoop ( ) {
@@ -157,7 +157,7 @@ export class IPhoneInteropSimulatorBase {
157
157
} else {
158
158
future . return ( result ) ;
159
159
}
160
-
160
+
161
161
return future ;
162
162
}
163
163
0 commit comments