mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update notifications
This commit is contained in:
parent
e9151896b2
commit
3b16c9d466
4 changed files with 29 additions and 8 deletions
|
@ -14,12 +14,12 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"version": "1.4.124",
|
"version": "1.4.125",
|
||||||
"_release": "1.4.124",
|
"_release": "1.4.125",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "1.4.124",
|
"tag": "1.4.125",
|
||||||
"commit": "308546fe094fa18c356480d1d13c8790d43de971"
|
"commit": "e99688474bb825e89e3c569a9a9785fc6b951a60"
|
||||||
},
|
},
|
||||||
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
||||||
"_target": "^1.2.0",
|
"_target": "^1.2.0",
|
||||||
|
|
|
@ -12,6 +12,8 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
||||||
document.addEventListener('click', onOneDocumentClick);
|
document.addEventListener('click', onOneDocumentClick);
|
||||||
document.addEventListener('keydown', onOneDocumentClick);
|
document.addEventListener('keydown', onOneDocumentClick);
|
||||||
|
|
||||||
|
var serviceWorkerRegistration;
|
||||||
|
|
||||||
function closeAfter(notification, timeoutMs) {
|
function closeAfter(notification, timeoutMs) {
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
@ -25,8 +27,23 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
||||||
}, timeoutMs);
|
}, timeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetRegistration() {
|
||||||
|
navigator.serviceWorker.ready.then(function (registration) {
|
||||||
|
serviceWorkerRegistration = registration;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
resetRegistration();
|
||||||
|
|
||||||
function show(title, options, timeoutMs) {
|
function show(title, options, timeoutMs) {
|
||||||
|
|
||||||
|
resetRegistration();
|
||||||
|
|
||||||
|
if (serviceWorkerRegistration && !timeoutMs) {
|
||||||
|
serviceWorkerRegistration.showNotification(title, options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var notif = new Notification(title, options);
|
var notif = new Notification(title, options);
|
||||||
|
|
||||||
|
@ -140,10 +157,10 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
||||||
else if (status == 'progress') {
|
else if (status == 'progress') {
|
||||||
notification.title = globalize.translate('LabelInstallingPackage').replace('{0}', installation.Name + ' ' + installation.Version);
|
notification.title = globalize.translate('LabelInstallingPackage').replace('{0}', installation.Name + ' ' + installation.Version);
|
||||||
|
|
||||||
notification.actions =
|
//notification.actions =
|
||||||
[
|
//[
|
||||||
{ action: 'cancel', title: globalize.translate('ButtonCancel')/*, icon: 'https://example/like.png'*/ }
|
// { action: 'cancel', title: globalize.translate('ButtonCancel')/*, icon: 'https://example/like.png'*/ }
|
||||||
];
|
//];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == 'progress') {
|
if (status == 'progress') {
|
||||||
|
|
|
@ -2842,6 +2842,10 @@ var AppInfo = {};
|
||||||
|
|
||||||
postInitDependencies.push('bower_components/emby-webcomponents/input/api');
|
postInitDependencies.push('bower_components/emby-webcomponents/input/api');
|
||||||
|
|
||||||
|
if (navigator.serviceWorker && !AppInfo.isNativeApp) {
|
||||||
|
navigator.serviceWorker.register('serviceworker.js');
|
||||||
|
}
|
||||||
|
|
||||||
if (window.Notification && !AppInfo.isNativeApp) {
|
if (window.Notification && !AppInfo.isNativeApp) {
|
||||||
postInitDependencies.push('bower_components/emby-webcomponents/notifications/notifications');
|
postInitDependencies.push('bower_components/emby-webcomponents/notifications/notifications');
|
||||||
}
|
}
|
||||||
|
|
0
dashboard-ui/serviceworker.js
Normal file
0
dashboard-ui/serviceworker.js
Normal file
Loading…
Add table
Add a link
Reference in a new issue