diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index dbb3e4f967..b69be27d8e 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -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", diff --git a/dashboard-ui/bower_components/emby-webcomponents/notifications/notifications.js b/dashboard-ui/bower_components/emby-webcomponents/notifications/notifications.js index 8b933a41eb..79a5f35588 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/notifications/notifications.js +++ b/dashboard-ui/bower_components/emby-webcomponents/notifications/notifications.js @@ -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') { diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 58b4b0f34f..3eb6f54b29 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -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'); } diff --git a/dashboard-ui/serviceworker.js b/dashboard-ui/serviceworker.js new file mode 100644 index 0000000000..e69de29bb2