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!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf<Z~8yL>2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4<ivthz5Jr|+3#$m7#J9(JzX3_ zEPCf&Hq>qllsNYBzU4%tJ^IF}ha3WvCV%2wqGQ)G>3riSMIAA_21hnk=A#GF622N~ zux)>6`DKD!-1Ulc|Lb|5@AL2C__}0@+lGcrpDB;E=RDR>%G>`zo>g;ckLa3*lKd4q zG1AR1j`Mv}dh~X)!qO=lIxS<aA9<gdEVKMZN5_e$Ns`7E*%PMj-h4>U`H(?bVe@jf zo%6(wZJ4#O<GNl-Ywgjbu)SsGMSD}Ml7;5hi<B756x=_Nx3kClYR~So3VNHf4oCgh z$arY;SYYoe)t}k7UK~v9>!{926xkWLdJ^|;S;6n}hZy|~x*ORl7Z|7?{rPF8(6kMG z;#cQbn{I5i%SpEHno;-Tob!z1Q?lGwsFgN8?%1*V^ZO-2(IMZ9IhO;&lEKr}&t;uc GLK6V-psC#e 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