this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

More reliable badge clearing

Should be when page visible, not on render

Possibly super effective, but badges can be annoying if not cleared easily.

+9 -13
+8
src/components/notification-service.jsx
··· 7 7 getAccountByAccessToken, 8 8 getCurrentAccount, 9 9 } from '../utils/store-utils'; 10 + import usePageVisibility from '../utils/usePageVisibility'; 10 11 11 12 import Icon from './icon'; 12 13 import Link from './link'; ··· 103 104 navigator.serviceWorker.removeEventListener('message', handleMessage); 104 105 }; 105 106 }, []); 107 + 108 + usePageVisibility((visible) => { 109 + if (visible && navigator?.clearAppBadge) { 110 + console.log('🔰 Clear app badge'); 111 + navigator.clearAppBadge(); 112 + } 113 + }); 106 114 107 115 const onClose = () => { 108 116 setShowNotificationSheet(false);
+1 -13
src/pages/notifications.jsx
··· 2 2 3 3 import { useIdle } from '@uidotdev/usehooks'; 4 4 import { memo } from 'preact/compat'; 5 - import { 6 - useCallback, 7 - useEffect, 8 - useLayoutEffect, 9 - useRef, 10 - useState, 11 - } from 'preact/hooks'; 5 + import { useCallback, useEffect, useRef, useState } from 'preact/hooks'; 12 6 import { useSearchParams } from 'react-router-dom'; 13 7 import { useSnapshot } from 'valtio'; 14 8 ··· 199 193 ); 200 194 201 195 const announcementsListRef = useRef(); 202 - 203 - useLayoutEffect(() => { 204 - if (navigator.clearAppBadge) { 205 - navigator.clearAppBadge(); 206 - } 207 - }, []); 208 196 209 197 useEffect(() => { 210 198 if (notificationID) {