@@ -10,6 +10,7 @@ const CREATE_FILE_OPERATION = 8;
10
10
const DO_SYNC_OPERATION = 9 ;
11
11
const ERROR_REPORT = 1 ;
12
12
const OPERATION_END_REPORT = 2 ;
13
+ const OPERATION_END_NO_REFRESH_REPORT_CODE = 3 ;
13
14
const REPORT_LENGTH = 1 ;
14
15
const DEFAULT_LOCAL_HOST_ADDRESS = "127.0.0.1" ;
15
16
@@ -118,9 +119,9 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
118
119
return ! ! this . operationPromises [ operationId ] ;
119
120
}
120
121
121
- public sendDoSyncOperation ( operationId : string , timeout : number ) : Promise < any > {
122
+ public sendDoSyncOperation ( operationId : string , timeout : number ) : Promise < IAndroidLivesyncSyncOperationResult > {
122
123
const id = operationId || this . generateOperationIdentifier ( ) ;
123
- const operationPromise = new Promise ( ( resolve : Function , reject : Function ) => {
124
+ const operationPromise : Promise < IAndroidLivesyncSyncOperationResult > = new Promise ( ( resolve : Function , reject : Function ) => {
124
125
this . verifyActiveConnection ( reject ) ;
125
126
126
127
const message = `${ DO_SYNC_OPERATION } ${ id } ` ;
@@ -328,16 +329,18 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
328
329
const errorMessage = infoBuffer . toString ( ) ;
329
330
this . handleSocketError ( socketId , errorMessage ) ;
330
331
} else if ( reportType === OPERATION_END_REPORT ) {
331
- this . handleSyncEnd ( infoBuffer ) ;
332
+ this . handleSyncEnd ( { data :infoBuffer , didRefresh : true } ) ;
333
+ } else if ( reportType === OPERATION_END_NO_REFRESH_REPORT_CODE ) {
334
+ this . handleSyncEnd ( { data :infoBuffer , didRefresh : false } ) ;
332
335
}
333
336
}
334
337
335
- private handleSyncEnd ( data : any ) {
338
+ private handleSyncEnd ( { data, didRefresh } : { data : any , didRefresh : boolean } ) {
336
339
const operationId = data . toString ( ) ;
337
340
const promiseHandler = this . operationPromises [ operationId ] ;
338
341
339
342
if ( promiseHandler ) {
340
- promiseHandler . resolve ( operationId ) ;
343
+ promiseHandler . resolve ( { operationId, didRefresh } ) ;
341
344
delete this . operationPromises [ operationId ] ;
342
345
}
343
346
}
0 commit comments