Skip to content

Commit 92d6d45

Browse files
FatmeFatme
Fatme
authored and
Fatme
committed
Merge pull request #1230 from NativeScript/fatme/fix-livesync-emulator
Fix livesync --emulator when the app is not installed on the iOS simulator
2 parents db97db7 + f9926b2 commit 92d6d45

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lib/services/test-execution-service.ts

+7
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ class TestExecutionService implements ITestExecutionService {
9595

9696
let localProjectRootPath = platform.toLowerCase() === "ios" ? platformData.appDestinationDirectoryPath : null;
9797

98+
let getApplicationPathForiOSSimulatorAction = (): IFuture<string> => {
99+
return (() => {
100+
return this.$platformService.getLatestApplicationPackageForEmulator(platformData).wait().packageName;
101+
}).future<string>()();
102+
};
103+
98104
let liveSyncData = {
99105
platform: platform,
100106
appIdentifier: this.$projectData.projectId,
@@ -104,6 +110,7 @@ class TestExecutionService implements ITestExecutionService {
104110
platformSpecificLiveSyncServices: platformSpecificLiveSyncServices,
105111
notInstalledAppOnDeviceAction: notInstalledAppOnDeviceAction,
106112
notRunningiOSSimulatorAction: notRunningiOSSimulatorAction,
113+
getApplicationPathForiOSSimulatorAction: getApplicationPathForiOSSimulatorAction,
107114
localProjectRootPath: localProjectRootPath,
108115
beforeBatchLiveSyncAction: beforeBatchLiveSyncAction,
109116
shouldRestartApplication: (localToDevicePaths: Mobile.ILocalToDevicePathData[]) => Future.fromResult(!this.$options.debugBrk),

lib/services/usb-livesync-service.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
8383

8484
let beforeBatchLiveSyncAction = (filePath: string): IFuture<string> => {
8585
return (() => {
86-
let projectFileInfo = this.getProjectFileInfo(filePath);
86+
let projectFileInfo = this.getProjectFileInfo(filePath, platform);
8787
let mappedFilePath = path.join(projectFilesPath, path.relative(path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME), projectFileInfo.onDeviceName));
8888

8989
// Handle files that are in App_Resources/<platform>
@@ -148,6 +148,12 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
148148
});
149149
};
150150

151+
let getApplicationPathForiOSSimulatorAction = (): IFuture<string> => {
152+
return (() => {
153+
return this.$platformService.getLatestApplicationPackageForEmulator(platformData).wait().packageName;
154+
}).future<string>()();
155+
};
156+
151157
let liveSyncData = {
152158
platform: platform,
153159
appIdentifier: this.$projectData.projectId,
@@ -157,6 +163,7 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
157163
platformSpecificLiveSyncServices: platformSpecificLiveSyncServices,
158164
notInstalledAppOnDeviceAction: notInstalledAppOnDeviceAction,
159165
notRunningiOSSimulatorAction: notRunningiOSSimulatorAction,
166+
getApplicationPathForiOSSimulatorAction: getApplicationPathForiOSSimulatorAction,
160167
localProjectRootPath: localProjectRootPath,
161168
beforeLiveSyncAction: beforeLiveSyncAction,
162169
beforeBatchLiveSyncAction: beforeBatchLiveSyncAction,

0 commit comments

Comments
 (0)