[🐴] Don't always show notification for everything (#4083)
* don't always show a notification * nitzio/stable
parent
dd4c8d8e4f
commit
5e312d5f3a
|
@ -41,7 +41,7 @@ type NotificationPayload =
|
|||
}
|
||||
|
||||
const DEFAULT_HANDLER_OPTIONS = {
|
||||
shouldShowAlert: true,
|
||||
shouldShowAlert: false,
|
||||
shouldPlaySound: false,
|
||||
shouldSetBadge: true,
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
@ -107,7 +109,7 @@ export function useRequestNotificationsPermission() {
|
|||
getPushToken(true)
|
||||
}
|
||||
},
|
||||
[gate],
|
||||
[gate, currentAccount],
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue