From b337396f332dbd2fdf18ca721c97a30914863e3d Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Wed, 5 Jun 2019 22:20:03 +0200
Subject: [PATCH] [fix] Fix Android build [fix] Android: Avoid error in the
 Cesium+ settings page, because of HTML5 Notifications

---
 www/img/finger.png                                | Bin 0 -> 414 bytes
 www/js/app.js                                     |   4 +---
 .../es/js/controllers/settings-controllers.js     |   8 ++++----
 3 files changed, 5 insertions(+), 7 deletions(-)
 create mode 100644 www/img/finger.png

diff --git a/www/img/finger.png b/www/img/finger.png
new file mode 100644
index 0000000000000000000000000000000000000000..89a63c04de7c0baee79971524d59fc2f07c441f2
GIT binary patch
literal 414
zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7Sc;uILpV4%IBGajIv5xj
zI14-?iy0VruY)k7lg8`{1_lPn64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xh
zq!<_&r9E97Lo9mdUN+Qj3zRta@xJ9mqdoe@sfQc_lO})ST%u#wGU<HdCq*4Gy9P%#
zRpz4y(h|NJX|Qd7X!&J=T-^1FbN}mkpYQYU;`q8`ira>UOrI%_wdXw6P|Dl?L7r7}
zX^-fdhm!miIx*7CFOKtlQ+o7vv%=CT8#*mxt{-`ynJlyXMn}hqr%95=7TFV~?%sSz
z&-su+Sz+^Xww?3Dj%}E=vE#a4N^9-Wq_DkZ=0$r`tdfQ1){B%F%oN-|k+-wQ`)beb
zvkH2fvkpi7*T{Hi^H^Z-D%GFaw_Y4f?CYq`Nfg-`xOx)zZdt+a@`o7x47wZHDi;{2
zAN~1hrqHwved1T=SetHawaZDi@0wBf<DB!1<5RNSSE!XXKJM7D`t$oGLeU}Li#eAw
QFfcH9y85}Sb4q9e0P&!y-2eap

literal 0
HcmV?d00001

diff --git a/www/js/app.js b/www/js/app.js
index 0c5cdca2..a250e46a 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -6,9 +6,7 @@
 // 'starter.controllers' is found in controllers.js
 angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht.translate',
   'ngApi', 'angular-cache', 'angular.screenmatch', 'angular.bind.notifier', 'ImageCropper', 'ion-digit-keyboard',
-  // removeIf(device)
-  'FBAngular', // angulmar-fullscreen
-  // endRemoveIf(device)
+  'FBAngular', // = angular-fullscreen
   // removeIf(no-device)
   'ngCordova',
   // endRemoveIf(no-device)
diff --git a/www/plugins/es/js/controllers/settings-controllers.js b/www/plugins/es/js/controllers/settings-controllers.js
index fbc14baa..8635cb3f 100644
--- a/www/plugins/es/js/controllers/settings-controllers.js
+++ b/www/plugins/es/js/controllers/settings-controllers.js
@@ -52,6 +52,7 @@ function ESPluginSettingsController ($scope, $window, $q,  $translate, $ionicPop
                                      UIUtils, Modals, csHttp, csConfig, csSettings, esHttp, esSettings) {
   'ngInject';
 
+  $scope.hasWindowNotification = !!("Notification" in window);
   $scope.formData = {};
   $scope.popupData = {}; // need for the node popup
   $scope.loading = true;
@@ -223,8 +224,9 @@ function ESPluginSettingsController ($scope, $window, $q,  $translate, $ionicPop
   $scope.onFormChanged = function() {
     if ($scope.loading) return;
 
-    if ($scope.formData.notifications.emitHtml5 !== (!!("Notification" in window) && Notification.permission === "granted")){
-      Notification.requestPermission(function (permission) {
+    if ($scope.hasWindowNotification &&
+      $scope.formData.notifications.emitHtml5 !== (window.Notification.permission === "granted")){
+      window.Notification.requestPermission(function (permission) {
         // If the user accepts, let's create a notification
         $scope.formData.notifications.emitHtml5 = (permission === "granted"); // revert to false if permission not granted
         $scope.onFormChanged(); // Loop
@@ -241,8 +243,6 @@ function ESPluginSettingsController ($scope, $window, $q,  $translate, $ionicPop
     // Fix old settings (unused)
     delete csSettings.data.plugins.es.newNode;
 
-
-
     csSettings.store()
       .then(function() {
         $scope.loading = false;
-- 
GitLab