Skip to content

Commit

Permalink
feat(splash): Support SplashScreenBackgroundColor preference
Browse files Browse the repository at this point in the history
  • Loading branch information
dpogue committed Mar 31, 2024
1 parent 4742358 commit 1782ad8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,20 @@ function updateProjectSplashScreen (platformConfig, locations) {
const themes = xmlHelpers.parseElementtreeSync(locations.themes);
const splashScreenTheme = themes.find('style[@name="Theme.App.SplashScreen"]');

let splashBg = platformConfig.getPreference('AndroidWindowSplashScreenBackground', this.platform);
splashBg ??= platformConfig.getPreference('SplashScreenBackgroundColor', this.platform);
splashBg ??= platformConfig.getPreference('BackgroundColor', this.platform);

// use the user defined value for "colors.xml"
updateProjectSplashScreenBackgroundColor(splashBg, locations);

// force the themes value to `@color/cdv_splashscreen_background`
const splashBgNode = splashScreenTheme.find('item[@name="windowSplashScreenBackground"]');
splashBgNode.text = '@color/cdv_splashscreen_background';

[
'windowSplashScreenAnimatedIcon',
'windowSplashScreenAnimationDuration',
'windowSplashScreenBackground',
'android:windowSplashScreenBrandingImage',
'windowSplashScreenIconBackgroundColor',
'postSplashScreenTheme'
Expand All @@ -392,14 +402,6 @@ function updateProjectSplashScreen (platformConfig, locations) {
let themeTargetNode = splashScreenTheme.find(`item[@name="${themeKey}"]`);

switch (themeKey) {
case 'windowSplashScreenBackground':
// use the user defined value for "colors.xml"
updateProjectSplashScreenBackgroundColor(cdvConfigPrefValue, locations);

// force the themes value to `@color/cdv_splashscreen_background`
themeTargetNode.text = '@color/cdv_splashscreen_background';
break;

case 'windowSplashScreenAnimatedIcon':
// handle here the cases of "png" vs "xml" (drawable)
// If "png":
Expand Down

0 comments on commit 1782ad8

Please sign in to comment.