Skip to content

Commit

Permalink
chore: split windowSplashScreenAnimatedIcon and windowSplashScreenBra…
Browse files Browse the repository at this point in the history
…ndingImage case and added branding warning
  • Loading branch information
erisu committed Jun 27, 2022
1 parent 4959188 commit 126b735
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ function updateProjectSplashScreen (platformConfig, locations) {
break;

case 'windowSplashScreenAnimatedIcon':
case 'windowSplashScreenBrandingImage':
// handle here the cases of "png" vs "xml" (drawable)
// If "png":
// - Clear out default or previous set "drawable/ic_cdv_splashscreen.xml" if exisiting.
Expand All @@ -398,22 +397,26 @@ function updateProjectSplashScreen (platformConfig, locations) {
// value should change depending on case:
// If "png": "@mipmap/ic_cdv_splashscreen"
// If "xml": "@drawable/ic_cdv_splashscreen"
updateProjectSplashScreenImage(locations, themeKey, cdvConfigPrefKey, cdvConfigPrefValue);
break;

case 'windowSplashScreenBrandingImage':
events.emit('warn', `"${themeKey}" is currently not supported by the splash screen compatibility library. https://issuetracker.google.com/issues/194301890`);

updateProjectSplashScreenImage(locations, themeKey, cdvConfigPrefKey, cdvConfigPrefValue);

if (themeKey === 'windowSplashScreenBrandingImage') {
// force the themes value to `@color/cdv_splashscreen_icon_background`
if (!cdvConfigPrefValue && themeTargetNode) {
splashScreenTheme.remove(themeTargetNode);
} else if (cdvConfigPrefValue) {
// if there is no current node, create a new node.
if (!themeTargetNode) {
themeTargetNode = themes.getroot().makeelement('item', { name: themeKey });
splashScreenTheme.append(themeTargetNode);
}

// set the user defined color.
themeTargetNode.text = '@drawable/ic_cdv_splashscreen_branding';
// force the themes value to `@color/cdv_splashscreen_icon_background`
if (!cdvConfigPrefValue && themeTargetNode) {
splashScreenTheme.remove(themeTargetNode);
} else if (cdvConfigPrefValue) {
// if there is no current node, create a new node.
if (!themeTargetNode) {
themeTargetNode = themes.getroot().makeelement('item', { name: themeKey });
splashScreenTheme.append(themeTargetNode);
}

// set the user defined color.
themeTargetNode.text = '@drawable/ic_cdv_splashscreen_branding';
}
break;

Expand Down

0 comments on commit 126b735

Please sign in to comment.