mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:16:09 -04:00
Show desktop notification state. Provide help if the user has previously denied permission to display them.
This commit is contained in:
parent
0ef54caa28
commit
c3a774e414
3 changed files with 39 additions and 14 deletions
|
@ -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;
|
||||
});
|
||||
};
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue