chore: display warning on deprecated <splash> tag usage (#1451)

* chore: display warning on deprecated <splash> tag usage
* test: create spy on warnForDeprecatedSplashScreen
This commit is contained in:
エリス
2022-06-30 20:00:25 +09:00
committed by GitHub
parent 606e9c4826
commit 273d1bdecd
2 changed files with 15 additions and 0 deletions
+11
View File
@@ -63,6 +63,7 @@ module.exports.prepare = function (cordovaProject, options) {
// Update own www dir with project's www assets and plugins' assets and js-files
return Promise.resolve(updateWww(cordovaProject, this.locations))
.then(() => warnForDeprecatedSplashScreen(cordovaProject))
.then(() => updateProjectAccordingTo(self._config, self.locations))
.then(function () {
updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
@@ -353,6 +354,16 @@ function updateProjectStrings (platformConfig, locations) {
events.emit('verbose', 'Wrote out android application name "' + name + '" to ' + locations.strings);
}
function warnForDeprecatedSplashScreen (cordovaProject) {
const hasOldSplashTags = (
cordovaProject.projectConfig.doc.findall('./platform[@name="android"]/splash') || []
).length > 0;
if (hasOldSplashTags) {
events.emit('warn', 'The "<splash>" tags were detected and are no longer supported. Please migrate to the "preference" tag "AndroidWindowSplashScreenAnimatedIcon".');
}
}
/**
* @param {ConfigParser} platformConfig A project's configuration that will
* be used to update project