Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions js/NotificationsApp-CdVsZWsh.chunk.mjs.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion js/NotificationsApp-D5yEkr8D.chunk.mjs.map

This file was deleted.

4 changes: 2 additions & 2 deletions js/index-yrEEwOZK.chunk.mjs → js/index-3PqcBTWv.chunk.mjs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/notifications-main.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('notifications', '', 'js/NotificationsApp-D5yEkr8D.chunk.mjs'),window.OC.filePath('notifications', '', 'js/_plugin-vue_export-helper-DoVzk5Kw.chunk.mjs'),window.OC.filePath('notifications', '', 'js/style-DnTnUg81.chunk.mjs'),window.OC.filePath('notifications', '', 'css/style-DzIwnQsS.chunk.css'),window.OC.filePath('notifications', '', 'css/_plugin-vue_export-helper-CFp4Dbip.chunk.css'),window.OC.filePath('notifications', '', 'js/vite-preload-helper-DxYC2qmj.chunk.mjs'),window.OC.filePath('notifications', '', 'js/BrowserStorage-j57i456t.chunk.mjs'),window.OC.filePath('notifications', '', 'css/NotificationsApp-BJcCFRZ6.chunk.css')])))=>i.map(i=>d[i]);
import{_ as o}from"./vite-preload-helper-DxYC2qmj.chunk.mjs";import{c as i,d as n}from"./style-DnTnUg81.chunk.mjs";const m=n(()=>o(()=>import("./NotificationsApp-D5yEkr8D.chunk.mjs").then(t=>t.g),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url));i(m).mount("#notifications");
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('notifications', '', 'js/NotificationsApp-CdVsZWsh.chunk.mjs'),window.OC.filePath('notifications', '', 'js/_plugin-vue_export-helper-DoVzk5Kw.chunk.mjs'),window.OC.filePath('notifications', '', 'js/style-DnTnUg81.chunk.mjs'),window.OC.filePath('notifications', '', 'css/style-DzIwnQsS.chunk.css'),window.OC.filePath('notifications', '', 'css/_plugin-vue_export-helper-CFp4Dbip.chunk.css'),window.OC.filePath('notifications', '', 'js/vite-preload-helper-DxYC2qmj.chunk.mjs'),window.OC.filePath('notifications', '', 'js/BrowserStorage-j57i456t.chunk.mjs'),window.OC.filePath('notifications', '', 'css/NotificationsApp-D6FZQQof.chunk.css')])))=>i.map(i=>d[i]);
import{_ as o}from"./vite-preload-helper-DxYC2qmj.chunk.mjs";import{c as i,d as n}from"./style-DnTnUg81.chunk.mjs";const m=n(()=>o(()=>import("./NotificationsApp-CdVsZWsh.chunk.mjs").then(t=>t.g),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url));i(m).mount("#notifications");
//# sourceMappingURL=notifications-main.mjs.map
7 changes: 4 additions & 3 deletions src/NotificationsApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,11 @@ export default {
// We don't fetch on push if notify_push is enabled, to avoid concurrency fetch.
// We could do the other way: fallback to notify_push only if we don't have
// web push
window.addEventListener('load', () => {
if (document.readyState === 'complete') {
this._setWebPush()
})
} else {
window.addEventListener('load', this._setWebPush, { once: true })
}
} else {
// Set up the background checker
this._setPollingInterval(this.pollIntervalBase)
Expand Down Expand Up @@ -325,7 +327,6 @@ export default {
if (hasWebPush) {
console.debug('Has web push, slowing polling to 15 minutes')
this.pollIntervalBase = 15 * 60 * 1000
this.hasNotifyPush = true
}
// Set polling interval for the default or new value
this._setPollingInterval(this.pollIntervalBase)
Expand Down
10 changes: 10 additions & 0 deletions src/services/webPushService.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ function listenForPush(registration, onActivated, onPush) {
.then((response) => {
onActivated(response.status === 200 || response.status === 202)
})
.catch((er) => {
console.error(er)
onActivated(false)
})
} else {
onPush()
}
Expand Down Expand Up @@ -117,6 +121,12 @@ function setWebPush(onActivated, onPush) {
listenForPush(registration, onActivated, onPush)
return registerPush(registration)
})
.then((response) => {
// The subscription is already active, so no activation push follows
if (response.status === 200) {
onActivated(true)
}
})
.catch((er) => {
console.error(er)
onActivated(false)
Expand Down
Loading