Skip to content

Commit 306dac0

Browse files
Merge branch 'master' into issue-3020
2 parents 81aec57 + 81488de commit 306dac0

File tree

3 files changed

+41
-10
lines changed

3 files changed

+41
-10
lines changed

lib/services/ios-project-service.ts

+19
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
330330
handler,
331331
this.buildForSimulator(projectRoot, basicArgs, projectData, buildConfig.buildOutputStdio));
332332
}
333+
334+
this.validateApplicationIdentifier(projectData);
333335
}
334336

335337
public async validatePlugins(projectData: IProjectData): Promise<void> {
@@ -1339,6 +1341,23 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
13391341
"Distribution": "app-store",
13401342
"Enterprise": "enterprise"
13411343
}[provision.Type];
1344+
}
1345+
1346+
private validateApplicationIdentifier(projectData: IProjectData): void {
1347+
const projectDir = projectData.projectDir;
1348+
const infoPlistPath = path.join(projectDir, constants.APP_FOLDER_NAME, constants.APP_RESOURCES_FOLDER_NAME, this.getPlatformData(projectData).normalizedPlatformName, this.getPlatformData(projectData).configurationFileName);
1349+
const mergedPlistPath = this.getPlatformData(projectData).configurationFilePath;
1350+
1351+
if (!this.$fs.exists(infoPlistPath) || !this.$fs.exists(mergedPlistPath)) {
1352+
return;
1353+
}
1354+
1355+
const infoPlist = plist.parse(this.$fs.readText(infoPlistPath));
1356+
const mergedPlist = plist.parse(this.$fs.readText(mergedPlistPath));
1357+
1358+
if (infoPlist.CFBundleIdentifier && infoPlist.CFBundleIdentifier !== mergedPlist.CFBundleIdentifier) {
1359+
this.$logger.warnWithLabel("The CFBundleIdentifier key inside the 'Info.plist' will be overriden by the 'id' inside 'package.json'.");
1360+
}
13421361
}
13431362
}
13441363

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

+21-9
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,25 @@ export class AndroidDeviceLiveSyncService extends DeviceLiveSyncServiceBase impl
3636
`${deviceProjectRootDirname}/sync`]
3737
);
3838

39+
await this.reloadResources(deviceAppData, localToDevicePaths);
40+
3941
const canExecuteFastSync = !liveSyncInfo.isFullSync && !_.some(localToDevicePaths,
4042
(localToDevicePath: Mobile.ILocalToDevicePathData) => !this.canExecuteFastSync(localToDevicePath.getLocalPath(), projectData, this.device.deviceInfo.platform));
4143

42-
if (canExecuteFastSync) {
43-
return this.reloadPage(deviceAppData, localToDevicePaths);
44+
if (!canExecuteFastSync) {
45+
return this.restartApplication(deviceAppData);
4446
}
47+
}
48+
49+
private async cleanLivesyncDirectories(deviceAppData: Mobile.IDeviceAppData): Promise<void> {
50+
const deviceRootPath = await this.$devicePathProvider.getDeviceProjectRootPath(deviceAppData.device, {
51+
appIdentifier: deviceAppData.appIdentifier,
52+
getDirname: true
53+
});
4554

46-
return this.restartApplication(deviceAppData);
55+
await this.device.adb.executeShellCommand(["rm", "-rf", await this.$mobileHelper.buildDevicePath(deviceRootPath, LiveSyncPaths.FULLSYNC_DIR_NAME),
56+
this.$mobileHelper.buildDevicePath(deviceRootPath, LiveSyncPaths.SYNC_DIR_NAME),
57+
await this.$mobileHelper.buildDevicePath(deviceRootPath, LiveSyncPaths.REMOVEDSYNC_DIR_NAME)]);
4758
}
4859

4960
private async restartApplication(deviceAppData: Mobile.IDeviceAppData): Promise<void> {
@@ -70,15 +81,16 @@ export class AndroidDeviceLiveSyncService extends DeviceLiveSyncServiceBase impl
7081
await this.device.adb.executeShellCommand(["rm", "-f", deviceRootPath]);
7182
}
7283

73-
this.device.adb.executeShellCommand(["rm", "-rf", this.$mobileHelper.buildDevicePath(deviceRootPath, LiveSyncPaths.FULLSYNC_DIR_NAME),
74-
this.$mobileHelper.buildDevicePath(deviceRootPath, LiveSyncPaths.SYNC_DIR_NAME),
75-
await this.$mobileHelper.buildDevicePath(deviceRootPath, LiveSyncPaths.REMOVEDSYNC_DIR_NAME)]);
84+
await this.cleanLivesyncDirectories(deviceAppData);
7685
}
7786

78-
private async reloadPage(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): Promise<void> {
87+
private async reloadResources(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): Promise<void> {
7988
await this.device.adb.executeCommand(["forward", `tcp:${AndroidDeviceLiveSyncService.BACKEND_PORT.toString()}`, `localabstract:${deviceAppData.appIdentifier}-livesync`]);
80-
if (!await this.sendPageReloadMessage()) {
81-
await this.restartApplication(deviceAppData);
89+
90+
if (await this.sendPageReloadMessage()) {
91+
await this.cleanLivesyncDirectories(deviceAppData);
92+
} else {
93+
await this.restartApplication(deviceAppData); //in case runtime socket error/close
8294
}
8395
}
8496

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export abstract class PlatformLiveSyncServiceBase {
9191
modifiedLocalToDevicePaths.push(...localToDevicePaths);
9292

9393
const deviceLiveSyncService = this.getDeviceLiveSyncService(device, projectData.projectId);
94-
deviceLiveSyncService.removeFiles(deviceAppData, localToDevicePaths);
94+
await deviceLiveSyncService.removeFiles(deviceAppData, localToDevicePaths);
9595
}
9696

9797
return {

0 commit comments

Comments
 (0)