Skip to content

Commit 95d6d94

Browse files
Disable fast livesync with hook
Add before livesync hook to be able to control the livesync data. Added property in livesync service to force full sync which will be passed to the livesync data.
1 parent 13d64dd commit 95d6d94

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

lib/declarations.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ interface IOpener {
5656

5757
interface ILiveSyncService {
5858
liveSync(platform: string): IFuture<void>;
59+
forceExecuteFullSync: boolean;
5960
}
6061

6162
interface IOptions extends ICommonOptions {

lib/services/livesync/livesync-service.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"use strict";
33

44
import * as constants from "../../constants";
5+
import * as helpers from "../../common/helpers";
56
import * as path from "path";
67
import * as semver from "semver";
78

89
class LiveSyncService implements ILiveSyncService {
10+
public forceExecuteFullSync = false;
911
private _isInitialized = false;
1012

1113
constructor(private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
@@ -15,7 +17,8 @@ class LiveSyncService implements ILiveSyncService {
1517
private $platformService: IPlatformService,
1618
private $projectData: IProjectData,
1719
private $projectDataService: IProjectDataService,
18-
private $prompter: IPrompter) { }
20+
private $prompter: IPrompter,
21+
private $injector: IInjector) { }
1922

2023
private ensureAndroidFrameworkVersion(platformData: IPlatformData): IFuture<void> { // TODO: this can be moved inside command or canExecute function
2124
return (() => {
@@ -50,15 +53,22 @@ class LiveSyncService implements ILiveSyncService {
5053

5154
this._isInitialized = true; // If we want before-prepare hooks to work properly, this should be set after preparePlatform function
5255

53-
let platformData = this.$platformsData.getPlatformData(platformLowerCase);
54-
this.ensureAndroidFrameworkVersion(platformData).wait();
56+
this.liveSyncCore(platform).wait();
57+
}).future<void>()();
58+
}
5559

60+
@helpers.hook('livesync')
61+
private liveSyncCore(platform: string): IFuture<void> {
62+
return (() => {
63+
let platformData = this.$platformsData.getPlatformData(platform.toLowerCase());
64+
this.ensureAndroidFrameworkVersion(platformData).wait();
5665
let liveSyncData: ILiveSyncData = {
5766
platform: platform,
58-
appIdentifier: this.$projectData.projectId,
67+
appIdentifier: this.$projectData.projectId,
5968
projectFilesPath: path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME),
6069
syncWorkingDirectory: path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME),
61-
excludedProjectDirsAndFiles: constants.LIVESYNC_EXCLUDED_FILE_PATTERNS
70+
excludedProjectDirsAndFiles: constants.LIVESYNC_EXCLUDED_FILE_PATTERNS,
71+
forceExecuteFullSync: this.forceExecuteFullSync
6272
};
6373
this.$liveSyncServiceBase.sync(liveSyncData).wait();
6474
}).future<void>()();

0 commit comments

Comments
 (0)