You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Chris Brody (JIRA)" <ji...@apache.org> on 2018/01/19 17:39:00 UTC

[jira] [Created] (CB-13802) Avoid unnecessary ApplicationView access on Windows 8.1

Chris Brody created CB-13802:
--------------------------------

             Summary: Avoid unnecessary ApplicationView access on Windows 8.1
                 Key: CB-13802
                 URL: https://issues.apache.org/jira/browse/CB-13802
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-windows
            Reporter: Chris Brody
            Assignee: Jesse MacFadyen


From changes in CB-12238, CB-12784, and CB-13641 I noticed a few spots where {{Windows.UI.ViewManagement.ApplicationView.getForCurrentView()}} is called for no good reason on Windows 8.1, along with a couple "else crash on 8.1" comments nearby.

The following changes (NOT TESTED) would resolve this issue:

{code:sh}
diff --git a/cordova-js-src/splashscreen.js b/cordova-js-src/splashscreen.js
index 97fd86c..77bca75 100644
--- a/cordova-js-src/splashscreen.js
+++ b/cordova-js-src/splashscreen.js
@@ -198,7 +198,7 @@ function enableUserInteraction() {
 
 // Enter fullscreen mode
 function enterFullScreen() {
-    if (Windows.UI.ViewManagement.ApplicationViewBoundsMode) { // else crash on 8.1
+    if (isWin10UWP && Windows.UI.ViewManagement.ApplicationViewBoundsMode) {
         var view = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
         view.setDesiredBoundsMode(Windows.UI.ViewManagement.ApplicationViewBoundsMode.useCoreWindow);
         view.suppressSystemOverlays = true;
@@ -207,7 +207,7 @@ function enterFullScreen() {
 
 // Exit fullscreen mode
 function exitFullScreen() {
-    if (Windows.UI.ViewManagement.ApplicationViewBoundsMode) { // else crash on 8.1
+    if (isWin10UWP && Windows.UI.ViewManagement.ApplicationViewBoundsMode) {
         var view = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
         view.setDesiredBoundsMode(Windows.UI.ViewManagement.ApplicationViewBoundsMode.useVisible);
         view.suppressSystemOverlays = false;
@@ -216,8 +216,10 @@ function exitFullScreen() {
 
 // Make title bg color match splashscreen bg color
 function colorizeTitleBar() {
-    var appView = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
     if (isWin10UWP && !isBgColorTransparent) {
+        var appView =
+            Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
+
         titleInitialBgColor = appView.titleBar.backgroundColor;
 
         appView.titleBar.backgroundColor = titleBgColor;
@@ -227,8 +229,10 @@ function colorizeTitleBar() {
 
 // Revert title bg color
 function revertTitleBarColor() {
-    var appView = Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
     if (isWin10UWP && !isBgColorTransparent) {
+        var appView =
+            Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
+
         appView.titleBar.backgroundColor = titleInitialBgColor;
         appView.titleBar.buttonBackgroundColor = titleInitialBgColor;
     }
{code}

Unfortunately I do not know how to test splashscreen changes myself, guidance would be appreciated.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org