Skip to content

Commit 73ee306

Browse files
committed
chore: rename deviceInstallAppService and deviceRefreshAppService so the same convention is used for both classes
1 parent 0e4109b commit 73ee306

File tree

6 files changed

+21
-26
lines changed

6 files changed

+21
-26
lines changed

lib/bootstrap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ $injector.require("platformValidationService", "./services/platform/platform-val
4141
$injector.require("platformCommandsService", "./services/platform/platform-commands-service");
4242
$injector.require("platformWatcherService", "./services/platform/platform-watcher-service");
4343

44-
$injector.require("deviceInstallationService", "./services/device/device-installation-service");
45-
$injector.require("deviceRefreshApplicationService", "./services/device/device-refresh-application-service");
44+
$injector.require("deviceInstallAppService", "./services/device/device-install-app-service");
45+
$injector.require("deviceRefreshAppService", "./services/device/device-refresh-app-service");
4646

4747
$injector.require("workflowDataService", "./services/workflow/workflow-data-service");
4848

lib/controllers/main-controller.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { INITIAL_SYNC_EVENT_NAME, FILES_CHANGE_EVENT_NAME, LiveSyncEvents } from "../constants";
2-
import { WorkflowDataService } from "../services/workflow/workflow-data-service";
31
import { AddPlatformService } from "../services/platform/add-platform-service";
42
import { BuildPlatformService } from "../services/platform/build-platform-service";
5-
import { PreparePlatformService } from "../services/platform/prepare-platform-service";
3+
import { DeviceInstallAppService } from "../services/device/device-install-app-service";
4+
import { DeviceRefreshAppService } from "../services/device/device-refresh-app-service";
65
import { EventEmitter } from "events";
7-
import { DeviceRefreshApplicationService } from "../services/device/device-refresh-application-service";
6+
import { FILES_CHANGE_EVENT_NAME, INITIAL_SYNC_EVENT_NAME, LiveSyncEvents } from "../constants";
7+
import { PreparePlatformService } from "../services/platform/prepare-platform-service";
8+
import { WorkflowDataService } from "../services/workflow/workflow-data-service";
89

910
const deviceDescriptorPrimaryKey = "identifier";
1011

@@ -14,8 +15,8 @@ export class MainController extends EventEmitter {
1415
constructor(
1516
private $addPlatformService: AddPlatformService,
1617
private $buildPlatformService: BuildPlatformService,
17-
private $deviceInstallationService: IDeviceInstallationService,
18-
private $deviceRefreshApplicationService: DeviceRefreshApplicationService,
18+
private $deviceInstallAppService: DeviceInstallAppService,
19+
private $deviceRefreshAppService: DeviceRefreshAppService,
1920
private $devicesService: Mobile.IDevicesService,
2021
private $errors: IErrors,
2122
private $hooksService: IHooksService,
@@ -55,7 +56,7 @@ export class MainController extends EventEmitter {
5556
const executeAction = async (device: Mobile.IDevice) => {
5657
const { nativePlatformData, projectData, buildPlatformData } = this.$workflowDataService.createWorkflowData(device.deviceInfo.platform, projectDir, liveSyncInfo);
5758
await this.$buildPlatformService.buildPlatformIfNeeded(nativePlatformData, projectData, buildPlatformData);
58-
await this.$deviceInstallationService.installOnDeviceIfNeeded(device, nativePlatformData, projectData, buildPlatformData);
59+
await this.$deviceInstallAppService.installOnDeviceIfNeeded(device, nativePlatformData, projectData, buildPlatformData);
5960
};
6061

6162
await this.$devicesService.execute(executeAction, (device: Mobile.IDevice) => true);
@@ -110,14 +111,14 @@ export class MainController extends EventEmitter {
110111
const outputPath = deviceDescriptor.outputPath || platformData.getBuildOutputPath(buildPlatformData);
111112
const packageFilePath = await this.$buildPlatformService.buildPlatformIfNeeded(platformData, projectData, buildPlatformData, outputPath);
112113

113-
await this.$deviceInstallationService.installOnDeviceIfNeeded(device, platformData, projectData, buildPlatformData, packageFilePath, outputPath);
114+
await this.$deviceInstallAppService.installOnDeviceIfNeeded(device, platformData, projectData, buildPlatformData, packageFilePath, outputPath);
114115

115116
// TODO: Consider to improve this
116117
const platformLiveSyncService = this.getLiveSyncService(platformData.platformNameLowerCase);
117118
const { force, useHotModuleReload, skipWatcher } = liveSyncInfo;
118119
const liveSyncResultInfo = await platformLiveSyncService.fullSync({ force, useHotModuleReload, projectData, device, watch: !skipWatcher, liveSyncDeviceInfo: deviceDescriptor });
119120

120-
await this.$deviceRefreshApplicationService.refreshApplication(deviceDescriptor, projectData, liveSyncResultInfo, platformLiveSyncService, this);
121+
await this.$deviceRefreshAppService.refreshApplication(deviceDescriptor, projectData, liveSyncResultInfo, platformLiveSyncService, this);
121122
} catch (err) {
122123
this.$logger.warn(`Unable to apply changes on device: ${device.deviceInfo.identifier}. Error is: ${err.message}.`);
123124

@@ -213,7 +214,7 @@ export class MainController extends EventEmitter {
213214
connectTimeout: 1000
214215
});
215216

216-
await this.$deviceRefreshApplicationService.refreshApplication(deviceDescriptor, projectData, liveSyncResultInfo, platformLiveSyncService, this);
217+
await this.$deviceRefreshAppService.refreshApplication(deviceDescriptor, projectData, liveSyncResultInfo, platformLiveSyncService, this);
217218
}
218219

219220
public getLiveSyncDeviceDescriptors(projectDir: string): ILiveSyncDeviceInfo[] {

lib/services/device/device-installation-service.ts renamed to lib/services/device/device-install-app-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { BuildPlatformService } from "../platform/build-platform-service";
66

77
const buildInfoFileName = ".nsbuildinfo";
88

9-
export class DeviceInstallationService implements IDeviceInstallationService {
9+
export class DeviceInstallAppService {
1010
constructor(
1111
private $analyticsService: IAnalyticsService,
1212
private $buildArtefactsService: IBuildArtefactsService,
@@ -109,4 +109,4 @@ export class DeviceInstallationService implements IDeviceInstallationService {
109109
}
110110
}
111111
}
112-
$injector.register("deviceInstallationService", DeviceInstallationService);
112+
$injector.register("deviceInstallAppService", DeviceInstallAppService);

lib/services/device/device-refresh-application-service.ts renamed to lib/services/device/device-refresh-app-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { EventEmitter } from "events";
33
import { DEBUGGER_DETACHED_EVENT_NAME, USER_INTERACTION_NEEDED_EVENT_NAME, LiveSyncEvents, DEBUGGER_ATTACHED_EVENT_NAME } from "../../constants";
44
import { EOL } from "os";
55

6-
export class DeviceRefreshApplicationService {
6+
export class DeviceRefreshAppService {
77

88
constructor(
99
// private $buildArtefactsService: IBuildArtefactsService,
@@ -177,4 +177,4 @@ export class DeviceRefreshApplicationService {
177177
}
178178
}
179179
}
180-
$injector.register("deviceRefreshApplicationService", DeviceRefreshApplicationService);
180+
$injector.register("deviceRefreshAppService", DeviceRefreshAppService);

lib/services/webpack/webpack.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ declare global {
4040
hasNativeChanges: boolean;
4141
}
4242

43-
interface IDeviceInstallationService {
44-
installOnDevice(device: Mobile.IDevice, platformData: IPlatformData, projectData: IProjectData, buildConfig: IBuildConfig, packageFile?: string, outputFilePath?: string): Promise<void>;
45-
installOnDeviceIfNeeded(device: Mobile.IDevice, platformData: IPlatformData, projectData: IProjectData, buildConfig: IBuildConfig, packageFile?: string, outputFilePath?: string): Promise<void>;
46-
getDeviceBuildInfoFilePath(device: Mobile.IDevice, projectData: IProjectData): Promise<string>;
47-
}
48-
4943
interface IDeviceRestartApplicationService {
5044
restartOnDevice(deviceDescriptor: ILiveSyncDeviceInfo, projectData: IProjectData, liveSyncResultInfo: ILiveSyncResultInfo, platformLiveSyncService: IPlatformLiveSyncService): Promise<IRestartApplicationInfo | IDebugInformation>;
5145
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ describe("MainController", () => {
134134
actualAddedPlatforms.push(platformData);
135135
};
136136

137-
const bundleWorkflowService: IBundleWorkflowService = injector.resolve("bundleWorkflowService");
138-
await bundleWorkflowService.runPlatform(projectDir, testCase.connectedDevices, liveSyncInfo);
137+
const mainController = injector.resolve("mainController");
138+
await mainController.runPlatform(projectDir, testCase.connectedDevices, liveSyncInfo);
139139

140140
assert.deepEqual(actualAddedPlatforms.map(pData => pData.platformNameLowerCase), testCase.expectedAddedPlatforms);
141141
});
@@ -165,8 +165,8 @@ describe("MainController", () => {
165165
// const platformWatcherService: IPlatformWatcherService = injector.resolve("platformWatcherService");
166166
// platformWatcherService.emit(INITIAL_SYNC_EVENT_NAME, { platform, hasNativeChanges: true });
167167

168-
// const bundleWorkflowService: IBundleWorkflowService = injector.resolve("bundleWorkflowService");
169-
// await bundleWorkflowService.start(projectDir, [iOSDeviceDescriptor], liveSyncInfo);
168+
// const mainController: MainController = injector.resolve("mainController");
169+
// await mainController.start(projectDir, [iOSDeviceDescriptor], liveSyncInfo);
170170

171171
// assert.isTrue(isBuildPlatformCalled);
172172
// });

0 commit comments

Comments
 (0)