Skip to content

Commit 87553a1

Browse files
chore: remove deviceAppDataFactory and deviceAppDataProviders
Remove deviceAppDataFactory and deviceAppDataProviders which were used in old LiveSync logic.
1 parent b728011 commit 87553a1

File tree

14 files changed

+17
-262
lines changed

14 files changed

+17
-262
lines changed

lib/common/appbuilder/appbuilder-bootstrap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ $injector.require("pathFilteringService", "./appbuilder/services/path-filtering"
55
$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");
8-
$injector.require("deviceAppDataProvider", "./appbuilder/providers/device-app-data-provider");
98
$injector.require("nativeScriptProjectCapabilities", "./appbuilder/project/nativescript-project-capabilities");
109
$injector.require("cordovaProjectCapabilities", "./appbuilder/project/cordova-project-capabilities");
1110
$injector.require("mobilePlatformsCapabilities", "./appbuilder/mobile-platforms-capabilities");

lib/common/appbuilder/declarations.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
interface ILiveSyncDeviceAppData extends Mobile.IDeviceAppData {
2-
liveSyncFormat: string;
3-
encodeLiveSyncHostUri(hostUri: string): string;
4-
getLiveSyncNotSupportedError(): string;
5-
}
6-
71
interface IDeployHelper {
82
deploy(platform?: string): Promise<void>;
93
}

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

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

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

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

lib/common/bootstrap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ $injector.require("iOSSimResolver", "./mobile/ios/simulator/ios-sim-resolver");
7474
$injector.require("iOSSimulatorLogProvider", "./mobile/ios/simulator/ios-simulator-log-provider");
7575

7676
$injector.require("localToDevicePathDataFactory", "./mobile/local-to-device-path-data-factory");
77-
$injector.require("deviceAppDataFactory", "./mobile/device-app-data/device-app-data-factory");
7877

7978
$injector.requirePublic("typeScriptService", "./services/typescript-service");
8079

lib/common/definitions/mobile.d.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,6 @@ declare module Mobile {
153153
isLiveSyncSupported(): Promise<boolean>;
154154
}
155155

156-
interface IDeviceAppDataFactory {
157-
create<T extends Mobile.IDeviceAppData>(appIdentifier: string, platform: string, device: Mobile.IDevice, liveSyncOptions?: { isForCompanionApp: boolean }): T;
158-
}
159-
160-
interface IDeviceAppDataFactoryRule {
161-
vanilla: any;
162-
companion?: any;
163-
}
164-
165-
interface IDeviceAppDataProvider {
166-
createFactoryRules(): IDictionary<Mobile.IDeviceAppDataFactoryRule>;
167-
}
168-
169156
interface IAndroidLiveSyncService {
170157
liveSyncCommands: any;
171158
livesync(appIdentifier: string, liveSyncRoot: string, commands: string[]): Promise<void>;

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

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

lib/common/mobile/device-app-data/device-app-data-factory.ts

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

lib/common/test/unit-tests/mobile/project-files-manager.ts

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { assert } from "chai";
2-
import { DeviceAppDataFactory } from "../../../mobile/device-app-data/device-app-data-factory";
32
import { DevicePlatformsConstants } from "../../../mobile/device-platforms-constants";
43
import { Errors } from "../../../errors";
54
import { FileSystem } from "../../../file-system";
@@ -19,44 +18,21 @@ temp.track();
1918

2019
const testedApplicationIdentifier = "com.telerik.myApp";
2120
const iOSDeviceProjectRootPath = "/Documents/AppBuilder/LiveSync/app";
22-
const iOSDeviceSyncZipPath = "/Documents/AppBuilder/LiveSync/sync.zip";
2321
const androidDeviceProjectRootPath = `${LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${LiveSyncPaths.SYNC_DIR_NAME}`;
2422

25-
class IOSAppIdentifierMock implements Mobile.IDeviceAppData {
26-
public platform = "iOS";
27-
public appIdentifier = testedApplicationIdentifier;
28-
public device: Mobile.IDevice = null;
29-
public getDeviceProjectRootPath = async () => iOSDeviceProjectRootPath;
30-
public deviceSyncZipPath = iOSDeviceSyncZipPath;
23+
const androidDeviceAppData: Mobile.IDeviceAppData = <any>{
24+
appIdentifier: testedApplicationIdentifier,
25+
platform: "Android",
26+
getDeviceProjectRootPath: async () => androidDeviceProjectRootPath,
27+
isLiveSyncSupported: async () => true
28+
};
3129

32-
public async isLiveSyncSupported(): Promise<boolean> {
33-
return true;
34-
}
35-
}
36-
37-
class AndroidAppIdentifierMock implements Mobile.IDeviceAppData {
38-
public platform = "Android";
39-
public appIdentifier = testedApplicationIdentifier;
40-
public device: Mobile.IDevice = null;
41-
public getDeviceProjectRootPath = async () => androidDeviceProjectRootPath;
42-
43-
public async isLiveSyncSupported(): Promise<boolean> {
44-
return true;
45-
}
46-
}
47-
48-
class DeviceAppDataProvider {
49-
public createFactoryRules(): IDictionary<Mobile.IDeviceAppDataFactoryRule> {
50-
return {
51-
iOS: {
52-
vanilla: IOSAppIdentifierMock
53-
},
54-
Android: {
55-
vanilla: AndroidAppIdentifierMock
56-
}
57-
};
58-
}
59-
}
30+
const iOSDeviceAppData: Mobile.IDeviceAppData = <any>{
31+
appIdentifier: testedApplicationIdentifier,
32+
platform: "iOS",
33+
getDeviceProjectRootPath: async () => iOSDeviceProjectRootPath,
34+
isLiveSyncSupported: async () => true
35+
};
6036

6137
class MobilePlatformsCapabilitiesMock implements Mobile.IPlatformsCapabilities {
6238
public getPlatformNames(): string[] {
@@ -84,8 +60,6 @@ class MobilePlatformsCapabilitiesMock implements Mobile.IPlatformsCapabilities {
8460
function createTestInjector(): IInjector {
8561
const testInjector = new Yok();
8662

87-
testInjector.register("deviceAppDataFactory", DeviceAppDataFactory);
88-
testInjector.register("deviceAppDataProvider", DeviceAppDataProvider);
8963
testInjector.register("devicePlatformsConstants", DevicePlatformsConstants);
9064
testInjector.register("errors", Errors);
9165
testInjector.register("fs", FileSystem);
@@ -122,20 +96,18 @@ function createFile(testInjector: IInjector, fileToCreate: string, fileContent:
12296
}
12397

12498
describe("Project Files Manager Tests", () => {
125-
let testInjector: IInjector, projectFilesManager: IProjectFilesManager, deviceAppDataFactory: Mobile.IDeviceAppDataFactory;
99+
let testInjector: IInjector, projectFilesManager: IProjectFilesManager;
126100
let mobileHelper: Mobile.IMobileHelper;
127101

128102
beforeEach(() => {
129103
testInjector = createTestInjector();
130104
projectFilesManager = testInjector.resolve("projectFilesManager");
131-
deviceAppDataFactory = testInjector.resolve("deviceAppDataFactory");
132105
mobileHelper = testInjector.resolve("mobileHelper");
133106
});
134107

135108
it("maps non-platform specific files to device file paths for ios platform", async () => {
136-
const deviceAppData = deviceAppDataFactory.create(testedApplicationIdentifier, "iOS", null);
137109
const files = ["~/TestApp/app/test.js", "~/TestApp/app/myfile.js"];
138-
const localToDevicePaths = await projectFilesManager.createLocalToDevicePaths(deviceAppData, "~/TestApp/app", files, []);
110+
const localToDevicePaths = await projectFilesManager.createLocalToDevicePaths(iOSDeviceAppData, "~/TestApp/app", files, []);
139111

140112
_.each(localToDevicePaths, (localToDevicePathData, index) => {
141113
assert.equal(files[index], localToDevicePathData.getLocalPath());
@@ -145,9 +117,8 @@ describe("Project Files Manager Tests", () => {
145117
});
146118

147119
it("maps non-platform specific files to device file paths for android platform", async () => {
148-
const deviceAppData = deviceAppDataFactory.create(testedApplicationIdentifier, "Android", null);
149120
const files = ["~/TestApp/app/test.js", "~/TestApp/app/myfile.js"];
150-
const localToDevicePaths = await projectFilesManager.createLocalToDevicePaths(deviceAppData, "~/TestApp/app", files, []);
121+
const localToDevicePaths = await projectFilesManager.createLocalToDevicePaths(androidDeviceAppData, "~/TestApp/app", files, []);
151122

152123
_.each(localToDevicePaths, (localToDevicePathData, index) => {
153124
assert.equal(files[index], localToDevicePathData.getLocalPath());
@@ -157,19 +128,17 @@ describe("Project Files Manager Tests", () => {
157128
});
158129

159130
it("maps ios platform specific file to device file path", async () => {
160-
const deviceAppData = deviceAppDataFactory.create(testedApplicationIdentifier, "iOS", null);
161131
const filePath = "~/TestApp/app/test.ios.js";
162-
const localToDevicePathData = (await projectFilesManager.createLocalToDevicePaths(deviceAppData, "~/TestApp/app", [filePath], []))[0];
132+
const localToDevicePathData = (await projectFilesManager.createLocalToDevicePaths(iOSDeviceAppData, "~/TestApp/app", [filePath], []))[0];
163133

164134
assert.equal(filePath, localToDevicePathData.getLocalPath());
165135
assert.equal(mobileHelper.buildDevicePath(iOSDeviceProjectRootPath, "test.js"), localToDevicePathData.getDevicePath());
166136
assert.equal("test.ios.js", localToDevicePathData.getRelativeToProjectBasePath());
167137
});
168138

169139
it("maps android platform specific file to device file path", async () => {
170-
const deviceAppData = deviceAppDataFactory.create(testedApplicationIdentifier, "Android", null);
171140
const filePath = "~/TestApp/app/test.android.js";
172-
const localToDevicePathData = (await projectFilesManager.createLocalToDevicePaths(deviceAppData, "~/TestApp/app", [filePath], []))[0];
141+
const localToDevicePathData = (await projectFilesManager.createLocalToDevicePaths(androidDeviceAppData, "~/TestApp/app", [filePath], []))[0];
173142

174143
assert.equal(filePath, localToDevicePathData.getLocalPath());
175144
assert.equal(mobileHelper.buildDevicePath(androidDeviceProjectRootPath, "test.js"), localToDevicePathData.getDevicePath());

test/debug.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ function createTestInjector(): IInjector {
4646
testInjector.register("sysInfo", {});
4747
testInjector.register("mobileHelper", {});
4848
testInjector.register("pluginVariablesService", {});
49-
testInjector.register("deviceAppDataFactory", {});
5049
testInjector.register("projectTemplatesService", {});
5150
testInjector.register("debugService", {});
5251
testInjector.register("xmlValidator", {});

0 commit comments

Comments
 (0)