[ https://issues.apache.org/jira/browse/CB-9287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15705133#comment-15705133 ]
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_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 > 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