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

    https://github.com/apache/cordova-windows/pull/212#discussion_r89994632
  
    --- Diff: template/cordova/lib/prepare.js ---
    @@ -439,6 +492,107 @@ 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  {Object} splash SplashScreen object to check
    + * @param  {String} targetName SplashScreen target name: 
'SplashScreen'|'SplashScreenPhone'
    + * @returns {Boolean} True if the splash screen matches the target project
    + */
    +function splashScreenTargetIs(splash, targetName) {
    +    var targetImg;
    +
    +    if (splash.target) {
    +        // MRT syntax:
    +        return splash.target === targetName;
    +    } 
    +
    +    // Fall back on find by size for old non-MRT syntax:
    +    targetImg = findPlatformImage(splash.width, splash.height);
    +    return 
splashScreenTargetProjectMatchesTargetName(targetImg.targetProject, targetName);
    +}
    +
    +// 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);
    --- End diff --
    
    IMO it's not very clear, what is `splashScreenTargetIs` function for and 
what values it can return. I'd suggest to rework this in the following way:
    1. have a function that returns a target project based on image `target` or 
dimensions (e.g. `getTargetForImage`)
    2. do a comparison of that function's result and `target` variable here so 
it's be clear that we expect result to match target



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to