about summary refs log tree commit diff
path: root/src/view/screens/Home.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-06-10 12:14:00 -0700
committerGitHub <noreply@github.com>2024-06-10 12:14:00 -0700
commit5dd195bcb748820eb293348501348d658021c658 (patch)
tree970ad045354d845dd1cc4958a61e87c86532e082 /src/view/screens/Home.tsx
parent90ec22a6749555f48bfd21eec81f877f8eae0524 (diff)
downloadvoidsky-5dd195bcb748820eb293348501348d658021c658.tar.zst
Check `canAskAgain` for notification permissions (#4460)
Diffstat (limited to 'src/view/screens/Home.tsx')
-rw-r--r--src/view/screens/Home.tsx6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx
index 34d3abf26..e49f2fbb2 100644
--- a/src/view/screens/Home.tsx
+++ b/src/view/screens/Home.tsx
@@ -20,6 +20,7 @@ import {
 } from '#/state/shell'
 import {useSelectedFeed, useSetSelectedFeed} from '#/state/shell/selected-feed'
 import {useOTAUpdates} from 'lib/hooks/useOTAUpdates'
+import {useRequestNotificationsPermission} from 'lib/notifications/notifications'
 import {HomeTabNavigatorParams, NativeStackScreenProps} from 'lib/routes/types'
 import {FeedPage} from 'view/com/feeds/FeedPage'
 import {Pager, PagerRef, RenderTabBarFnProps} from 'view/com/pager/Pager'
@@ -67,10 +68,15 @@ function HomeScreenReady({
   const maybeFoundIndex = allFeeds.indexOf(rawSelectedFeed)
   const selectedIndex = Math.max(0, maybeFoundIndex)
   const selectedFeed = allFeeds[selectedIndex]
+  const requestNotificationsPermission = useRequestNotificationsPermission()
 
   useSetTitle(pinnedFeedInfos[selectedIndex]?.displayName)
   useOTAUpdates()
 
+  React.useEffect(() => {
+    requestNotificationsPermission('Home')
+  }, [requestNotificationsPermission])
+
   const pagerRef = React.useRef<PagerRef>(null)
   const lastPagerReportedIndexRef = React.useRef(selectedIndex)
   React.useLayoutEffect(() => {