1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update notifications

This commit is contained in:
Luke Pulverenti 2016-07-28 01:55:47 -04:00
parent e9151896b2
commit 3b16c9d466
4 changed files with 29 additions and 8 deletions

View file

@ -14,12 +14,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.124",
"_release": "1.4.124",
"version": "1.4.125",
"_release": "1.4.125",
"_resolution": {
"type": "version",
"tag": "1.4.124",
"commit": "308546fe094fa18c356480d1d13c8790d43de971"
"tag": "1.4.125",
"commit": "e99688474bb825e89e3c569a9a9785fc6b951a60"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0",

View file

@ -12,6 +12,8 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
document.addEventListener('click', onOneDocumentClick);
document.addEventListener('keydown', onOneDocumentClick);
var serviceWorkerRegistration;
function closeAfter(notification, timeoutMs) {
setTimeout(function () {
@ -25,8 +27,23 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
}, timeoutMs);
}
function resetRegistration() {
navigator.serviceWorker.ready.then(function (registration) {
serviceWorkerRegistration = registration;
});
}
resetRegistration();
function show(title, options, timeoutMs) {
resetRegistration();
if (serviceWorkerRegistration && !timeoutMs) {
serviceWorkerRegistration.showNotification(title, options);
return;
}
try {
var notif = new Notification(title, options);
@ -140,10 +157,10 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
else if (status == 'progress') {
notification.title = globalize.translate('LabelInstallingPackage').replace('{0}', installation.Name + ' ' + installation.Version);
notification.actions =
[
{ action: 'cancel', title: globalize.translate('ButtonCancel')/*, icon: 'https://example/like.png'*/ }
];
//notification.actions =
//[
// { action: 'cancel', title: globalize.translate('ButtonCancel')/*, icon: 'https://example/like.png'*/ }
//];
}
if (status == 'progress') {

View file

@ -2842,6 +2842,10 @@ var AppInfo = {};
postInitDependencies.push('bower_components/emby-webcomponents/input/api');
if (navigator.serviceWorker && !AppInfo.isNativeApp) {
navigator.serviceWorker.register('serviceworker.js');
}
if (window.Notification && !AppInfo.isNativeApp) {
postInitDependencies.push('bower_components/emby-webcomponents/notifications/notifications');
}

View file