feat: update push notification subscription flow and remove deprecated opt-in component
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m43s
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m43s
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { computed, ref, onMounted, onUnmounted } from 'vue'
|
||||
import LoginButton from '../components/shared/LoginButton.vue'
|
||||
import PushOptIn from '../components/notification/PushOptIn.vue'
|
||||
import { subscribeToPush } from '@/services/pushSubscription'
|
||||
import { eventBus } from '@/common/eventBus'
|
||||
import type {
|
||||
Event,
|
||||
@@ -70,17 +68,10 @@ function handleChoreConfirmationBadge(event: Event) {
|
||||
// Version fetching
|
||||
const appVersion = ref('')
|
||||
|
||||
function onVisibilityChange() {
|
||||
if (document.visibilityState === 'visible') {
|
||||
subscribeToPush()
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchNotificationCount()
|
||||
eventBus.on('child_reward_request', handleRewardRequestBadge)
|
||||
eventBus.on('child_chore_confirmation', handleChoreConfirmationBadge)
|
||||
document.addEventListener('visibilitychange', onVisibilityChange)
|
||||
|
||||
try {
|
||||
const resp = await fetch('/api/version')
|
||||
@@ -96,7 +87,6 @@ onMounted(async () => {
|
||||
onUnmounted(() => {
|
||||
eventBus.off('child_reward_request', handleRewardRequestBadge)
|
||||
eventBus.off('child_chore_confirmation', handleChoreConfirmationBadge)
|
||||
document.removeEventListener('visibilitychange', onVisibilityChange)
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -176,7 +166,6 @@ onUnmounted(() => {
|
||||
</header>
|
||||
|
||||
<main class="main-content">
|
||||
<PushOptIn />
|
||||
<router-view :key="$route.fullPath" />
|
||||
</main>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user