Skip to content

Commit 4468733

Browse files
committed
removed ensureConfigurationFileInAppResources both from android and ios
enureConfigurationFileInAppResources functionality is obsolite from 1.7, what it did was make sure we have a configuration file AndroidManifest.xml or Info.plist in the app/App_Resources/(Android/iOS)/ folders respectively. We also carried a configuration file inside the CLI installation folder which also need to be deleted"
1 parent c78cf16 commit 4468733

File tree

2 files changed

+2
-103
lines changed

2 files changed

+2
-103
lines changed

lib/services/android-project-service.ts

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
312312

313313
public ensureConfigurationFileInAppResources(): IFuture<void> {
314314
return (() => {
315-
let originalAndroidManifestFilePath = path.join(this.$projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.Android, this.platformData.configurationFileName),
316-
hasAndroidManifestInAppResources = this.$fs.exists(originalAndroidManifestFilePath).wait(),
317-
shouldExtractDefaultManifest = !hasAndroidManifestInAppResources || !this.isAndroidManifestFileCorrect(originalAndroidManifestFilePath).wait();
318-
319-
// In case we should extract the manifest from default template, but for some reason we cannot, break the execution,
320-
// so the original file from Android runtime will be used.
321-
if (shouldExtractDefaultManifest && !this.extractAndroidManifestFromDefaultTemplate(originalAndroidManifestFilePath).wait()) {
322-
return;
323-
}
315+
let originalAndroidManifestFilePath = path.join(this.$projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.Android, this.platformData.configurationFileName);
324316

325317
// Overwrite the AndroidManifest from runtime.
326318
this.$fs.copyFile(originalAndroidManifestFilePath, this.platformData.configurationFilePath).wait();
@@ -537,79 +529,5 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
537529
}
538530
}).future<boolean>()();
539531
}
540-
541-
private _configurationFileBackupName: string;
542-
543-
private getConfigurationFileBackupName(originalAndroidManifestFilePath: string): IFuture<string> {
544-
return (() => {
545-
if (!this._configurationFileBackupName) {
546-
let defaultBackupName = this.platformData.configurationFileName + ".backup";
547-
if (this.$fs.exists(path.join(path.dirname(originalAndroidManifestFilePath), defaultBackupName)).wait()) {
548-
defaultBackupName += `_${createGUID(false)}`;
549-
}
550-
this._configurationFileBackupName = defaultBackupName;
551-
}
552-
553-
return this._configurationFileBackupName;
554-
}).future<string>()();
555-
}
556-
557-
private backupOriginalAndroidManifest(originalAndroidManifestFilePath: string): IFuture<void> {
558-
return (() => {
559-
let newPathForOriginalManifest = path.join(path.dirname(originalAndroidManifestFilePath), this.getConfigurationFileBackupName(originalAndroidManifestFilePath).wait());
560-
shell.mv(originalAndroidManifestFilePath, newPathForOriginalManifest);
561-
}).future<void>()();
562-
}
563-
564-
private revertBackupOfOriginalAndroidManifest(originalAndroidManifestFilePath: string): IFuture<void> {
565-
return (() => {
566-
let pathToBackupFile = path.join(path.dirname(originalAndroidManifestFilePath), this.getConfigurationFileBackupName(originalAndroidManifestFilePath).wait());
567-
if (this.$fs.exists(pathToBackupFile).wait()) {
568-
this.$logger.trace(`Could not extract ${this.platformData.configurationFileName} from default template. Reverting the change of your app/App_Resources/${this.platformData.configurationFileName}.`);
569-
shell.mv(pathToBackupFile, originalAndroidManifestFilePath);
570-
}
571-
}).future<void>()();
572-
}
573-
574-
private extractAndroidManifestFromDefaultTemplate(originalAndroidManifestFilePath: string): IFuture<boolean> {
575-
return ((): boolean => {
576-
let defaultTemplatePath = this.$projectTemplatesService.defaultTemplatePath.wait();
577-
let templateAndroidManifest = path.join(defaultTemplatePath, constants.APP_RESOURCES_FOLDER_NAME, this.$devicePlatformsConstants.Android, this.platformData.configurationFileName);
578-
let alreadyHasAndroidManifest = this.$fs.exists(originalAndroidManifestFilePath).wait();
579-
if (this.$fs.exists(templateAndroidManifest).wait()) {
580-
this.$logger.trace(`${originalAndroidManifestFilePath} is missing. Upgrading the source of the project with one from the new project template. Copy ${templateAndroidManifest} to ${originalAndroidManifestFilePath}`);
581-
try {
582-
if (alreadyHasAndroidManifest) {
583-
this.backupOriginalAndroidManifest(originalAndroidManifestFilePath).wait();
584-
}
585-
586-
let content = this.$fs.readText(templateAndroidManifest).wait();
587-
588-
// We do not want to force launch screens on old projects.
589-
let themeMeta = `<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />`;
590-
content = content
591-
.replace(`\n\t\t\tandroid:theme="@style/LaunchScreenTheme">\n`, `>\n\t\t\t<!-- android:theme="@style/LaunchScreenTheme" -->\n`)
592-
.replace(themeMeta, "<!-- " + themeMeta + " -->");
593-
594-
this.$fs.writeFile(originalAndroidManifestFilePath, content).wait();
595-
} catch (e) {
596-
this.$logger.trace(`Copying template's ${this.platformData.configurationFileName} failed. `, e);
597-
this.revertBackupOfOriginalAndroidManifest(originalAndroidManifestFilePath).wait();
598-
return false;
599-
}
600-
} else {
601-
this.$logger.trace(`${originalAndroidManifestFilePath} is missing but the template ${templateAndroidManifest} is missing too, can not upgrade ${this.platformData.configurationFileName}.`);
602-
return false;
603-
}
604-
605-
if (alreadyHasAndroidManifest) {
606-
this.$logger.warn(`Your ${this.platformData.configurationFileName} in app/App_Resources/Android will be replaced by the default one from hello-world template.`);
607-
this.$logger.printMarkdown(`The original file will be moved to \`${this.getConfigurationFileBackupName(originalAndroidManifestFilePath).wait()}\`. Merge it **manually** with the new \`${this.platformData.configurationFileName}\` in your app/App_Resources/Android.`);
608-
}
609-
610-
this.interpolateConfigurationFile().wait();
611-
return true;
612-
}).future<boolean>()();
613-
}
614532
}
615533
$injector.register("androidProjectService", AndroidProjectService);

lib/services/ios-project-service.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -624,26 +624,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
624624
);
625625
}
626626
public ensureConfigurationFileInAppResources(): IFuture<void> {
627-
return (() => {
628-
let infoPlistPath = this.getInfoPlistPath();
629-
if (!this.$fs.exists(infoPlistPath).wait()) {
630-
// The project is missing Info.plist, try to populate it from the project template.
631-
let projectTemplateService: IProjectTemplatesService = this.$injector.resolve("projectTemplatesService");
632-
let defaultTemplatePath = projectTemplateService.defaultTemplatePath.wait();
633-
let templateInfoPlist = path.join(defaultTemplatePath, constants.APP_RESOURCES_FOLDER_NAME, this.$devicePlatformsConstants.iOS, this.platformData.configurationFileName);
634-
if (this.$fs.exists(templateInfoPlist).wait()) {
635-
this.$logger.trace("Info.plist: app/App_Resources/iOS/Info.plist is missing. Upgrading the source of the project with one from the new project template. Copy " + templateInfoPlist + " to " + infoPlistPath);
636-
try {
637-
this.$fs.copyFile(templateInfoPlist, infoPlistPath).wait();
638-
} catch (e) {
639-
this.$logger.trace("Copying template's Info.plist failed. " + e);
640-
}
641-
} else {
642-
this.$logger.trace("Info.plist: app/App_Resources/iOS/Info.plist is missing but the template " + templateInfoPlist + " is missing too, can not upgrade Info.plist.");
643-
}
644-
}
645-
646-
}).future<void>()();
627+
return Future.fromResult();
647628
}
648629

649630
private mergeInfoPlists(): IFuture<void> {

0 commit comments

Comments
 (0)