Skip to content

Commit

Permalink
fix(prepare): delete splash screens if none are used (apache#1227)
Browse files Browse the repository at this point in the history
Currently, we copy default splash screens to the platform folder during platform creation, but then we do not delete them when the user uses no splash screens at all. This causes apache#1226 and what is described in apache#689.

The new implementation does not return early when updating splashes and none are defined. Instead, we let the cleanup map we create initially take care of deleting all unused splash screens. This also deletes the default splashes during the first prepare after platform creation.

Fixes apache#1226
  • Loading branch information
raphinesse authored and wedgberto committed May 17, 2022
1 parent abaab4e commit 4681cda
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bin/templates/cordova/lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,13 @@ function makeSplashCleanupMap (projectRoot, resourcesDir) {
function updateSplashes (cordovaProject, platformResourcesDir) {
var resources = cordovaProject.projectConfig.getSplashScreens('android');

// if there are "splash" elements in config.xml
// if there are no "splash" elements in config.xml
if (resources.length === 0) {
events.emit('verbose', 'This app does not have splash screens defined');
return;
// We must not return here!
// If the user defines no splash screens, the cleanup map will cause any
// existing splash screen images (e.g. the defaults that we copy into a
// new app) to be removed from the app folder, which is what we want.
}

// Build an initial resource map that deletes all existing splash screens
Expand Down

0 comments on commit 4681cda

Please sign in to comment.