Skip to content

Commit f11bf51

Browse files
chore: remove ConfigBase and StaticConfigBase classes
Remove ConfigBase and StaticConfigBase classes to simplify the usage of both `$staticConfig` and `$config` - we do not need the base classes - just move the implementation to the current inheritors
1 parent 7219736 commit f11bf51

11 files changed

+107
-231
lines changed

lib/common/appbuilder/declarations.d.ts

-7
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,6 @@ declare module Project {
106106
* @type {Project.IProjectInformation}
107107
*/
108108
projectInformation: Project.IProjectInformation;
109-
110-
/**
111-
* Gets the app identifier which is going to be used to build the application.
112-
* @parameter Optional parameter the platform for which the app identifier will be returned.
113-
* @return {string} the app identifier which will be used to build the application.
114-
*/
115-
getAppIdentifierForPlatform(platform?: string): string;
116109
}
117110

118111
/**

lib/common/appbuilder/project/project-base.ts

-37
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { EOL } from "os";
22
import * as path from "path";
33
import { TARGET_FRAMEWORK_IDENTIFIERS } from "../../constants";
4-
import { cache } from "../../decorators";
54

65
export abstract class ProjectBase implements Project.IProjectBase {
76
private static VALID_CONFIGURATION_CHARACTERS_REGEX = "[-_A-Za-z0-9]";
87
private static CONFIGURATION_FROM_FILE_NAME_REGEX = new RegExp(`^[.](${ProjectBase.VALID_CONFIGURATION_CHARACTERS_REGEX}+?)[.]abproject$`, "i");
9-
private static ANDROID_MANIFEST_NAME = "AndroidManifest.xml";
10-
private static APP_IDENTIFIER_PLACEHOLDER = "$AppIdentifier$";
118

129
public configurationSpecificData: IDictionary<Project.IData>;
1310

@@ -76,26 +73,6 @@ export abstract class ProjectBase implements Project.IProjectBase {
7673
};
7774
}
7875

79-
@cache()
80-
public getAppIdentifierForPlatform(platform?: string): string {
81-
let platformSpecificAppIdentifier = this.projectData.AppIdentifier;
82-
83-
if (platform &&
84-
platform.toLowerCase() === this.$projectConstants.ANDROID_PLATFORM_NAME.toLowerCase() &&
85-
this.projectData.Framework === TARGET_FRAMEWORK_IDENTIFIERS.Cordova) {
86-
const pathToAndroidResources = path.join(this.projectDir, this.$staticConfig.APP_RESOURCES_DIR_NAME, this.$projectConstants.ANDROID_PLATFORM_NAME);
87-
88-
const pathToAndroidManifest = path.join(pathToAndroidResources, ProjectBase.ANDROID_MANIFEST_NAME);
89-
const appIdentifierInAndroidManifest = this.getAppIdentifierFromConfigFile(pathToAndroidManifest, /package\s*=\s*"(\S*)"/);
90-
91-
if (appIdentifierInAndroidManifest && appIdentifierInAndroidManifest !== ProjectBase.APP_IDENTIFIER_PLACEHOLDER) {
92-
platformSpecificAppIdentifier = appIdentifierInAndroidManifest;
93-
}
94-
}
95-
96-
return platformSpecificAppIdentifier;
97-
}
98-
9976
protected abstract validate(): void;
10077
protected abstract saveProjectIfNeeded(): void;
10178

@@ -152,18 +129,4 @@ export abstract class ProjectBase implements Project.IProjectBase {
152129

153130
return data;
154131
}
155-
156-
private getAppIdentifierFromConfigFile(pathToConfigFile: string, regExp: RegExp): string {
157-
if (this.$fs.exists(pathToConfigFile)) {
158-
const fileContent = this.$fs.readText(pathToConfigFile);
159-
160-
const matches = fileContent.match(regExp);
161-
162-
if (matches && matches[1]) {
163-
return matches[1];
164-
}
165-
}
166-
167-
return null;
168-
}
169132
}

lib/common/appbuilder/proton-bootstrap.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require("./appbuilder-bootstrap");
22
$injector.require("messages", "./messages/messages");
33

4-
$injector.require("staticConfig", "./appbuilder/proton-static-config");
54
$injector.register("config", {});
65
// Proton will track the features and exceptions, so no need of analyticsService here.
76
$injector.register("analyiticsService", {});

lib/common/appbuilder/proton-static-config.ts

-26
This file was deleted.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class ProtonLiveSyncService implements IProtonLiveSyncService {
6666
}
6767
}
6868

69-
const appIdentifier = await this.$project.getAppIdentifierForPlatform(this.$devicesService.platform),
69+
const appIdentifier = "",
7070
canExecute = (d: Mobile.IDevice) => d.deviceInfo.identifier === device.deviceInfo.identifier,
7171
livesyncData: ILiveSyncData = {
7272
platform: device.deviceInfo.platform,

lib/common/config-base.ts

-16
This file was deleted.

lib/common/declarations.d.ts

-7
Original file line numberDiff line numberDiff line change
@@ -1404,13 +1404,6 @@ interface IResourceLoader {
14041404
* @return {any} Object based on the JSON contents of the resource file.
14051405
*/
14061406
readJson(path: string): any;
1407-
1408-
/**
1409-
* Returns the path to App_Resources folder, which contains all resources for a given application.
1410-
* @param {string} framework The application's framework name
1411-
* @return {string} The absolute path to App_Resources folder
1412-
*/
1413-
getPathToAppResources(framework: string): string;
14141407
}
14151408

14161409
interface IPluginVariablesHelper {

lib/common/definitions/config.d.ts

-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ declare module Config {
2020
HTML_COMMON_HELPERS_DIR: string;
2121
HTML_CLI_HELPERS_DIR: string;
2222
pathToPackageJson: string;
23-
APP_RESOURCES_DIR_NAME: string;
2423
RESOURCE_DIR_PATH: string;
2524
PATH_TO_BOOTSTRAP: string;
2625
QR_SIZE: number;
@@ -30,9 +29,7 @@ declare module Config {
3029

3130
interface IConfig {
3231
DEBUG?: boolean;
33-
ON_PREM?: boolean;
3432
CI_LOGGER?: boolean;
35-
TYPESCRIPT_COMPILER_OPTIONS?: ITypeScriptCompilerOptions;
3633
DISABLE_HOOKS: boolean;
3734
}
3835
}

lib/common/resource-loader.ts

-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,5 @@ export class ResourceLoader implements IResourceLoader {
1919
readJson(resourcePath: string): any {
2020
return this.$fs.readJson(this.resolvePath(resourcePath));
2121
}
22-
23-
public getPathToAppResources(framework: string): string {
24-
return path.join(this.resolvePath(framework), this.$staticConfig.APP_RESOURCES_DIR_NAME);
25-
}
2622
}
2723
$injector.register("resources", ResourceLoader);

lib/common/static-config-base.ts

-118
This file was deleted.

0 commit comments

Comments
 (0)