Skip to content

Commit a797a29

Browse files
committed
fix: don't call refresh if we will restart
1 parent 9253bbe commit a797a29

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

lib/definitions/livesync.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ interface IAndroidNativeScriptDeviceLiveSyncService extends INativeScriptDeviceL
394394
* @param {ILiveSyncResultInfo} liveSyncInfo Describes the LiveSync operation - for which project directory is the operation and other settings.
395395
* @return {Promise<IAndroidLiveSyncResultInfo>}
396396
*/
397-
finalizeSync(liveSyncInfo: ILiveSyncResultInfo): Promise<IAndroidLiveSyncResultInfo>;
397+
finalizeSync(liveSyncInfo: ILiveSyncResultInfo, projectData: IProjectData): Promise<IAndroidLivesyncSyncOperationResult>;
398398
}
399399

400400
interface IAndroidLivesyncTool {

lib/services/livesync/android-device-livesync-sockets-service.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,23 @@ export class AndroidDeviceSocketsLiveSyncService extends DeviceLiveSyncServiceBa
3939
return `${LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${appIdentifier}-livesync-in-progress`;
4040
}
4141

42-
public async finalizeSync(liveSyncInfo: ILiveSyncResultInfo): Promise<any> {
42+
public async finalizeSync(liveSyncInfo: ILiveSyncResultInfo, projectData: IProjectData): Promise<IAndroidLivesyncSyncOperationResult> {
4343
try {
44-
const result = await this.doSync(liveSyncInfo);
44+
const result = await this.doSync(liveSyncInfo, projectData);
4545
return result;
4646
} finally {
4747
this.livesyncTool.end();
4848
}
4949
}
5050

51-
private async doSync(liveSyncInfo: ILiveSyncResultInfo): Promise<IAndroidLivesyncSyncOperationResult> {
51+
private async doSync(liveSyncInfo: ILiveSyncResultInfo, projectData: IProjectData): Promise<IAndroidLivesyncSyncOperationResult> {
5252
const operationId = this.livesyncTool.generateOperationIdentifier();
5353

5454
let result = { operationId, didRefresh: true };
5555

5656
if (liveSyncInfo.modifiedFilesData.length) {
57-
58-
const doSyncPromise = this.livesyncTool.sendDoSyncOperation(true, null, operationId);
57+
const canExecuteFastSync = !liveSyncInfo.isFullSync && this.canExecuteFastSyncForPaths(liveSyncInfo.modifiedFilesData, projectData, this.device.deviceInfo.platform);
58+
const doSyncPromise = this.livesyncTool.sendDoSyncOperation(canExecuteFastSync, null, operationId);
5959

6060
const syncInterval: NodeJS.Timer = setInterval(() => {
6161
if (this.livesyncTool.isOperationInProgress(operationId)) {

lib/services/livesync/android-livesync-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class AndroidLiveSyncService extends PlatformLiveSyncServiceBase implemen
3939

4040
private async finalizeSync(device: Mobile.IDevice, projectData: IProjectData, liveSyncResult: ILiveSyncResultInfo): Promise<IAndroidLiveSyncResultInfo> {
4141
const liveSyncService = <IAndroidNativeScriptDeviceLiveSyncService>this.getDeviceLiveSyncService(device, projectData);
42-
const finalizeResult = await liveSyncService.finalizeSync(liveSyncResult);
42+
const finalizeResult = await liveSyncService.finalizeSync(liveSyncResult, projectData);
4343
const result = _.extend(liveSyncResult, finalizeResult);
4444
return result;
4545
}

lib/services/livesync/device-livesync-service-base.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ export abstract class DeviceLiveSyncServiceBase {
3939
return transferredFiles;
4040
}
4141

42-
public async finalizeSync(liveSyncInfo: ILiveSyncResultInfo): Promise<any> {
42+
public async finalizeSync(liveSyncInfo: ILiveSyncResultInfo, projectData: IProjectData): Promise<IAndroidLivesyncSyncOperationResult> {
4343
//implement in case a sync point for all remove/create operation is needed
44+
return {
45+
didRefresh:true,
46+
operationId: ""
47+
};
4448
}
4549
}

0 commit comments

Comments
 (0)