Change styling and add digest cycle to notifications req button
Added confirmation modals to enable/disable notifactions
This commit is contained in:
parent
a875eac350
commit
0cddf98b1f
2 changed files with 33 additions and 19 deletions
|
@ -209,9 +209,16 @@
|
|||
}
|
||||
|
||||
if (CookieService.get('quay.enabledDesktopNotifications') === 'on') {
|
||||
CookieService.putPermanent('quay.enabledDesktopNotifications', 'off');
|
||||
CookieService.clear('quay.notifications.mostRecentTimestamp');
|
||||
$scope.notificationsPermissionsEnabled = false;
|
||||
bootbox.confirm('Are you sure you want to turn off browser notifications?', confirmed => {
|
||||
if (confirmed) {
|
||||
CookieService.putPermanent('quay.enabledDesktopNotifications', 'off');
|
||||
CookieService.clear('quay.notifications.mostRecentTimestamp');
|
||||
|
||||
$scope.$apply(() => {
|
||||
$scope.notificationsPermissionsEnabled = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (Notification.permission === 'default') {
|
||||
Notification.requestPermission()
|
||||
|
@ -219,15 +226,23 @@
|
|||
if (newPermission === 'granted') {
|
||||
CookieService.putPermanent('quay.enabledDesktopNotifications', 'on');
|
||||
CookieService.putPermanent('quay.notifications.mostRecentTimestamp', new Date().getTime().toString());
|
||||
$scope.notificationsPermissionsEnabled = true;
|
||||
} else {
|
||||
$scope.notificationsPermissionsEnabled = false;
|
||||
}
|
||||
|
||||
$scope.$apply(() => {
|
||||
$scope.notificationsPermissionsEnabled = (newPermission === 'granted');
|
||||
});
|
||||
});
|
||||
} else if (Notification.permission === 'granted') {
|
||||
CookieService.putPermanent('quay.enabledDesktopNotifications', 'on');
|
||||
CookieService.putPermanent('quay.notifications.mostRecentTimestamp', new Date().getTime().toString());
|
||||
$scope.notificationsPermissionsEnabled = true;
|
||||
bootbox.confirm('Are you sure you want to turn on browser notifications?', confirmed => {
|
||||
if (confirmed) {
|
||||
CookieService.putPermanent('quay.enabledDesktopNotifications', 'on');
|
||||
CookieService.putPermanent('quay.notifications.mostRecentTimestamp', new Date().getTime().toString());
|
||||
|
||||
$scope.$apply(() => {
|
||||
$scope.notificationsPermissionsEnabled = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -173,17 +173,16 @@
|
|||
<tr>
|
||||
<td>Desktop Notifications:</td>
|
||||
<td>
|
||||
<span>Enable Desktop Notifications:
|
||||
<button class="btn btn-default"
|
||||
ng-disabled="desktopNotificationsPermissionIsDisabled()"
|
||||
ng-click="toggleDesktopNotifications()"
|
||||
ng-model="notificationsPermissionsEnabled"
|
||||
>{{ notificationsPermissionsEnabled ? 'enabled' : 'disabled' }}
|
||||
</button>
|
||||
</span>
|
||||
<a class="co-modify-link"
|
||||
ng-if="!desktopNotificationsPermissionIsDisabled()"
|
||||
ng-disabled="desktopNotificationsPermissionIsDisabled()"
|
||||
ng-click="toggleDesktopNotifications()"
|
||||
ng-model="notificationsPermissionsEnabled"
|
||||
>{{ notificationsPermissionsEnabled ? 'Enabled' : 'Disabled' }}
|
||||
</a>
|
||||
<span class="help-text"
|
||||
ng-if="desktopNotificationsPermissionIsDisabled()"
|
||||
>Note: Desktop notifications have been disabled, or are unavailable, in your browser.
|
||||
ng-if="desktopNotificationsPermissionIsDisabled()">
|
||||
Desktop notifications have been disabled, or are unavailable, in your browser.
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
Reference in a new issue