Skip to content
Snippets Groups Projects
Commit b337396f authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Fix Android build

[fix] Android: Avoid error in the Cesium+ settings page, because of HTML5 Notifications
parent 7d3f3f57
No related branches found
No related tags found
No related merge requests found
www/img/finger.png

414 B

...@@ -6,9 +6,7 @@ ...@@ -6,9 +6,7 @@
// 'starter.controllers' is found in controllers.js // 'starter.controllers' is found in controllers.js
angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht.translate', angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht.translate',
'ngApi', 'angular-cache', 'angular.screenmatch', 'angular.bind.notifier', 'ImageCropper', 'ion-digit-keyboard', 'ngApi', 'angular-cache', 'angular.screenmatch', 'angular.bind.notifier', 'ImageCropper', 'ion-digit-keyboard',
// removeIf(device) 'FBAngular', // = angular-fullscreen
'FBAngular', // angulmar-fullscreen
// endRemoveIf(device)
// removeIf(no-device) // removeIf(no-device)
'ngCordova', 'ngCordova',
// endRemoveIf(no-device) // endRemoveIf(no-device)
......
...@@ -52,6 +52,7 @@ function ESPluginSettingsController ($scope, $window, $q, $translate, $ionicPop ...@@ -52,6 +52,7 @@ function ESPluginSettingsController ($scope, $window, $q, $translate, $ionicPop
UIUtils, Modals, csHttp, csConfig, csSettings, esHttp, esSettings) { UIUtils, Modals, csHttp, csConfig, csSettings, esHttp, esSettings) {
'ngInject'; 'ngInject';
$scope.hasWindowNotification = !!("Notification" in window);
$scope.formData = {}; $scope.formData = {};
$scope.popupData = {}; // need for the node popup $scope.popupData = {}; // need for the node popup
$scope.loading = true; $scope.loading = true;
...@@ -223,8 +224,9 @@ function ESPluginSettingsController ($scope, $window, $q, $translate, $ionicPop ...@@ -223,8 +224,9 @@ function ESPluginSettingsController ($scope, $window, $q, $translate, $ionicPop
$scope.onFormChanged = function() { $scope.onFormChanged = function() {
if ($scope.loading) return; if ($scope.loading) return;
if ($scope.formData.notifications.emitHtml5 !== (!!("Notification" in window) && Notification.permission === "granted")){ if ($scope.hasWindowNotification &&
Notification.requestPermission(function (permission) { $scope.formData.notifications.emitHtml5 !== (window.Notification.permission === "granted")){
window.Notification.requestPermission(function (permission) {
// If the user accepts, let's create a notification // If the user accepts, let's create a notification
$scope.formData.notifications.emitHtml5 = (permission === "granted"); // revert to false if permission not granted $scope.formData.notifications.emitHtml5 = (permission === "granted"); // revert to false if permission not granted
$scope.onFormChanged(); // Loop $scope.onFormChanged(); // Loop
...@@ -241,8 +243,6 @@ function ESPluginSettingsController ($scope, $window, $q, $translate, $ionicPop ...@@ -241,8 +243,6 @@ function ESPluginSettingsController ($scope, $window, $q, $translate, $ionicPop
// Fix old settings (unused) // Fix old settings (unused)
delete csSettings.data.plugins.es.newNode; delete csSettings.data.plugins.es.newNode;
csSettings.store() csSettings.store()
.then(function() { .then(function() {
$scope.loading = false; $scope.loading = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment