cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] git commit: CB-6684 [3.5.0rc][Windows8] Splash screen setting breaks the build
Date Tue, 13 May 2014 23:02:50 GMT
Repository: cordova-windows
Updated Branches:
  refs/heads/3.5.x b2596302c -> 1b572662d
Updated Tags:  refs/tags/3.5.0 [created] 1b572662d


CB-6684 [3.5.0rc][Windows8] Splash screen setting breaks the build


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/d3dd1803
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/d3dd1803
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/d3dd1803

Branch: refs/heads/3.5.x
Commit: d3dd1803aa7d8474aadbcb850ed0a572d23bb71a
Parents: 27cb729
Author: sgrebnov <v-segreb@microsoft.com>
Authored: Tue May 13 14:40:16 2014 -0700
Committer: sgrebnov <v-segreb@microsoft.com>
Committed: Tue May 13 14:40:16 2014 -0700

----------------------------------------------------------------------
 .../cordova/lib/ApplyPlatformConfig.ps1         | 104 +++++++++++--------
 1 file changed, 62 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/d3dd1803/windows8/template/cordova/lib/ApplyPlatformConfig.ps1
----------------------------------------------------------------------
diff --git a/windows8/template/cordova/lib/ApplyPlatformConfig.ps1 b/windows8/template/cordova/lib/ApplyPlatformConfig.ps1
index 5fc432e..0b89dda 100644
--- a/windows8/template/cordova/lib/ApplyPlatformConfig.ps1
+++ b/windows8/template/cordova/lib/ApplyPlatformConfig.ps1
@@ -32,8 +32,8 @@ $manifestFile = "$platformRoot\package.appxmanifest"
 
 # Replace app start page with config.xml setting.
 if($config.widget.content -and $config.widget.content.src) {
-	$startPage = $config.widget.content.src
-	$manifest.Package.Applications.Application.StartPage = "www/$startpage"
+    $startPage = $config.widget.content.src
+    $manifest.Package.Applications.Application.StartPage = "www/$startpage"
 }
 
 # Add domain whitelist rules
@@ -45,7 +45,7 @@ $NS = $manifest.DocumentElement.NamespaceURI
 # Remove existing rules from manifest
 
 if ($rules) { 
-	$manifest.Package.Applications.Application.RemoveChild($rules)
+    $manifest.Package.Applications.Application.RemoveChild($rules)
 }
 
 if ($acls -and ($acls -notcontains "*")) {
@@ -59,43 +59,63 @@ if ($acls -and ($acls -notcontains "*")) {
     }
 }
 
-# Format splash screen to windows8 format
+# Splash screen support
 $configSplashScreen = $config.SelectNodes('//*[local-name()="preference"][@name="SplashScreen"]').value
 if($configSplashScreen) 
 {
-	"Setting SplashScreen = $configSplashScreen"
-	$manifest.Package.Applications.Application.VisualElements.SplashScreen.Image = [string]$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) 
 {
-	"Setting SplashScreenBackgroundColor = $configSplashScreenBGColor"
+    "Setting SplashScreenBackgroundColor = $configSplashScreenBGColor"
 
-	$bgColor = ($configSplashScreenBGColor -replace "0x", "") -replace "#", ""
+    $bgColor = ($configSplashScreenBGColor -replace "0x", "") -replace "#", ""
 
-	# Double all bytes if color specified as "fff"
-	if ($bgColor.Length -eq 3) {
-		$bgColor = $bgColor[0] + $bgColor[0] + $bgColor[1] + $bgColor[1] + $bgColor[2] + $bgColor[2]

-	}
+    # Double all bytes if color specified as "fff"
+    if ($bgColor.Length -eq 3) {
+        $bgColor = $bgColor[0] + $bgColor[0] + $bgColor[1] + $bgColor[1] + $bgColor[2] +
$bgColor[2] 
+    }
 
-	# Parse hex representation to array of color bytes [b, g, r, a]
-	$colorBytes = [System.BitConverter]::GetBytes(
-		[int]::Parse($bgColor,
-		[System.Globalization.NumberStyles]::HexNumber))
+    # Parse hex representation to array of color bytes [b, g, r, a]
+    $colorBytes = [System.BitConverter]::GetBytes(
+        [int]::Parse($bgColor,
+        [System.Globalization.NumberStyles]::HexNumber))
 
-	Add-Type -AssemblyName PresentationCore
+    Add-Type -AssemblyName PresentationCore
 
-	# Create new Color object ignoring alpha, because windows 8 doesn't support it
-	# see http://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx
-	$color = ([System.Windows.Media.Color]::FromRgb(
-		$colorBytes[2], $colorBytes[1], $colorBytes[0]
-		# FromRGB method add 100% alpha, so we remove it from resulting string
-		).ToString()) -replace "#FF", "#"
+    # Create new Color object ignoring alpha, because windows 8 doesn't support it
+    # see http://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx
+    $color = ([System.Windows.Media.Color]::FromRgb(
+        $colorBytes[2], $colorBytes[1], $colorBytes[0]
+        # FromRGB method add 100% alpha, so we remove it from resulting string
+        ).ToString()) -replace "#FF", "#"
 
-	$manifest.Package.Applications.Application.VisualElements.SplashScreen.BackgroundColor =
[string]$color
+    $manifest.Package.Applications.Application.VisualElements.SplashScreen.BackgroundColor
= [string]$color
 }
 
 
@@ -104,29 +124,29 @@ $configBgColor = $config.SelectNodes('//*[local-name()="preference"][@name="Back
 
 if($configBgColor) 
 {
-	"Setting BackgroundColor = $configBgColor"
-	$bgColor = ($configBgColor -replace "0x", "") -replace "#", ""
+    "Setting BackgroundColor = $configBgColor"
+    $bgColor = ($configBgColor -replace "0x", "") -replace "#", ""
 
-	# Double all bytes if color specified as "fff"
-	if ($bgColor.Length -eq 3) {
-		$bgColor = $bgColor[0] + $bgColor[0] + $bgColor[1] + $bgColor[1] + $bgColor[2] + $bgColor[2]

-	}
+    # Double all bytes if color specified as "fff"
+    if ($bgColor.Length -eq 3) {
+        $bgColor = $bgColor[0] + $bgColor[0] + $bgColor[1] + $bgColor[1] + $bgColor[2] +
$bgColor[2] 
+    }
 
-	# Parse hex representation to array of color bytes [b, g, r, a]
-	$colorBytes = [System.BitConverter]::GetBytes(
-		[int]::Parse($bgColor,
-		[System.Globalization.NumberStyles]::HexNumber))
+    # Parse hex representation to array of color bytes [b, g, r, a]
+    $colorBytes = [System.BitConverter]::GetBytes(
+        [int]::Parse($bgColor,
+        [System.Globalization.NumberStyles]::HexNumber))
 
-	Add-Type -AssemblyName PresentationCore
+    Add-Type -AssemblyName PresentationCore
 
-	# Create new Color object ignoring alpha, because windows 8 doesn't support it
-	# see http://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx
-	$color = ([System.Windows.Media.Color]::FromRgb(
-		$colorBytes[2], $colorBytes[1], $colorBytes[0]
-		# FromRGB method add 100% alpha, so we remove it from resulting string
-		).ToString()) -replace "#FF", "#"
+    # Create new Color object ignoring alpha, because windows 8 doesn't support it
+    # see http://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx
+    $color = ([System.Windows.Media.Color]::FromRgb(
+        $colorBytes[2], $colorBytes[1], $colorBytes[0]
+        # FromRGB method add 100% alpha, so we remove it from resulting string
+        ).ToString()) -replace "#FF", "#"
 
-	$manifest.Package.Applications.Application.VisualElements.BackgroundColor = [string]$color
+    $manifest.Package.Applications.Application.VisualElements.BackgroundColor = [string]$color
 }
 
 # Write modified manifest file


Mime
View raw message