diff options
author | Emmanuel ROHEE <erohee@amdocs.com> | 2014-08-29 17:11:03 +0200 |
---|---|---|
committer | Emmanuel ROHEE <erohee@amdocs.com> | 2014-08-29 17:13:57 +0200 |
commit | c3a774e414324746c484ad21d19c4be4e2167cd0 (patch) | |
tree | d363d80d11427baa964c3b065a2745d58901d3e6 /webclient/settings/settings-controller.js | |
parent | better support for call hangups (diff) | |
download | synapse-c3a774e414324746c484ad21d19c4be4e2167cd0.tar.xz |
Show desktop notification state. Provide help if the user has previously denied permission to display them.
Diffstat (limited to 'webclient/settings/settings-controller.js')
-rw-r--r-- | webclient/settings/settings-controller.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/webclient/settings/settings-controller.js b/webclient/settings/settings-controller.js index f7d5e8eb75..3a9060ebae 100644 --- a/webclient/settings/settings-controller.js +++ b/webclient/settings/settings-controller.js @@ -25,7 +25,7 @@ angular.module('SettingsController', ['matrixService', 'mFileUpload', 'mFileInpu displayName: $scope.config.displayName, avatarUrl: $scope.config.avatarUrl }; - + $scope.$watch("profile.avatarFile", function(newValue, oldValue) { if ($scope.profile.avatarFile) { console.log("Uploading new avatar file..."); @@ -143,4 +143,23 @@ angular.module('SettingsController', ['matrixService', 'mFileUpload', 'mFileInpu } ); }; + + + /*** Desktop notifications section ***/ + $scope.settings = { + notifications: undefined + }; + + // If the browser supports it, check the desktop notification state + if ("Notification" in window) { + $scope.settings.notifications = window.Notification.permission; + } + + $scope.requestNotifications = function() { + console.log("requestNotifications"); + window.Notification.requestPermission(function (permission) { + console.log(" -> User decision: " + permission); + $scope.settings.notifications = permission; + }); + }; }]); \ No newline at end of file |