Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 0215d75

Browse files
author
msrodri
committed
Merge pull request #22 from manifoldjs/v0.1.1
v0.1.1
2 parents 6837d37 + e5b2c33 commit 0215d75

17 files changed

+424
-68
lines changed
-25.1 KB
Loading
1.79 KB
Loading
3.17 KB
Loading
-9.79 KB
Loading

assets/windows/wrapper.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/windows/wrapper.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<html>
2+
<head>
3+
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
4+
<meta name="format-detection" content="telephone=no">
5+
<meta name="msapplication-tap-highlight" content="no">
6+
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
7+
<link rel="stylesheet" type="text/css" href="css/wrapper.css">
8+
<title>Hello World</title>
9+
</head>
10+
<body>
11+
<div id="extendedSplashScreen" class="extendedSplashScreen" style="background-color: #464646; height:100%">
12+
<img class="extendedSplashImage" src="/images/SplashScreen.scale-100.png" alt="Launching..." />
13+
<progress class="loading-progress"></progress>
14+
</div>
15+
16+
<script type="text/javascript" src="cordova.js"></script>
17+
<script type="text/javascript" src="js/wrapper.js"></script>
18+
</body>
19+
</html>

assets/windows/wrapper.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
var setupExtendedSplashScreen, updateSplashScreenPositioning,
2+
splashScreen, splashScreenEl, splashScreenImageEl,
3+
isWindows = navigator.appVersion.indexOf("Windows Phone 8.1") === -1;
4+
5+
WinJS.Application.addEventListener("activated", function (e) {
6+
if (e.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {
7+
splashScreen = e.detail.splashScreen;
8+
9+
// Listen for window resize events to reposition the extended splash screen image accordingly.
10+
// This is important to ensure that the extended splash screen is formatted properly in response to snapping, unsnapping, rotation, etc...
11+
window.addEventListener("resize", updateSplashPositioning, false);
12+
13+
var previousExecutionState = e.detail.previousExecutionState;
14+
var state = Windows.ApplicationModel.Activation.ApplicationExecutionState;
15+
if (previousExecutionState === state.notRunning
16+
|| previousExecutionState === state.terminated
17+
|| previousExecutionState === state.closedByUser) {
18+
setupExtendedSplashScreen();
19+
}
20+
}
21+
}, false);
22+
23+
setupExtendedSplashScreen = function () {
24+
splashScreenEl = document.getElementById("extendedSplashScreen");
25+
splashScreenImageEl = (splashScreenEl && splashScreenEl.querySelector(".extendedSplashImage"));
26+
splashLoadingEl = (splashScreenEl && splashScreenEl.querySelector(".loading-progress"));
27+
28+
if (!splashScreen || !splashScreenEl || !splashScreenImageEl) { return; }
29+
30+
var imgSrc = "/images/splashScreenPhone.png"
31+
if (isWindows) {
32+
imgSrc = "/images/SplashScreen.png"
33+
}
34+
35+
splashScreenImageEl.setAttribute("src", imgSrc);
36+
37+
updateSplashPositioning();
38+
39+
// Once the extended splash screen is setup, apply the CSS style that will make the extended splash screen visible.
40+
splashScreenEl.style.display = "block";
41+
};
42+
43+
updateSplashPositioning = function () {
44+
if (!splashScreen || !splashScreenImageEl) { return; }
45+
// Position the extended splash screen image in the same location as the system splash screen image.
46+
if (isWindows) {
47+
splashScreenImageEl.style.top = splashScreen.imageLocation.y + "px";
48+
splashScreenImageEl.style.left = splashScreen.imageLocation.x + "px";
49+
splashScreenImageEl.style.height = splashScreen.imageLocation.height + "px";
50+
splashScreenImageEl.style.width = splashScreen.imageLocation.width + "px";
51+
} else {
52+
var curOrientation = Windows.Devices.Sensors.SimpleOrientationSensor.getDefault().getCurrentOrientation();
53+
if ((curOrientation == Windows.Devices.Sensors.SimpleOrientation.rotated270DegreesCounterclockwise || curOrientation == Windows.Devices.Sensors.SimpleOrientation.rotated90DegreesCounterclockwise) &&
54+
Windows.Graphics.Display.DisplayInformation.autoRotationPreferences != Windows.Graphics.Display.DisplayOrientations.portrait) {
55+
splashScreenImageEl.src = "/images/splashscreen.png";
56+
} else {
57+
splashScreenImageEl.src = "/images/splashScreenPhone.png";
58+
}
59+
splashScreenImageEl.style.width = "100%";
60+
splashScreenImageEl.style.height = "100%";
61+
}
62+
63+
if (splashLoadingEl) {
64+
if (isWindows) {
65+
splashLoadingEl.style.top = (splashScreen.imageLocation.y + splashScreen.imageLocation.height + 20) + "px";
66+
} else {
67+
splashLoadingEl.style.top = (window.innerHeight * 0.8) + "px";
68+
}
69+
}
70+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cordova-plugin-hostedwebapp",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Hosted Web App Plugin",
55
"cordova": {
66
"id": "cordova-plugin-hostedwebapp",

plugin.xml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
33
id="cordova-plugin-hostedwebapp"
4-
version="0.1.0">
4+
version="0.1.1">
55
<name>HostedWebApp</name>
66
<description>Hosted Web App Plugin</description>
77
<license>MIT License</license>
@@ -11,15 +11,22 @@
1111

1212
<dependency id="cordova-plugin-whitelist" version=">=1.0.1" />
1313
<dependency id="cordova-plugin-network-information" version=">=1.0.0" />
14-
15-
<hook type="before_prepare" src="scripts/updateConfiguration.js" />
14+
15+
<hook type="before_prepare" src="scripts/updateConfigurationBeforePrepare.js" />
1616
<hook type="after_prepare" src="scripts/updateConfigurationAfterPrepare.js" />
17-
<hook type="after_build" src="scripts/updateConfigurationAfterBuild.js" />
18-
17+
<hook type="after_prepare" src="scripts/replaceWindowsWrapperFiles.js" />
18+
<hook type="before_plugin_rm" src="scripts/rollbackWindowsWrapperFiles.js" />
19+
1920
<js-module src="www/hostedWebApp.js" name="hostedwebapp">
2021
<clobbers target="hostedwebapp" />
2122
</js-module>
2223

24+
<engines>
25+
<engine name="cordova-windows" version="4.0.0" />
26+
<engine name="cordova-ios" version="3.8.0" />
27+
<engine name="cordova-android" version="4.0.2" />
28+
</engines>
29+
2330
<!-- android -->
2431
<platform name="android">
2532
<config-file target="res/xml/config.xml" parent="/*">

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,6 @@ Cordova for Android and iOS platforms provide a security policy to control which
205205
The Windows and Windows Phone platforms do not provide control for these kind of requests, and they will be allowed.
206206

207207

208+
## Changelog
209+
210+
Releases are documented in [GitHub](https://github.com/manifoldjs/ManifoldCordova/releases).

0 commit comments

Comments
 (0)