Skip to content

Commit

Permalink
fix: don't show banner if preferences exist
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacook committed Oct 6, 2023
1 parent b7287ac commit 3ac6276
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ export const PushNotificationsBanner = ({ children }: { children: ReactElement }
const { query } = useRouter()
const onboard = useOnboard()

const { getPreferences, getAllPreferences } = useNotificationPreferences()
const { dismissPushNotificationBanner, isPushNotificationBannerDismissed } = useDismissPushNotificationsBanner()

const isSafeAdded = !!addedSafesOnChain?.[safeAddress]
const shouldShowBanner = isNotificationsEnabled && !isPushNotificationBannerDismissed && isSafeAdded
const isSafeRegistered = getPreferences(safe.chainId, safeAddress)
const shouldShowBanner =
isNotificationsEnabled && !isPushNotificationBannerDismissed && isSafeAdded && !isSafeRegistered

const { registerNotifications } = useNotificationRegistrations()
const { getAllPreferences } = useNotificationPreferences()

const dismissBanner = useCallback(() => {
trackEvent(PUSH_NOTIFICATION_EVENTS.DISMISS_BANNER)
Expand Down

0 comments on commit 3ac6276

Please sign in to comment.