Merge branch 'notifications-thru-sw' into shigusegubu-vue3
This commit is contained in:
commit
d779da7f3e
5 changed files with 29 additions and 13 deletions
|
@ -57,6 +57,12 @@ const MobileNav = {
|
||||||
unseenNotificationsCount () {
|
unseenNotificationsCount () {
|
||||||
return this.unseenNotifications.length + countExtraNotifications(this.$store)
|
return this.unseenNotifications.length + countExtraNotifications(this.$store)
|
||||||
},
|
},
|
||||||
|
unseenCount () {
|
||||||
|
return this.unseenNotifications.length
|
||||||
|
},
|
||||||
|
unseenCountBadgeText () {
|
||||||
|
return `${this.unseenCount ? this.unseenCount : ''}`
|
||||||
|
},
|
||||||
hideSitename () { return this.$store.state.instance.hideSitename },
|
hideSitename () { return this.$store.state.instance.hideSitename },
|
||||||
sitename () { return this.$store.state.instance.name },
|
sitename () { return this.$store.state.instance.name },
|
||||||
isChat () {
|
isChat () {
|
||||||
|
|
|
@ -50,7 +50,13 @@
|
||||||
@touchmove.stop="notificationsTouchMove"
|
@touchmove.stop="notificationsTouchMove"
|
||||||
>
|
>
|
||||||
<div class="mobile-notifications-header">
|
<div class="mobile-notifications-header">
|
||||||
<span class="title">{{ $t('notifications.notifications') }}</span>
|
<span class="title">
|
||||||
|
{{ $t('notifications.notifications') }}
|
||||||
|
<span
|
||||||
|
v-if="unseenCountBadgeText"
|
||||||
|
class="badge badge-notification unseen-count"
|
||||||
|
>{{ unseenCountBadgeText }}</span>
|
||||||
|
</span>
|
||||||
<span class="spacer" />
|
<span class="spacer" />
|
||||||
<button
|
<button
|
||||||
v-if="notificationsAtTop"
|
v-if="notificationsAtTop"
|
||||||
|
@ -69,7 +75,7 @@
|
||||||
<button
|
<button
|
||||||
v-if="!closingDrawerMarksAsSeen"
|
v-if="!closingDrawerMarksAsSeen"
|
||||||
class="button-unstyled mobile-nav-button"
|
class="button-unstyled mobile-nav-button"
|
||||||
:title="$t('nav.mobile_notifications_close')"
|
:title="$t('nav.mobile_notifications_mark_as_seen')"
|
||||||
@click.stop.prevent="markNotificationsAsSeen()"
|
@click.stop.prevent="markNotificationsAsSeen()"
|
||||||
>
|
>
|
||||||
<FAIcon
|
<FAIcon
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationNative.mentions" >
|
<BooleanSetting path="notificationNative.mentions">
|
||||||
{{ $t('settings.notification_visibility_native_notifications') }}
|
{{ $t('settings.notification_visibility_native_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationNative.likes" >
|
<BooleanSetting path="notificationNative.likes">
|
||||||
{{ $t('settings.notification_visibility_native_notifications') }}
|
{{ $t('settings.notification_visibility_native_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationNative.repeats" >
|
<BooleanSetting path="notificationNative.repeats">
|
||||||
{{ $t('settings.notification_visibility_native_notifications') }}
|
{{ $t('settings.notification_visibility_native_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationNative.emojiReactions" >
|
<BooleanSetting path="notificationNative.emojiReactions">
|
||||||
{{ $t('settings.notification_visibility_native_notifications') }}
|
{{ $t('settings.notification_visibility_native_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationNative.follows" >
|
<BooleanSetting path="notificationNative.follows">
|
||||||
{{ $t('settings.notification_visibility_native_notifications') }}
|
{{ $t('settings.notification_visibility_native_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
@ -118,12 +118,12 @@
|
||||||
<h4> {{ $t('settings.notification_visibility_follow_requests') }}</h4>
|
<h4> {{ $t('settings.notification_visibility_follow_requests') }}</h4>
|
||||||
<ul class="setting-list">
|
<ul class="setting-list">
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationVisibility.follow_request">
|
<BooleanSetting path="notificationVisibility.followRequest">
|
||||||
{{ $t('settings.notification_visibility_in_column') }}
|
{{ $t('settings.notification_visibility_in_column') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationNative.follow_request" >
|
<BooleanSetting path="notificationNative.followRequest">
|
||||||
{{ $t('settings.notification_visibility_native_notifications') }}
|
{{ $t('settings.notification_visibility_native_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationNative.moves" >
|
<BooleanSetting path="notificationNative.moves">
|
||||||
{{ $t('settings.notification_visibility_native_notifications') }}
|
{{ $t('settings.notification_visibility_native_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationNative.polls" >
|
<BooleanSetting path="notificationNative.polls">
|
||||||
{{ $t('settings.notification_visibility_native_notifications') }}
|
{{ $t('settings.notification_visibility_native_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
@ -168,7 +168,7 @@
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="notificationNative.reports" >
|
<BooleanSetting path="notificationNative.reports">
|
||||||
{{ $t('settings.notification_visibility_native_notifications') }}
|
{{ $t('settings.notification_visibility_native_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -189,6 +189,7 @@
|
||||||
"mobile_notifications": "Open notifications",
|
"mobile_notifications": "Open notifications",
|
||||||
"mobile_notifications": "Open notifications (there are unread ones)",
|
"mobile_notifications": "Open notifications (there are unread ones)",
|
||||||
"mobile_notifications_close": "Close notifications",
|
"mobile_notifications_close": "Close notifications",
|
||||||
|
"mobile_notifications_mark_as_seen": "Mark all as seen",
|
||||||
"announcements": "Announcements"
|
"announcements": "Announcements"
|
||||||
},
|
},
|
||||||
"notifications": {
|
"notifications": {
|
||||||
|
|
|
@ -73,13 +73,16 @@ const showPushNotification = async (event) => {
|
||||||
const res = prepareNotificationObject(parsedNotification, i18n)
|
const res = prepareNotificationObject(parsedNotification, i18n)
|
||||||
|
|
||||||
if (state.allowedNotificationTypes.has(parsedNotification.type)) {
|
if (state.allowedNotificationTypes.has(parsedNotification.type)) {
|
||||||
self.registration.showNotification(res.title, res)
|
return self.registration.showNotification(res.title, res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Promise.resolve()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.addEventListener('push', async (event) => {
|
self.addEventListener('push', async (event) => {
|
||||||
if (event.data) {
|
if (event.data) {
|
||||||
|
// Supposedly, we HAVE to return a promise inside waitUntil otherwise it will
|
||||||
|
// show (extra) notification that website is updated in background
|
||||||
event.waitUntil(showPushNotification(event))
|
event.waitUntil(showPushNotification(event))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue