Check for Notification support
This commit is contained in:
parent
15e267a9ee
commit
eda2bf9597
|
@ -323,6 +323,9 @@ weechat.factory('connection', ['$q', '$rootScope', '$log', '$store', 'handlers',
|
||||||
|
|
||||||
weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', '$log', 'models', 'connection', function ($rootScope, $scope, $store, $timeout, $log, models, connection, testService) {
|
weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', '$log', 'models', 'connection', function ($rootScope, $scope, $store, $timeout, $log, models, connection, testService) {
|
||||||
|
|
||||||
|
|
||||||
|
if(Notification != undefined) {
|
||||||
|
|
||||||
// Request notification permission
|
// Request notification permission
|
||||||
Notification.requestPermission(function (status) {
|
Notification.requestPermission(function (status) {
|
||||||
$log.info('Notification permission status:',status);
|
$log.info('Notification permission status:',status);
|
||||||
|
@ -330,6 +333,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
Notification.permission = status;
|
Notification.permission = status;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
if(window.webkitNotifications != undefined) {
|
if(window.webkitNotifications != undefined) {
|
||||||
if (window.webkitNotifications.checkPermission() == 0) { // 0 is PERMISSION_ALLOWED
|
if (window.webkitNotifications.checkPermission() == 0) { // 0 is PERMISSION_ALLOWED
|
||||||
$log.info('Notification permission status:', window.webkitNotifications.checkPermission() == 0);
|
$log.info('Notification permission status:', window.webkitNotifications.checkPermission() == 0);
|
||||||
|
|
Loading…
Reference in New Issue