Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13802

Avoid unnecessary ApplicationView access on Windows 8.1

VotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Auto Closed
    • None
    • None
    • cordova-windows
    • None

    Description

      From changes in CB-12238CB-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:

      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;
           }
      

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

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            purplecabbage Jesse MacFadyen
            brodybits Chris Brody
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment