[ 
https://issues.apache.org/jira/browse/CB-9287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15705134#comment-15705134
 ] 

ASF GitHub Bot commented on CB-9287:
------------------------------------

Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/212#discussion_r89996388
  
    --- Diff: template/cordova/lib/prepare.js ---
    @@ -439,6 +490,109 @@ function getUAPVersions(config) {
         };
     }
     
    +/** Checks if a targetProject matches splashscreen target name */
    +function splashScreenTargetProjectMatchesTargetName(targetProject, 
targetName) {
    +    if (targetName === SPLASH_SCREEN_DESKTOP_TARGET_NAME) {
    +        return targetProject === TARGET_PROJECT_81 || targetProject === 
TARGET_PROJECT_10;
    +    }
    +
    +    return targetProject === TARGET_PROJECT_WP81;
    +}
    +
    +/** Checks if the splash screen matches the target project
    + * @param targetName 'SplashScreen'|'SplashScreenPhone'
    + * @returns boolean */ 
    +function splashScreenTargetIs(splash, targetName) {
    +    var matchesTarget, targetImg;
    +
    +    if (splash.target) {
    +        // MRT syntax:
    +        matchesTarget = splash.target === targetName;
    +    } else {
    +        // Fall back on find by size for old non-MRT syntax:
    +        targetImg = findPlatformImage(splash.width, splash.height);
    +        matchesTarget = 
splashScreenTargetProjectMatchesTargetName(targetImg.targetProject, targetName);
    +    }
    +
    +    return matchesTarget;
    +}
    +
    +// Updates manifests to match the app splash screen image types 
(PNG/JPG/JPEG)
    +function updateSplashScreenImageExtensions(cordovaProject, locations) {
    +
    +    // Saving all extensions used for targets to verify them later
    +    var extensionsUsed = {};
    +
    +    function checkThatExtensionsAreNotMixed() {
    +        for (var target in extensionsUsed) {
    +            /*jshint loopfunc: true */
    +            if (extensionsUsed.hasOwnProperty(target)) {
    +                var extensionsUsedForTarget = extensionsUsed[target];
    +
    +                // Check that extensions are not mixed:
    +                if (extensionsUsedForTarget.length > 1 && 
extensionsUsedForTarget.some(function(item) {
    +                    return item !== extensionsUsedForTarget[0];
    +                })) {
    +                    events.emit('warn', '"' + target + '" splash screens 
have mixed file extensions which is not supported. Some of the images will not 
be used.');
    +                }
    +            }
    +        }
    +    }
    +
    +    function checkTargetMatchAndUpdateUsedExtensions(img, target) {
    +        var matchesTarget = splashScreenTargetIs(img, target);
    +
    +        if (matchesTarget === true) {
    +            extensionsUsed[target] = extensionsUsed[target] || [];
    +            
extensionsUsed[target].push(path.extname(img.src.toLowerCase()));
    +        }
    +
    +        return matchesTarget;
    +    }
    +
    +    function updateSplashExtensionInManifest(manifestFileName, 
splashScreen) {
    +        var manifest = AppxManifest.get(path.join(locations.root, 
manifestFileName));
    +        var newExtension = path.extname(splashScreen.src);
    +
    +        if (manifest.getVisualElements().getSplashScreenExtension() !== 
newExtension) {
    +            events.emit('verbose', 'Set ' + manifestFileName + ' 
SplashScreen image extension to "' + newExtension + '"');
    +            
manifest.getVisualElements().setSplashScreenExtension(newExtension);
    +            manifest.write();
    +        }
    +    }
    +
    +    var splashScreens = 
cordovaProject.projectConfig.getSplashScreens('windows');
    +
    +    var desktopSplashScreen = splashScreens.filter(function(img) { 
    +        return checkTargetMatchAndUpdateUsedExtensions(img, 
SPLASH_SCREEN_DESKTOP_TARGET_NAME);
    +    })[0];
    +
    +    var phoneSplashScreen = splashScreens.filter(function(img) { 
    +        return checkTargetMatchAndUpdateUsedExtensions(img, 
SPLASH_SCREEN_PHONE_TARGET_NAME);
    +    })[0];
    +
    +    checkThatExtensionsAreNotMixed();
    --- End diff --
    
    > You should not mix image extensions for non-MRT syntax inside one project 
group
    
    I thought it's pretty obvious :)
    
    > in this case ^ the second JPG image will not be used as AppxManifest will 
have PNG for SplashScreen.Image' extension
    
    Yep. If you specify the same splascreens using MRT and 'target' attribute, 
`splashscreen.scale-125.jpg` also would be silently ignored because 
`mapImageResources` requires extensions to match. That said I don't think we 
need to care about this at all.


> Not enough Icons and Splashscreens for Windows 8.1 and Windows Phone 8.1
> ------------------------------------------------------------------------
>
>                 Key: CB-9287
>                 URL: https://issues.apache.org/jira/browse/CB-9287
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Plugin SplashScreen, Windows
>    Affects Versions: 4.0.0
>         Environment: Cordova 4.0.0, Windows Platform 3.7.1
>            Reporter: Dennis Patzer
>            Assignee: Jesse MacFadyen
>              Labels: triaged, windows
>         Attachments: splashscreens_windows_universal_app.jpg
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> For some reason, for example only one splashscreen size is supported 
> (620x300). When I add other sizes by adding the following line:
> <splash 
> src="../resources/themes/windows-phone/img/splashscreen/splashscreen.scale-140.png"
>  width="868" height="420" />
> The image isn't copied to the cordova/platforms/windows/images folder when 
> building. This is the reason why it's also not included and referenced in the 
> resulting package.windows.appxmanifest.
> Why is that?? Or am I doing something wrong?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to