Skip to content

Commit

Permalink
[🐴] Don't always show notification for everything (#4083)
Browse files Browse the repository at this point in the history
* don't always show a notification

* nit
  • Loading branch information
haileyok authored May 17, 2024
1 parent dd4c8d8 commit 5e312d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/hooks/useNotificationHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type NotificationPayload =
}

const DEFAULT_HANDLER_OPTIONS = {
shouldShowAlert: true,
shouldShowAlert: false,
shouldPlaySound: false,
shouldSetBadge: true,
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/notifications/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ export function useNotificationsRegistration() {

export function useRequestNotificationsPermission() {
const gate = useGate()
const {currentAccount} = useSession()

return React.useCallback(
async (context: 'StartOnboarding' | 'AfterOnboarding' | 'Login') => {
const permissions = await Notifications.getPermissionsAsync()

if (
!currentAccount ||
!isNative ||
permissions?.status === 'granted' ||
(permissions?.status === 'denied' && !permissions?.canAskAgain)
Expand Down Expand Up @@ -107,7 +109,7 @@ export function useRequestNotificationsPermission() {
getPushToken(true)
}
},
[gate],
[gate, currentAccount],
)
}

Expand Down

0 comments on commit 5e312d5

Please sign in to comment.