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/11 00:13:06 UTC

[cordova-android] 01/01: fix: Add android prefix to windowSplashScreenBrandingImage

This is an automated email from the ASF dual-hosted git repository.

jcesarmobile pushed a commit to branch fix-branding-image
in repository https://gitbox.apache.org/repos/asf/cordova-android.git

commit 2c7566a082516cfc2d9247a2a5fcf42d4af8f366
Author: jcesarmobile <jc...@gmail.com>
AuthorDate: Sun Sep 11 02:12:49 2022 +0200

    fix: Add android prefix to windowSplashScreenBrandingImage
---
 lib/prepare.js | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lib/prepare.js b/lib/prepare.js
index 16f3c1f4..fe038ad8 100644
--- a/lib/prepare.js
+++ b/lib/prepare.js
@@ -378,14 +378,18 @@ function updateProjectSplashScreen (platformConfig, locations) {
         'windowSplashScreenAnimatedIcon',
         'windowSplashScreenAnimationDuration',
         'windowSplashScreenBackground',
-        'windowSplashScreenBrandingImage',
+        'android:windowSplashScreenBrandingImage',
         'windowSplashScreenIconBackgroundColor',
         'postSplashScreenTheme'
     ].forEach(themeKey => {
-        const cdvConfigPrefKey = 'Android' + themeKey.charAt(0).toUpperCase() + themeKey.slice(1);
+        let index = 0;
+        if (themeKey.indexOf(':') !== -1) {
+            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}"]`);
-
+        console.log('hola', cdvConfigPrefKey);
         switch (themeKey) {
         case 'windowSplashScreenBackground':
             // use the user defined value for "colors.xml"
@@ -411,7 +415,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`);
@@ -537,7 +541,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 +559,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 +579,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