Skip to content

Commit b728011

Browse files
chore: move deviceEmitter and deviceLogProvider out of appbuilder dir
Move deviceEmitter out of appbuilder dir. Also remove all `companion` related services as they are not required anymore. Move the device-log-provider out of appbuilder dir. The purpose of the file is to be used instead of the original deviceLogProvider when CLI is used as a library. This provider emits the device logs instead of writing them on the stdout. To separate the two log providers, rename the one coming from appbuilder dir to `device-log-emitter`. Keep the registration in the `$injector` to be `deviceLogProvider` as it is the only way to keep the current behavior when CLI is used as a library.
1 parent f11bf51 commit b728011

17 files changed

+23
-423
lines changed

lib/common/appbuilder/appbuilder-bootstrap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ $injector.require("liveSyncServiceBase", "./services/livesync-service-base");
66
$injector.require("androidLiveSyncServiceLocator", "./appbuilder/services/livesync/android-livesync-service");
77
$injector.require("iosLiveSyncServiceLocator", "./appbuilder/services/livesync/ios-livesync-service");
88
$injector.require("deviceAppDataProvider", "./appbuilder/providers/device-app-data-provider");
9-
$injector.requirePublic("companionAppsService", "./appbuilder/services/livesync/companion-apps-service");
109
$injector.require("nativeScriptProjectCapabilities", "./appbuilder/project/nativescript-project-capabilities");
1110
$injector.require("cordovaProjectCapabilities", "./appbuilder/project/cordova-project-capabilities");
1211
$injector.require("mobilePlatformsCapabilities", "./appbuilder/mobile-platforms-capabilities");

lib/common/appbuilder/declarations.d.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -231,26 +231,6 @@ interface IAppInstalledInfo extends ILiveSyncSupportedInfo {
231231
isInstalled: boolean;
232232
}
233233

234-
/**
235-
* Describes information about Telerik Companion Apps.
236-
*/
237-
interface ICompanionAppsService {
238-
/**
239-
* Returns application identifier of the companion app for specified platform and framework.
240-
* @param {string} framework The framework for which Companion app identfier should be checked. Valid values are cordova and nativescript
241-
* @param {string} platform The device platform. Valid values are android, ios and wp8.
242-
* @return {string} Companion appIdentifier or null.
243-
*/
244-
getCompanionAppIdentifier(framework: string, platform: string): string;
245-
246-
/**
247-
* Returns all companion application identifiers in a dictionary where the top level keys are framwork identifiers.
248-
* For each framework there are three values, specified in a dictionary. The keys of the dictionary are platforms (android, ios and wp8).
249-
* @return {IDictionary<IStringDictionary>} Companion appIdentifiers separated in different properties of object.
250-
*/
251-
getAllCompanionAppIdentifiers(): IDictionary<IStringDictionary>;
252-
}
253-
254234
/**
255235
* Describes information for single npm dependency that has to be installed.
256236
*/

lib/common/appbuilder/mobile/appbuilder-companion-device-app-data-base.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

lib/common/appbuilder/proton-bootstrap.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ $injector.require("messages", "./messages/messages");
44
$injector.register("config", {});
55
// Proton will track the features and exceptions, so no need of analyticsService here.
66
$injector.register("analyiticsService", {});
7-
$injector.requirePublicClass("deviceEmitter", "./appbuilder/device-emitter");
8-
$injector.requirePublicClass("deviceLogProvider", "./appbuilder/device-log-provider");
97
import { installUncaughtExceptionListener } from "../errors";
108
installUncaughtExceptionListener();
119

lib/common/appbuilder/providers/device-app-data-provider.ts

Lines changed: 5 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import * as path from "path";
22
import * as util from "util";
33
import { AppBuilderDeviceAppDataBase } from "../mobile/appbuilder-device-app-data-base";
4-
import { AppBuilderCompanionDeviceAppDataBase } from "../mobile/appbuilder-companion-device-app-data-base";
5-
import { LiveSyncConstants, TARGET_FRAMEWORK_IDENTIFIERS } from "../../constants";
4+
import { LiveSyncConstants } from "../../constants";
65
import { cache } from "../../decorators";
76

87
export class AndroidAppIdentifier extends AppBuilderDeviceAppDataBase implements ILiveSyncDeviceAppData {
@@ -45,50 +44,6 @@ export class AndroidAppIdentifier extends AppBuilderDeviceAppDataBase implements
4544
}
4645
}
4746

48-
export class AndroidCompanionAppIdentifier extends AppBuilderCompanionDeviceAppDataBase implements ILiveSyncDeviceAppData {
49-
constructor(device: Mobile.IDevice,
50-
platform: string,
51-
$deployHelper: IDeployHelper,
52-
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
53-
$companionAppsService: ICompanionAppsService) {
54-
super($companionAppsService.getCompanionAppIdentifier(TARGET_FRAMEWORK_IDENTIFIERS.Cordova, platform), device, platform, $deployHelper);
55-
}
56-
57-
public async getDeviceProjectRootPath(): Promise<string> {
58-
return this._getDeviceProjectRootPath(util.format(LiveSyncConstants.DEVICE_TMP_DIR_FORMAT_V3, this.appIdentifier));
59-
}
60-
61-
public get liveSyncFormat(): string {
62-
return "icenium://%s?token=%s&appId=%s&configuration=%s";
63-
}
64-
65-
protected getCompanionAppName(): string {
66-
return "companion app";
67-
}
68-
}
69-
70-
export class AndroidNativeScriptCompanionAppIdentifier extends AppBuilderCompanionDeviceAppDataBase implements ILiveSyncDeviceAppData {
71-
constructor(device: Mobile.IDevice,
72-
platform: string,
73-
$deployHelper: IDeployHelper,
74-
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
75-
$companionAppsService: ICompanionAppsService) {
76-
super($companionAppsService.getCompanionAppIdentifier(TARGET_FRAMEWORK_IDENTIFIERS.NativeScript, platform), device, platform, $deployHelper);
77-
}
78-
79-
public async getDeviceProjectRootPath(): Promise<string> {
80-
return util.format(LiveSyncConstants.DEVICE_TMP_DIR_FORMAT_V3, this.appIdentifier);
81-
}
82-
83-
public get liveSyncFormat(): string {
84-
return "nativescript://%s?token=%s&appId=%s&configuration=%s";
85-
}
86-
87-
protected getCompanionAppName(): string {
88-
return "NativeScript companion app";
89-
}
90-
}
91-
9247
export class IOSAppIdentifier extends AppBuilderDeviceAppDataBase implements ILiveSyncDeviceAppData {
9348
constructor(_appIdentifier: string,
9449
device: Mobile.IDevice,
@@ -135,111 +90,25 @@ export class IOSNativeScriptAppIdentifier extends AppBuilderDeviceAppDataBase im
13590
}
13691
}
13792

138-
export class IOSCompanionAppIdentifier extends AppBuilderCompanionDeviceAppDataBase implements ILiveSyncDeviceAppData {
139-
constructor(device: Mobile.IDevice,
140-
platform: string,
141-
$deployHelper: IDeployHelper,
142-
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
143-
$companionAppsService: ICompanionAppsService) {
144-
super($companionAppsService.getCompanionAppIdentifier(TARGET_FRAMEWORK_IDENTIFIERS.Cordova, platform), device, platform, $deployHelper);
145-
}
146-
147-
public async getDeviceProjectRootPath(): Promise<string> {
148-
return LiveSyncConstants.IOS_PROJECT_PATH;
149-
}
150-
151-
public get liveSyncFormat(): string {
152-
return "icenium://%s?LiveSyncToken=%s&appId=%s&configuration=%s";
153-
}
154-
155-
protected getCompanionAppName(): string {
156-
return "companion app";
157-
}
158-
}
159-
160-
export class IOSNativeScriptCompanionAppIdentifier extends AppBuilderCompanionDeviceAppDataBase implements ILiveSyncDeviceAppData {
161-
constructor(device: Mobile.IDevice,
162-
platform: string,
163-
$deployHelper: IDeployHelper,
164-
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
165-
$companionAppsService: ICompanionAppsService) {
166-
super($companionAppsService.getCompanionAppIdentifier(TARGET_FRAMEWORK_IDENTIFIERS.NativeScript, platform), device, platform, $deployHelper);
167-
}
168-
169-
public async getDeviceProjectRootPath(): Promise<string> {
170-
return LiveSyncConstants.IOS_PROJECT_PATH;
171-
}
172-
173-
public get liveSyncFormat(): string {
174-
return "nativescript://%s?LiveSyncToken=%s&appId=%s&configuration=%s";
175-
}
176-
177-
protected getCompanionAppName(): string {
178-
return "NativeScript companion app";
179-
}
180-
}
181-
182-
export class WP8CompanionAppIdentifier extends AppBuilderCompanionDeviceAppDataBase implements ILiveSyncDeviceAppData {
183-
constructor(device: Mobile.IDevice,
184-
$deployHelper: IDeployHelper,
185-
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
186-
public platform: string,
187-
$companionAppsService: ICompanionAppsService) {
188-
super($companionAppsService.getCompanionAppIdentifier(TARGET_FRAMEWORK_IDENTIFIERS.Cordova, platform), device, platform, $deployHelper);
189-
}
190-
191-
public async getDeviceProjectRootPath(): Promise<string> {
192-
return ""; // this is used only on Android for Lollipop
193-
}
194-
195-
public get liveSyncFormat(): string {
196-
return "%s/Mist/MobilePackage/redirect?token=%s&appId=%s&configuration=%s";
197-
}
198-
199-
public encodeLiveSyncHostUri(hostUri: string): string {
200-
return hostUri;
201-
}
202-
203-
public async isLiveSyncSupported(): Promise<boolean> {
204-
return true;
205-
}
206-
207-
public getLiveSyncNotSupportedError(): string {
208-
return "";
209-
}
210-
211-
protected getCompanionAppName(): string {
212-
return "companion app";
213-
}
214-
}
215-
21693
export class DeviceAppDataProvider implements Mobile.IDeviceAppDataProvider {
21794
constructor(private $project: any) { }
21895

21996
public createFactoryRules(): IDictionary<Mobile.IDeviceAppDataFactoryRule> {
22097
const rules: IDictionary<IDictionary<Mobile.IDeviceAppDataFactoryRule>> = {
22198
Cordova: {
22299
Android: {
223-
vanilla: AndroidAppIdentifier,
224-
companion: AndroidCompanionAppIdentifier
100+
vanilla: AndroidAppIdentifier
225101
},
226102
iOS: {
227-
vanilla: IOSAppIdentifier,
228-
companion: IOSCompanionAppIdentifier
229-
},
230-
WP8: {
231-
vanilla: "",
232-
companion: WP8CompanionAppIdentifier
103+
vanilla: IOSAppIdentifier
233104
}
234105
},
235106
NativeScript: {
236107
Android: {
237-
vanilla: AndroidAppIdentifier,
238-
companion: AndroidNativeScriptCompanionAppIdentifier
108+
vanilla: AndroidAppIdentifier
239109
},
240110
iOS: {
241-
vanilla: IOSNativeScriptAppIdentifier,
242-
companion: IOSNativeScriptCompanionAppIdentifier
111+
vanilla: IOSNativeScriptAppIdentifier
243112
}
244113
}
245114
};

lib/common/appbuilder/services/livesync/companion-apps-service.ts

Lines changed: 0 additions & 61 deletions
This file was deleted.

lib/common/appbuilder/services/livesync/livesync-service.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ export class ProtonLiveSyncService implements IProtonLiveSyncService {
1111
private $fs: IFileSystem,
1212
private $injector: IInjector,
1313
private $project: Project.IProjectBase,
14-
private $logger: ILogger,
15-
private $companionAppsService: ICompanionAppsService) { }
14+
private $logger: ILogger) { }
1615

1716
@exported("liveSyncService")
1817
public livesync(deviceDescriptors: IDeviceLiveSyncInfo[], projectDir: string, filePaths?: string[]): Promise<IDeviceLiveSyncResult>[] {
@@ -79,11 +78,11 @@ export class ProtonLiveSyncService implements IProtonLiveSyncService {
7978
const canExecuteAction = await this.$liveSyncServiceBase.getCanExecuteAction(device.deviceInfo.platform, appIdentifier, canExecute);
8079

8180
if (deviceDescriptor.syncToApp) {
82-
result.liveSyncToApp = await this.liveSyncCore(livesyncData, device, appIdentifier, canExecuteAction, { isForCompanionApp: false, isForDeletedFiles: isForDeletedFiles }, filePaths);
81+
result.liveSyncToApp = await this.liveSyncCore(livesyncData, device, appIdentifier, canExecuteAction, { isForDeletedFiles: isForDeletedFiles }, filePaths);
8382
}
8483

8584
if (deviceDescriptor.syncToCompanion) {
86-
result.liveSyncToCompanion = await this.liveSyncCore(livesyncData, device, appIdentifier, canExecuteAction, { isForCompanionApp: true, isForDeletedFiles: isForDeletedFiles }, filePaths);
85+
result.liveSyncToCompanion = await this.liveSyncCore(livesyncData, device, appIdentifier, canExecuteAction, { isForDeletedFiles: isForDeletedFiles }, filePaths);
8786
}
8887

8988
return result;
@@ -94,11 +93,6 @@ export class ProtonLiveSyncService implements IProtonLiveSyncService {
9493
isResolved: false
9594
};
9695

97-
if (liveSyncOptions.isForCompanionApp) {
98-
// We should check if the companion app is installed, not the real application.
99-
livesyncData.appIdentifier = appIdentifier = this.$companionAppsService.getCompanionAppIdentifier(this.$project.projectData.Framework, device.deviceInfo.platform);
100-
}
101-
10296
if (await device.applicationManager.isApplicationInstalled(appIdentifier)) {
10397

10498
const deletedFilesAction: any = liveSyncOptions && liveSyncOptions.isForDeletedFiles ? this.$liveSyncServiceBase.getSyncRemovedFilesAction(livesyncData) : null;

lib/common/declarations.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,11 +1089,6 @@ interface ILiveSyncDeletionOptions {
10891089
* Describes additional options for LiveSyncing
10901090
*/
10911091
interface ILiveSyncOptions extends IProjectFilesConfig, ILiveSyncDeletionOptions {
1092-
/**
1093-
* Defines if the LiveSync operation is for Companion app.
1094-
* @type {boolean}
1095-
*/
1096-
isForCompanionApp: boolean
10971092
}
10981093

10991094
interface ISyncBatch {

lib/common/definitions/mobile.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ declare module Mobile {
520520
deployOnDevices(deviceIdentifiers: string[], packageFile: string, packageName: string, framework: string): Promise<void>[];
521521
getDeviceByIdentifier(identifier: string): Mobile.IDevice;
522522
mapAbstractToTcpPort(deviceIdentifier: string, appIdentifier: string, framework: string): Promise<string>;
523-
isCompanionAppInstalledOnDevices(deviceIdentifiers: string[], framework: string): Promise<IAppInstalledInfo>[];
524523
getDebuggableApps(deviceIdentifiers: string[]): Promise<Mobile.IDeviceApplicationInformation[]>[];
525524
getDebuggableViews(deviceIdentifier: string, appIdentifier: string): Promise<Mobile.IDebugWebViewInfo[]>;
526525

0 commit comments

Comments
 (0)