[
https://issues.apache.org/jira/browse/CB-9287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15705135#comment-15705135
]
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_r89992916
--- Diff: template/cordova/lib/prepare.js ---
@@ -297,48 +305,80 @@ function applyNavigationWhitelist(config, manifest) {
manifest.getApplication().setAccessRules(whitelistRules);
}
-function mapImageResources(images, imagesDir) {
- var pathMap = {};
+// Platform default images
+var platformImages = [
+ {dest: 'Square150x150Logo.scale-100', width: 150, height: 150},
+ {dest: 'Square30x30Logo.scale-100', width: 30, height: 30},
+ {dest: 'StoreLogo.scale-100', width: 50, height: 50},
+ {dest: 'SplashScreen.scale-100', width: 620, height: 300,
targetProject: TARGET_PROJECT_10},
+ {dest: 'SplashScreen.scale-125', width: 775, height: 375,
targetProject: TARGET_PROJECT_10},
+ {dest: 'SplashScreen.scale-140', width: 868, height: 420,
targetProject: TARGET_PROJECT_81},
+ {dest: 'SplashScreen.scale-150', width: 930, height: 450,
targetProject: TARGET_PROJECT_10},
+ {dest: 'SplashScreen.scale-180', width: 1116, height: 540,
targetProject: TARGET_PROJECT_81},
+ {dest: 'SplashScreen.scale-200', width: 1240, height: 600,
targetProject: TARGET_PROJECT_10},
+ {dest: 'SplashScreen.scale-400', width: 2480, height: 1200,
targetProject: TARGET_PROJECT_10},
+ // scaled images are specified here for backward compatibility only so
we can find them by size
+ {dest: 'StoreLogo.scale-240', width: 120, height: 120},
+ {dest: 'Square44x44Logo.scale-100', width: 44, height: 44},
+ {dest: 'Square44x44Logo.scale-240', width: 106, height: 106},
+ {dest: 'Square70x70Logo.scale-100', width: 70, height: 70},
+ {dest: 'Square71x71Logo.scale-100', width: 71, height: 71},
+ {dest: 'Square71x71Logo.scale-240', width: 170, height: 170},
+ {dest: 'Square150x150Logo.scale-240', width: 360, height: 360},
+ {dest: 'Square310x310Logo.scale-100', width: 310, height: 310},
+ {dest: 'Wide310x150Logo.scale-100', width: 310, height: 150},
+ {dest: 'Wide310x150Logo.scale-240', width: 744, height: 360},
+ {dest: 'SplashScreenPhone.scale-100', width: 480, height: 800,
targetProject: TARGET_PROJECT_WP81},
+ {dest: 'SplashScreenPhone.scale-140', width: 672, height: 1120,
targetProject: TARGET_PROJECT_WP81},
+ {dest: 'SplashScreenPhone.scale-240', width: 1152, height: 1920,
targetProject: TARGET_PROJECT_WP81}
+];
+
+function findPlatformImage(width, height) {
+ if (!width && !height){
+ // this could be default image,
+ // Windows requires specific image dimension so we can't apply it
+ return null;
+ }
+ for (var idx in platformImages){
+ var res = platformImages[idx];
+ // If only one of width or height is not specified, use another
parameter for comparation
+ // If both specified, compare both.
+ if ((!width || (width == res.width)) &&
+ (!height || (height == res.height))){
+ return res;
+ }
+ }
+ return null;
+}
- // Platform default images
- var platformImages = [
- {dest: 'Square150x150Logo.scale-100.png', width: 150, height: 150},
- {dest: 'Square30x30Logo.scale-100.png', width: 30, height: 30},
- {dest: 'StoreLogo.scale-100.png', width: 50, height: 50},
- {dest: 'SplashScreen.scale-100.png', width: 620, height: 300},
- // scaled images are specified here for backward compatibility
only so we can find them by size
- {dest: 'StoreLogo.scale-240.png', width: 120, height: 120},
- {dest: 'Square44x44Logo.scale-100.png', width: 44, height: 44},
- {dest: 'Square44x44Logo.scale-240.png', width: 106, height: 106},
- {dest: 'Square70x70Logo.scale-100.png', width: 70, height: 70},
- {dest: 'Square71x71Logo.scale-100.png', width: 71, height: 71},
- {dest: 'Square71x71Logo.scale-240.png', width: 170, height: 170},
- {dest: 'Square150x150Logo.scale-240.png', width: 360, height: 360},
- {dest: 'Square310x310Logo.scale-100.png', width: 310, height: 310},
- {dest: 'Wide310x150Logo.scale-100.png', width: 310, height: 150},
- {dest: 'Wide310x150Logo.scale-240.png', width: 744, height: 360},
- {dest: 'SplashScreenPhone.scale-240.png', width: 1152, height:
1920}
- ];
+/** Maps MRT splashscreen image to its target project defined in
platformImages -> 8.1|WP8.1|10
+ * This assumes we have different scales used for 8.1 and 10 projects.
+ * The only intersection is scale-100, which is treated as Win10 project'
splashscreen (because
+ * size limit applies to Win10 project so we'll need to check it).
+ */
+function mrtSplashScreenToTargetProject(mrtImage) {
+ var matchingSplashScreen = platformImages.filter(function (img) {
+ return img.dest.indexOf('SplashScreen') !== -1 &&
--- End diff --
There is a `MRTImage.prototype.generateFilenameFrom` method that returns a
file name for MRT image, so you could just compare it with `img.dest`. Also ypu
probably need to use `mrtImage.basename` instead of hardcoded `SplashScreen`
string
> 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: [email protected]
For additional commands, e-mail: [email protected]