You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by jc...@apache.org on 2022/09/16 07:34:26 UTC
[cordova-android] branch master updated: fix: Add android prefix to windowSplashScreenBrandingImage (#1487)
This is an automated email from the ASF dual-hosted git repository.
jcesarmobile pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new 954d3e0e fix: Add android prefix to windowSplashScreenBrandingImage (#1487)
954d3e0e is described below
commit 954d3e0e7542356e6ea995ddc75dcb1db8bb36cc
Author: jcesarmobile <jc...@gmail.com>
AuthorDate: Fri Sep 16 09:34:20 2022 +0200
fix: Add android prefix to windowSplashScreenBrandingImage (#1487)
---
lib/prepare.js | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/lib/prepare.js b/lib/prepare.js
index 16f3c1f4..e77f0a2b 100644
--- a/lib/prepare.js
+++ b/lib/prepare.js
@@ -378,11 +378,12 @@ function updateProjectSplashScreen (platformConfig, locations) {
'windowSplashScreenAnimatedIcon',
'windowSplashScreenAnimationDuration',
'windowSplashScreenBackground',
- 'windowSplashScreenBrandingImage',
+ 'android:windowSplashScreenBrandingImage',
'windowSplashScreenIconBackgroundColor',
'postSplashScreenTheme'
].forEach(themeKey => {
- const cdvConfigPrefKey = 'Android' + themeKey.charAt(0).toUpperCase() + themeKey.slice(1);
+ const index = themeKey.indexOf(':') + 1;
+ const cdvConfigPrefKey = 'Android' + themeKey.charAt(index).toUpperCase() + themeKey.slice(index + 1);
const cdvConfigPrefValue = platformConfig.getPreference(cdvConfigPrefKey, this.platform);
let themeTargetNode = splashScreenTheme.find(`item[@name="${themeKey}"]`);
@@ -411,7 +412,7 @@ function updateProjectSplashScreen (platformConfig, locations) {
updateProjectSplashScreenImage(locations, themeKey, cdvConfigPrefKey, cdvConfigPrefValue);
break;
- case 'windowSplashScreenBrandingImage':
+ case 'android:windowSplashScreenBrandingImage':
// display warning only when set.
if (cdvConfigPrefValue) {
events.emit('warn', `"${themeKey}" is currently not supported by the splash screen compatibility library. https://issuetracker.google.com/issues/194301890`);
@@ -422,13 +423,14 @@ function updateProjectSplashScreen (platformConfig, locations) {
// force the themes value to `@color/cdv_splashscreen_icon_background`
if (!cdvConfigPrefValue && themeTargetNode) {
splashScreenTheme.remove(themeTargetNode);
+ delete themes.getroot().attrib['xmlns:tools'];
} else if (cdvConfigPrefValue) {
// if there is no current node, create a new node.
if (!themeTargetNode) {
- themeTargetNode = themes.getroot().makeelement('item', { name: themeKey });
+ themeTargetNode = themes.getroot().makeelement('item', { name: themeKey, 'tools:targetApi': '31' });
splashScreenTheme.append(themeTargetNode);
+ themes.getroot().attrib['xmlns:tools'] = 'http://schemas.android.com/tools';
}
-
// set the user defined color.
themeTargetNode.text = '@drawable/ic_cdv_splashscreen_branding';
}
@@ -537,7 +539,7 @@ function cleanupAndSetProjectSplashScreenImage (srcFile, destFilePath, possibleP
function updateProjectSplashScreenImage (locations, themeKey, cdvConfigPrefKey, cdvConfigPrefValue = '') {
const SPLASH_SCREEN_IMAGE_BY_THEME_KEY = {
windowSplashScreenAnimatedIcon: 'ic_cdv_splashscreen',
- windowSplashScreenBrandingImage: 'ic_cdv_splashscreen_branding'
+ 'android:windowSplashScreenBrandingImage': 'ic_cdv_splashscreen_branding'
};
const destFileName = SPLASH_SCREEN_IMAGE_BY_THEME_KEY[themeKey] || null;
@@ -555,7 +557,7 @@ function updateProjectSplashScreenImage (locations, themeKey, cdvConfigPrefKey,
// Default Drawable Source File
let defaultSrcFilePath = null;
- if (themeKey !== 'windowSplashScreenBrandingImage') {
+ if (themeKey !== 'android:windowSplashScreenBrandingImage') {
try {
// coming from user project
defaultSrcFilePath = require.resolve('cordova-android/templates/project/res/drawable/' + destFileNameExt);
@@ -575,7 +577,7 @@ function updateProjectSplashScreenImage (locations, themeKey, cdvConfigPrefKey,
}
events.emit(emitType, emmitMessage);
- const cleanupOnly = themeKey === 'windowSplashScreenBrandingImage';
+ const cleanupOnly = themeKey === 'android:windowSplashScreenBrandingImage';
cleanupAndSetProjectSplashScreenImage(defaultSrcFilePath, destFilePath, possiblePreviousDestFilePath, cleanupOnly);
return;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org