Skip to content

feat: new syncChangedDataOnDevices #5772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/controllers/prepare-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class PrepareController extends EventEmitter {
data.platform.toLowerCase() === platformData.platformNameLowerCase
) {
if (this.isFileWatcherPaused()) return;
this.emitPrepareEvent({ ...data, hasNativeChanges: false });
this.emitPrepareEvent({ ...data, files: data.files || [], hasNativeChanges: false });
}
};

Expand Down
15 changes: 12 additions & 3 deletions lib/controllers/run-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as util from "util";
import * as _ from "lodash";
import { IProjectDataService, IProjectData } from "../definitions/project";
import { IBuildController } from "../definitions/build";
import { IPlatformsDataService } from "../definitions/platform";
import { IPlatformData, IPlatformsDataService } from "../definitions/platform";
import { IDebugController } from "../definitions/debug";
import { IPluginsService } from "../definitions/plugins";
import {
Expand All @@ -23,6 +23,7 @@ import {
} from "../common/declarations";
import { IInjector } from "../common/definitions/yok";
import { injector } from "../common/yok";
import { hook } from "../common/helpers";

export class RunController extends EventEmitter implements IRunController {
private prepareReadyEventHandler: any = null;
Expand Down Expand Up @@ -95,17 +96,23 @@ export class RunController extends EventEmitter implements IRunController {
const changesInfo = await this.$projectChangesService.checkForChanges(
platformData,
projectData,
prepareData
prepareData,
data
);
if (changesInfo.hasChanges) {
await this.syncChangedDataOnDevices(
data,
projectData,
platformData,
liveSyncInfo
);
}
} else {
await this.syncChangedDataOnDevices(data, projectData, liveSyncInfo);
const platformData = this.$platformsDataService.getPlatformData(
data.platform,
projectData
);
await this.syncChangedDataOnDevices(data, projectData, platformData, liveSyncInfo);
}
};

Expand Down Expand Up @@ -623,9 +630,11 @@ export class RunController extends EventEmitter implements IRunController {
);
}

@hook("syncChangedDataOnDevices")
private async syncChangedDataOnDevices(
data: IFilesChangeEventData,
projectData: IProjectData,
platformData: IPlatformData,
liveSyncInfo: ILiveSyncInfo
): Promise<void> {
const successfullySyncedMessageFormat = `Successfully synced application %s on device %s.`;
Expand Down
3 changes: 2 additions & 1 deletion lib/services/project-changes-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export class ProjectChangesService implements IProjectChangesService {
public async checkForChanges(
platformData: IPlatformData,
projectData: IProjectData,
prepareData: IPrepareData
prepareData: IPrepareData,
filesChangedData?: IFilesChangeEventData
): Promise<IProjectChangesInfo> {
this._changesInfo = new ProjectChangesInfo();
const isNewPrepareInfo = await this.ensurePrepareInfo(
Expand Down
3 changes: 2 additions & 1 deletion lib/services/webpack/webpack.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ declare global {
checkForChanges(
platformData: IPlatformData,
projectData: IProjectData,
prepareData: IPrepareData
prepareData: IPrepareData,
filesChangedData?: IFilesChangeEventData
): Promise<IProjectChangesInfo>;
getPrepareInfoFilePath(platformData: IPlatformData): string;
getPrepareInfo(platformData: IPlatformData): IPrepareInfo;
Expand Down