You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2014/07/04 18:17:58 UTC
git commit: CB-6976 support for new splash screen and icon images
Repository: cordova-windows
Updated Branches:
refs/heads/master 1215a84fd -> 9fc79fd5f
CB-6976 support for new splash screen and icon images
Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/9fc79fd5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/9fc79fd5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/9fc79fd5
Branch: refs/heads/master
Commit: 9fc79fd5f9d3d2f03493880de336bd00694edaaa
Parents: 1215a84
Author: sgrebnov <v-...@microsoft.com>
Authored: Fri Jul 4 20:17:37 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Fri Jul 4 20:17:37 2014 +0400
----------------------------------------------------------------------
.../cordova/lib/ApplyPlatformConfig.ps1 | 130 ++++++++++++++-----
1 file changed, 99 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/9fc79fd5/windows/template/cordova/lib/ApplyPlatformConfig.ps1
----------------------------------------------------------------------
diff --git a/windows/template/cordova/lib/ApplyPlatformConfig.ps1 b/windows/template/cordova/lib/ApplyPlatformConfig.ps1
index 33d18de..310c15b 100644
--- a/windows/template/cordova/lib/ApplyPlatformConfig.ps1
+++ b/windows/template/cordova/lib/ApplyPlatformConfig.ps1
@@ -114,36 +114,6 @@ Function UpdateManifest ($manifestFile)
}
}
- # Splash screen support
- $configSplashScreen = $config.SelectNodes('//*[local-name()="preference"][@name="SplashScreen"]').value
- if($configSplashScreen)
- {
- "Setting SplashScreen = $configSplashScreen"
- $imgPath = $null;
-
- # do search relative to platform and app folders
- foreach ($testPath in @($configSplashScreen, "..\..\$configSplashScreen"))
- {
- $testPath = join-path $platformRoot $testPath
-
- if (Test-Path -PathType Leaf $testPath)
- {
- $imgPath = $testPath;
- break
- }
- }
-
- if ($imgPath -eq $null)
- {
- "Unable to locate splash image: $configSplashScreen"
- } else {
- # Default splash screen is stored as 'images\splashscreen.png'
- # http://msdn.microsoft.com/en-us/library/windows/apps/hh465346.aspx
- Copy-Item $imgPath -Destination (join-path $platformRoot "images\splashscreen.png")
- }
-
- }
-
# Format splash screen background color to windows8 format
$configSplashScreenBGColor = $config.SelectNodes('//*[local-name()="preference"][@name="SplashScreenBackgroundColor"]').value
if($configSplashScreenBGColor)
@@ -211,6 +181,104 @@ Function UpdateManifest ($manifestFile)
$xmlWriter.Close()
}
+Function CopyImage($src, $dest)
+{
+ $resolvedPath = $null;
+
+ # do search relative to platform and app folders
+ foreach ($testPath in @($src, "..\..\$src"))
+ {
+ $testPath = join-path $platformRoot $testPath
+ if (Test-Path -PathType Leaf $testPath)
+ {
+ $resolvedPath = $testPath;
+ break
+ }
+ }
+
+ if ($resolvedPath -eq $null)
+ {
+ Write-Host "Image doesn't exist: $src"
+ return
+ }
+ Copy-Item $resolvedPath -Destination (join-path $platformRoot $dest)
+}
+
+Function UpdateAssets ()
+{
+ $configFile = "$platformRoot\config.xml"
+ [xml]$config = Get-Content $configFile
+
+ # Splash screen images
+ $splashScreens = $config.SelectNodes('//*[local-name()="splash"]')
+
+ foreach ($splash in $splashScreens)
+ {
+ $width = $splash.getAttribute("width")
+ $height= $splash.getAttribute("height")
+ $src = $splash.getAttribute("src")
+ if ($width -eq 620 -and $height -eq 300) {
+ CopyImage $src "images/splashscreen.png"
+ continue
+ }
+ if ($width -eq 1152 -and $height -eq 1920) {
+ CopyImage $src "images/SplashScreen.scale-240.png"
+ continue
+ }
+ Write-Host "Unknown image ($src) size, skip"
+ }
+
+ # App icons
+ $configIcons= $config.SelectNodes('//*[local-name()="icon"]')
+
+ foreach ($icon in $configIcons)
+ {
+ $width = $icon.getAttribute("width")
+ $height= $icon.getAttribute("height")
+ $src = $icon.getAttribute("src")
+
+ if ($width -eq 150) {
+ CopyImage $src "images/logo.png"
+ continue
+ }
+ if ($width -eq 30) {
+ CopyImage $src "images/smalllogo.png"
+ continue
+ }
+ if ($width -eq 50) {
+ CopyImage $src "images/storelogo.png"
+ continue
+ }
+ if ($width -eq 120) {
+ CopyImage $src "images/StoreLogo.scale-240.png"
+ continue
+ }
+
+ if ($width -eq 106) {
+ CopyImage $src "images/Square44x44Logo.scale-240.png"
+ continue
+ }
+ if ($width -eq 170) {
+ CopyImage $src "images/Square71x71Logo.scale-240.png"
+ continue
+ }
+ if ($width -eq 360) {
+ CopyImage $src "images/Square150x150Logo.scale-240.png"
+ continue
+ }
+ if ($width -eq 744 -and $height -eq 360) {
+ CopyImage $src "images/Wide310x150Logo.scale-240.png"
+ continue
+ }
+
+ Write-Host "Unknown image ($src) size, skip"
+ }
+
+}
+
UpdateManifest "$platformRoot\package.store.appxmanifest"
UpdateManifest "$platformRoot\package.store80.appxmanifest"
-UpdateManifest "$platformRoot\package.phone.appxmanifest"
\ No newline at end of file
+UpdateManifest "$platformRoot\package.phone.appxmanifest"
+
+# replace splash screen images and icons
+UpdateAssets