@@ -10,6 +10,7 @@ const CREATE_FILE_OPERATION = 8;
1010const DO_SYNC_OPERATION = 9 ;
1111const ERROR_REPORT = 1 ;
1212const OPERATION_END_REPORT = 2 ;
13+ const OPERATION_END_NO_REFRESH_REPORT_CODE = 3 ;
1314const REPORT_LENGTH = 1 ;
1415const DEFAULT_LOCAL_HOST_ADDRESS = "127.0.0.1" ;
1516
@@ -118,9 +119,9 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
118119 return ! ! this . operationPromises [ operationId ] ;
119120 }
120121
121- public sendDoSyncOperation ( operationId : string , timeout : number ) : Promise < any > {
122+ public sendDoSyncOperation ( operationId : string , timeout : number ) : Promise < IAndroidLivesyncSyncOperationResult > {
122123 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 ) => {
124125 this . verifyActiveConnection ( reject ) ;
125126
126127 const message = `${ DO_SYNC_OPERATION } ${ id } ` ;
@@ -328,16 +329,18 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
328329 const errorMessage = infoBuffer . toString ( ) ;
329330 this . handleSocketError ( socketId , errorMessage ) ;
330331 } 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 } ) ;
332335 }
333336 }
334337
335- private handleSyncEnd ( data : any ) {
338+ private handleSyncEnd ( { data, didRefresh } : { data : any , didRefresh : boolean } ) {
336339 const operationId = data . toString ( ) ;
337340 const promiseHandler = this . operationPromises [ operationId ] ;
338341
339342 if ( promiseHandler ) {
340- promiseHandler . resolve ( operationId ) ;
343+ promiseHandler . resolve ( { operationId, didRefresh } ) ;
341344 delete this . operationPromises [ operationId ] ;
342345 }
343346 }
0 commit comments