From 3ac6276df5aa93a41f23e088597f4af676291293 Mon Sep 17 00:00:00 2001 From: iamacook Date: Fri, 6 Oct 2023 09:29:05 +0200 Subject: [PATCH] fix: don't show banner if preferences exist --- .../PushNotifications/PushNotificationsBanner/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx b/src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx index 96332f1d2b..6b48b94926 100644 --- a/src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx +++ b/src/components/settings/PushNotifications/PushNotificationsBanner/index.tsx @@ -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)