Skip to content

Commit 7fa4a65

Browse files
authoredMay 9, 2024··
feat(splash): Support SplashScreenBackgroundColor preference (#1700)
1 parent b773ae4 commit 7fa4a65

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed
 

‎lib/prepare.js

+15-9
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,24 @@ function updateProjectSplashScreen (platformConfig, locations) {
378378
const themes = xmlHelpers.parseElementtreeSync(locations.themes);
379379
const splashScreenTheme = themes.find('style[@name="Theme.App.SplashScreen"]');
380380

381+
let splashBg = platformConfig.getPreference('AndroidWindowSplashScreenBackground', this.platform);
382+
if (!splashBg) {
383+
splashBg = platformConfig.getPreference('SplashScreenBackgroundColor', this.platform);
384+
}
385+
if (!splashBg) {
386+
splashBg = platformConfig.getPreference('BackgroundColor', this.platform);
387+
}
388+
389+
// use the user defined value for "colors.xml"
390+
updateProjectSplashScreenBackgroundColor(splashBg, locations);
391+
392+
// force the themes value to `@color/cdv_splashscreen_background`
393+
const splashBgNode = splashScreenTheme.find('item[@name="windowSplashScreenBackground"]');
394+
splashBgNode.text = '@color/cdv_splashscreen_background';
395+
381396
[
382397
'windowSplashScreenAnimatedIcon',
383398
'windowSplashScreenAnimationDuration',
384-
'windowSplashScreenBackground',
385399
'android:windowSplashScreenBrandingImage',
386400
'windowSplashScreenIconBackgroundColor',
387401
'postSplashScreenTheme'
@@ -392,14 +406,6 @@ function updateProjectSplashScreen (platformConfig, locations) {
392406
let themeTargetNode = splashScreenTheme.find(`item[@name="${themeKey}"]`);
393407

394408
switch (themeKey) {
395-
case 'windowSplashScreenBackground':
396-
// use the user defined value for "colors.xml"
397-
updateProjectSplashScreenBackgroundColor(cdvConfigPrefValue, locations);
398-
399-
// force the themes value to `@color/cdv_splashscreen_background`
400-
themeTargetNode.text = '@color/cdv_splashscreen_background';
401-
break;
402-
403409
case 'windowSplashScreenAnimatedIcon':
404410
// handle here the cases of "png" vs "xml" (drawable)
405411
// If "png":

0 commit comments

Comments
 (0)
Please sign in to comment.