@@ -5,26 +5,25 @@ export class IOSSocketRequestExecutor implements IiOSSocketRequestExecutor {
5
5
private $iOSNotification : IiOSNotification ,
6
6
private $iOSNotificationService : IiOSNotificationService ,
7
7
private $logger : ILogger ,
8
- private $projectData : IProjectData ,
9
- private $iosDeviceOperations : IIOSDeviceOperations ) {
10
- this . $iosDeviceOperations . setShouldDispose ( false ) ;
11
- }
8
+ private $iosDeviceOperations : IIOSDeviceOperations ) {
9
+ this . $iosDeviceOperations . setShouldDispose ( false ) ;
10
+ }
12
11
13
12
public async executeAttachRequest ( device : Mobile . IiOSDevice , timeout : number , projectId : string ) : Promise < void > {
14
13
const deviceIdentifier = device . deviceInfo . identifier ;
15
14
16
15
const observeNotificationSockets = [
17
- await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . alreadyConnected , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ,
18
- await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . readyForAttach , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ,
19
- await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . attachAvailable , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE )
16
+ await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getAlreadyConnected ( projectId ) , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ,
17
+ await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getReadyForAttach ( projectId ) , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ,
18
+ await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getAttachAvailable ( projectId ) , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE )
20
19
] ;
21
20
22
21
const observeNotificationPromises = _ . map ( observeNotificationSockets , s => {
23
22
return this . $iOSNotificationService . awaitNotification ( deviceIdentifier , + s , timeout ) ;
24
23
} ) ;
25
24
26
25
// Trigger the notifications update.
27
- await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . attachAvailabilityQuery ) ;
26
+ await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getAttachAvailabilityQuery ( projectId ) ) ;
28
27
29
28
let receivedNotification : string ;
30
29
try {
@@ -51,18 +50,18 @@ export class IOSSocketRequestExecutor implements IiOSSocketRequestExecutor {
51
50
52
51
public async executeLaunchRequest ( deviceIdentifier : string , timeout : number , readyForAttachTimeout : number , projectId : string , shouldBreak ?: boolean ) : Promise < void > {
53
52
try {
54
- const appLaunchingSocket = await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . appLaunching , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ;
53
+ const appLaunchingSocket = await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getAppLaunching ( projectId ) , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ;
55
54
await this . $iOSNotificationService . awaitNotification ( deviceIdentifier , + appLaunchingSocket , timeout ) ;
56
55
57
- if ( shouldBreak ) {
56
+ if ( shouldBreak ) {
58
57
await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getWaitForDebug ( projectId ) , constants . IOS_POST_NOTIFICATION_COMMAND_TYPE ) ;
59
58
}
60
59
61
60
// We need to send the ObserveNotification ReadyForAttach before we post the AttachRequest.
62
- const readyForAttachSocket = await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . readyForAttach , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ;
61
+ const readyForAttachSocket = await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getReadyForAttach ( projectId ) , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ;
63
62
const readyForAttachPromise = this . $iOSNotificationService . awaitNotification ( deviceIdentifier , + readyForAttachSocket , readyForAttachTimeout ) ;
64
63
65
- await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . attachRequest ) ;
64
+ await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getAttachRequest ( projectId ) ) ;
66
65
await readyForAttachPromise ;
67
66
} catch ( e ) {
68
67
this . $logger . trace ( "Launch request error:" ) ;
@@ -75,9 +74,9 @@ export class IOSSocketRequestExecutor implements IiOSSocketRequestExecutor {
75
74
try {
76
75
// We should create this promise here because we need to send the ObserveNotification on the device
77
76
// before we send the PostNotification.
78
- const readyForAttachSocket = await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . readyForAttach , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ;
77
+ const readyForAttachSocket = await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getReadyForAttach ( projectId ) , constants . IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE ) ;
79
78
const readyForAttachPromise = this . $iOSNotificationService . awaitNotification ( deviceIdentifier , + readyForAttachSocket , timeout ) ;
80
- await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . attachRequest ) ;
79
+ await this . $iOSNotificationService . postNotification ( deviceIdentifier , this . $iOSNotification . getAttachRequest ( projectId ) ) ;
81
80
await readyForAttachPromise ;
82
81
} catch ( e ) {
83
82
this . $errors . failWithoutHelp ( `The application ${ projectId } timed out when performing the socket handshake.` ) ;
0 commit comments