Skip to content

Commit 687a02b

Browse files
chore: remove unused isLiveSyncSupported methods
Remove unused `isLiveSyncSupported` methods, which were checking if the application can be LiveSynced via AppBuilder's LiveSync plugin that is no longer supported.
1 parent e11b467 commit 687a02b

16 files changed

+18
-165
lines changed

lib/common/constants.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@ export class LiveSyncPaths {
3737
static ANDROID_TMP_DIR_NAME = "/data/local/tmp";
3838
}
3939

40-
export class LiveSyncConstants {
41-
static VERSION_2 = 2;
42-
static VERSION_3 = 3;
43-
static GUID = "12590FAA-5EDD-4B12-856D-F52A0A1599F2";
44-
static DEVICE_TMP_DIR_FORMAT_V2 = `${LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${LiveSyncConstants.GUID}/%s`;
45-
static ANDROID_FILES_PATH = `files/${LiveSyncConstants.GUID}`;
46-
static DEVICE_TMP_DIR_FORMAT_V3 = `/mnt/sdcard/Android/data/%s/${LiveSyncConstants.ANDROID_FILES_PATH}`;
47-
static CHECK_LIVESYNC_INTENT_NAME = "com.telerik.IsLiveSyncSupported";
48-
static IOS_PROJECT_PATH = "/Documents/AppBuilder/LiveSync";
49-
}
50-
5140
export class HmrConstants {
5241
public static HMR_ERROR_STATUS = 3;
5342
public static HMR_SUCCESS_STATUS = 2;

lib/common/declarations.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,3 +1639,13 @@ declare module "detect-newline" {
16391639
function detectNewline(data: string): string | null;
16401640
export = detectNewline
16411641
}
1642+
1643+
/**
1644+
* Describes information for application.
1645+
*/
1646+
interface IAppInstalledInfo extends Mobile.IDeviceApplicationInformationBase {
1647+
/**
1648+
* Defines if application is installed on device.
1649+
*/
1650+
isInstalled: boolean;
1651+
}

lib/common/definitions/mobile.d.ts

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
/**
2-
* Describes if LiveSync is supported for specific device and application.
3-
*/
4-
interface ILiveSyncSupportedInfo extends Mobile.IDeviceApplicationInformationBase {
5-
/**
6-
* Result, indicating is livesync supported for specified device and specified application.
7-
* `true` in case livesync is supported and false otherwise.
8-
*/
9-
isLiveSyncSupported: boolean;
10-
}
11-
12-
/**
13-
* Describes if LiveSync is supported for specific device and application.
14-
*/
15-
interface IAppInstalledInfo extends ILiveSyncSupportedInfo {
16-
/**
17-
* Defines if application is installed on device.
18-
*/
19-
isInstalled: boolean;
20-
}
21-
221
declare module Mobile {
232
interface ISyncOptions {
243
skipRefresh?: boolean;
@@ -122,7 +101,6 @@ declare module Mobile {
122101
fileSystem: Mobile.IDeviceFileSystem;
123102
isEmulator: boolean;
124103
openDeviceLogStream(): Promise<void>;
125-
getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo>;
126104

127105
/**
128106
* Called when device is lost. Its purpose is to clean any resources used by the instance.
@@ -171,7 +149,6 @@ declare module Mobile {
171149
device: Mobile.IDevice;
172150
getDeviceProjectRootPath(): Promise<string>;
173151
deviceSyncZipPath?: string;
174-
isLiveSyncSupported(): Promise<boolean>;
175152
}
176153

177154
interface ILogcatStartOptions {
@@ -321,24 +298,11 @@ declare module Mobile {
321298
stopApplication(appData: IApplicationData): Promise<void>;
322299
restartApplication(appData: IStartApplicationData): Promise<void>;
323300
checkForApplicationUpdates(): Promise<void>;
324-
isLiveSyncSupported(appIdentifier: string): Promise<boolean>;
325-
getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo>;
326301
tryStartApplication(appData: IApplicationData): Promise<void>;
327302
getDebuggableApps(): Promise<Mobile.IDeviceApplicationInformation[]>;
328303
getDebuggableAppViews(appIdentifiers: string[]): Promise<IDictionary<Mobile.IDebugWebViewInfo[]>>;
329304
}
330305

331-
/**
332-
* Describes information about livesync in an application.
333-
*/
334-
interface ILiveSyncApplicationInfo extends IApplicationInfo {
335-
/**
336-
* Whether LiveSync is supported
337-
* @type {boolean}
338-
*/
339-
isLiveSyncSupported: boolean;
340-
}
341-
342306
/**
343307
* Describes information about an application.
344308
*/
@@ -699,13 +663,13 @@ declare module Mobile {
699663
create(fileName: string, localProjectRootPath: string, onDeviceFileName: string, deviceProjectRootPath: string): Mobile.ILocalToDevicePathData;
700664
}
701665

666+
// TODO: Remove
702667
interface IPlatformCapabilities {
703668
wirelessDeploy?: boolean;
704669
cableDeploy: boolean;
705670
companion?: boolean;
706671
hostPlatformsForDeploy: string[];
707672
}
708-
709673
interface IAvdInfo extends IDictionary<string | number> {
710674
target: string;
711675
targetNum: number;
@@ -1045,11 +1009,11 @@ declare module Mobile {
10451009
timeout?: number;
10461010
}
10471011

1012+
// TODO: Consider removing
10481013
interface IPlatformsCapabilities {
10491014
getPlatformNames(): string[];
10501015
getAllCapabilities(): IDictionary<Mobile.IPlatformCapabilities>;
10511016
}
1052-
10531017
interface IMobileHelper {
10541018
platformNames: string[];
10551019
isAndroidPlatform(platform: string): boolean;

lib/common/mobile/android/android-application-manager.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EOL } from "os";
22
import { ApplicationManagerBase } from "../application-manager-base";
3-
import { LiveSyncConstants, TARGET_FRAMEWORK_IDENTIFIERS, LiveSyncPaths } from "../../constants";
3+
import {TARGET_FRAMEWORK_IDENTIFIERS, LiveSyncPaths } from "../../constants";
44
import { hook, sleep, regExpEscape } from "../../helpers";
55
import { cache } from "../../decorators";
66

@@ -121,16 +121,6 @@ export class AndroidApplicationManager extends ApplicationManagerBase {
121121
return this.adb.executeShellCommand(["am", "force-stop", `${appData.appId}`]);
122122
}
123123

124-
public getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo> {
125-
// This method is currently only used in the ios application managers. Configurations for Android are acquired through filesystem listing.
126-
return Promise.resolve(null);
127-
}
128-
129-
public async isLiveSyncSupported(appIdentifier: string): Promise<boolean> {
130-
const liveSyncVersion = await this.adb.sendBroadcastToDevice(LiveSyncConstants.CHECK_LIVESYNC_INTENT_NAME, { "app-id": appIdentifier });
131-
return liveSyncVersion === LiveSyncConstants.VERSION_2 || liveSyncVersion === LiveSyncConstants.VERSION_3;
132-
}
133-
134124
public getDebuggableApps(): Promise<Mobile.IDeviceApplicationInformation[]> {
135125
return this.$androidProcessService.getDebuggableApps(this.identifier);
136126
}

lib/common/mobile/android/android-device.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,6 @@ export class AndroidDevice implements Mobile.IAndroidDevice {
9696
return this.deviceInfo.type === constants.DeviceTypes.Emulator;
9797
}
9898

99-
public async getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo> {
100-
const files = await this.fileSystem.listFiles(constants.LiveSyncConstants.ANDROID_FILES_PATH, applicationIdentifier);
101-
const androidFilesMatch = files.match(/(\S+)\.abproject/);
102-
let result: Mobile.IApplicationInfo = null;
103-
104-
if (androidFilesMatch && androidFilesMatch[1]) {
105-
result = {
106-
deviceIdentifier: this.deviceInfo.identifier,
107-
configuration: androidFilesMatch[1],
108-
applicationIdentifier
109-
};
110-
}
111-
112-
return result;
113-
}
114-
11599
public async openDeviceLogStream(): Promise<void> {
116100
if (this.deviceInfo.status === constants.CONNECTED_STATUS) {
117101
await this.$logcatHelper.start({

lib/common/mobile/application-manager-base.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,11 @@ export abstract class ApplicationManagerBase extends EventEmitter implements Mob
7676
}
7777
}
7878

79-
public abstract async isLiveSyncSupported(appIdentifier: string): Promise<boolean>;
80-
8179
public abstract async installApplication(packageFilePath: string, appIdentifier?: string): Promise<void>;
8280
public abstract async uninstallApplication(appIdentifier: string): Promise<void>;
8381
public abstract async startApplication(appData: Mobile.IApplicationData): Promise<void>;
8482
public abstract async stopApplication(appData: Mobile.IApplicationData): Promise<void>;
8583
public abstract async getInstalledApplications(): Promise<string[]>;
86-
public abstract async getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo>;
8784
public abstract async getDebuggableApps(): Promise<Mobile.IDeviceApplicationInformation[]>;
8885
public abstract async getDebuggableAppViews(appIdentifiers: string[]): Promise<IDictionary<Mobile.IDebugWebViewInfo[]>>;
8986

lib/common/mobile/ios/device/ios-application-manager.ts

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ApplicationManagerBase } from "../../application-manager-base";
44
import { cache } from "../../../decorators";
55

66
export class IOSApplicationManager extends ApplicationManagerBase {
7-
private applicationsLiveSyncInfos: Mobile.ILiveSyncApplicationInfo[];
7+
private applicationsLiveSyncInfos: Mobile.IApplicationInfo[];
88

99
constructor(protected $logger: ILogger,
1010
protected $hooksService: IHooksService,
@@ -18,7 +18,7 @@ export class IOSApplicationManager extends ApplicationManagerBase {
1818
}
1919

2020
public async getInstalledApplications(): Promise<string[]> {
21-
const applicationsLiveSyncStatus = await this.getApplicationsLiveSyncSupportedStatus();
21+
const applicationsLiveSyncStatus = await this.getApplicationsInformation();
2222

2323
return _(applicationsLiveSyncStatus)
2424
.map(appLiveSyncStatus => appLiveSyncStatus.applicationIdentifier)
@@ -33,39 +33,21 @@ export class IOSApplicationManager extends ApplicationManagerBase {
3333
});
3434
}
3535

36-
public async getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo> {
37-
if (!this.applicationsLiveSyncInfos || !this.applicationsLiveSyncInfos.length) {
38-
await this.getApplicationsLiveSyncSupportedStatus();
39-
}
40-
41-
return _.find(this.applicationsLiveSyncInfos, app => app.applicationIdentifier === applicationIdentifier);
42-
}
43-
44-
public async getApplicationsLiveSyncSupportedStatus(): Promise<Mobile.ILiveSyncApplicationInfo[]> {
36+
public async getApplicationsInformation(): Promise<Mobile.IApplicationInfo[]> {
4537
const deviceIdentifier = this.device.deviceInfo.identifier;
4638
const applicationsOnDeviceInfo = _.first((await this.$iosDeviceOperations.apps([deviceIdentifier]))[deviceIdentifier]);
4739
const applicationsOnDevice = applicationsOnDeviceInfo ? applicationsOnDeviceInfo.response : [];
48-
this.$logger.trace("Result when getting applications for which LiveSync is enabled: ", JSON.stringify(applicationsOnDevice, null, 2));
40+
this.$logger.trace("Result when getting applications information: ", JSON.stringify(applicationsOnDevice, null, 2));
4941

5042
this.applicationsLiveSyncInfos = _.map(applicationsOnDevice, app => ({
5143
applicationIdentifier: app.CFBundleIdentifier,
52-
isLiveSyncSupported: app.IceniumLiveSyncEnabled,
5344
configuration: app.configuration,
5445
deviceIdentifier: this.device.deviceInfo.identifier
5546
}));
5647

5748
return this.applicationsLiveSyncInfos;
5849
}
5950

60-
public async isLiveSyncSupported(appIdentifier: string): Promise<boolean> {
61-
if (!this.applicationsLiveSyncInfos || !this.applicationsLiveSyncInfos.length) {
62-
await this.getApplicationsLiveSyncSupportedStatus();
63-
}
64-
65-
const selectedApplication = _.find(this.applicationsLiveSyncInfos, app => app.applicationIdentifier === appIdentifier);
66-
return !!selectedApplication && selectedApplication.isLiveSyncSupported;
67-
}
68-
6951
public async uninstallApplication(appIdentifier: string): Promise<void> {
7052
await this.$iosDeviceOperations.uninstall(appIdentifier, [this.device.deviceInfo.identifier], (err: IOSDeviceLib.IDeviceError) => {
7153
this.$logger.warn(`Failed to uninstall ${appIdentifier} on device with identifier ${err.deviceId}`);

lib/common/mobile/ios/ios-device-base.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ export abstract class IOSDeviceBase implements Mobile.IiOSDevice {
1414
abstract isEmulator: boolean;
1515
abstract openDeviceLogStream(options?: Mobile.IiOSLogStreamOptions): Promise<void>;
1616

17-
public getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo> {
18-
return this.applicationManager.getApplicationInfo(applicationIdentifier);
19-
}
20-
2117
@performanceLog()
2218
public async getDebugSocket(appId: string, projectName: string): Promise<net.Socket> {
2319
return this.$lockService.executeActionWithLock(async () => {

lib/common/mobile/ios/simulator/ios-simulator-application-manager.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
1515
private device: Mobile.IiOSDevice,
1616
private $options: IOptions,
1717
private $fs: IFileSystem,
18-
private $plistParser: IPlistParser,
1918
private $processService: IProcessService,
2019
private $deviceLogProvider: Mobile.IDeviceLogProvider,
2120
$logger: ILogger,
@@ -76,30 +75,6 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
7675
await this.iosSim.stopApplication(this.device.deviceInfo.identifier, appData.appId, appData.projectName);
7776
}
7877

79-
public async getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo> {
80-
let result: Mobile.IApplicationInfo = null;
81-
const plistContent = await this.getParsedPlistContent(applicationIdentifier);
82-
83-
if (plistContent) {
84-
result = {
85-
applicationIdentifier,
86-
deviceIdentifier: this.device.deviceInfo.identifier,
87-
configuration: plistContent && plistContent.configuration
88-
};
89-
}
90-
91-
return result;
92-
}
93-
94-
public async isLiveSyncSupported(appIdentifier: string): Promise<boolean> {
95-
const plistContent = await this.getParsedPlistContent(appIdentifier);
96-
if (plistContent) {
97-
return !!plistContent && !!plistContent.IceniumLiveSyncEnabled;
98-
}
99-
100-
return false;
101-
}
102-
10378
public async getDebuggableApps(): Promise<Mobile.IDeviceApplicationInformation[]> {
10479
return [];
10580
}
@@ -139,17 +114,6 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
139114
}
140115
}
141116

142-
private async getParsedPlistContent(appIdentifier: string): Promise<any> {
143-
if (! await this.isApplicationInstalled(appIdentifier)) {
144-
return null;
145-
}
146-
147-
const applicationPath = await this.iosSim.getApplicationPath(this.device.deviceInfo.identifier, appIdentifier),
148-
pathToInfoPlist = path.join(applicationPath, "Info.plist");
149-
150-
return this.$fs.exists(pathToInfoPlist) ? await this.$plistParser.parseFile(pathToInfoPlist) : null;
151-
}
152-
153117
private async setDeviceLogData(appData: Mobile.IApplicationData, pid: string): Promise<void> {
154118
this.$deviceLogProvider.setApplicationPidForDevice(this.device.deviceInfo.identifier, pid);
155119
this.$deviceLogProvider.setProjectNameForDevice(this.device.deviceInfo.identifier, appData.projectName);

lib/common/mobile/mobile-core/devices-service.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,22 +794,19 @@ export class DevicesService extends EventEmitter implements Mobile.IDevicesServi
794794

795795
private async isApplicationInstalledOnDevice(deviceIdentifier: string, appData: Mobile.IApplicationData): Promise<IAppInstalledInfo> {
796796
let isInstalled = false;
797-
let isLiveSyncSupported = false;
798797
const device = this.getDeviceByIdentifier(deviceIdentifier);
799798

800799
try {
801800
isInstalled = await device.applicationManager.isApplicationInstalled(appData.appId);
802801
await device.applicationManager.tryStartApplication(appData);
803-
isLiveSyncSupported = await isInstalled && !!device.applicationManager.isLiveSyncSupported(appData.appId);
804802
} catch (err) {
805803
this.$logger.trace("Error while checking is application installed. Error is: ", err);
806804
}
807805

808806
return {
809807
appIdentifier: appData.appId,
810808
deviceIdentifier,
811-
isInstalled,
812-
isLiveSyncSupported
809+
isInstalled
813810
};
814811
}
815812

0 commit comments

Comments
 (0)