Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't show banner if preferences exist #2596

Merged
merged 3 commits into from
Oct 6, 2023

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Oct 6, 2023

What it solves

Resolves #2592 (comment)

How this PR fixes it

The notification registration banner now takes into account whether the current Safe is registered before being displayed.

How to test it

  1. Ensure a Safe is added and not registered for notifications.
  2. Open the Safe in question but don't dismiss the notification registration banner.
  3. Open the notification settings for that Safe.
  4. Register for notifications.
  5. Observe the banner close.
  6. Reopening that Safe should not show the banner until it is "unregistered" for notifications.

Screenshots

notification banner

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

@iamacook iamacook requested a review from schmanu October 6, 2023 07:30
@iamacook iamacook self-assigned this Oct 6, 2023
@github-actions
Copy link

github-actions bot commented Oct 6, 2023

Branch preview

✅ Deploy successful!

https://notification_banner_preferences--walletweb.review-wallet-web.5afe.dev

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

const shouldShowBanner = isNotificationsEnabled && !isPushNotificationBannerDismissed && isSafeAdded
const isSafeRegistered = getPreferences(safe.chainId, safeAddress)
const shouldShowBanner =
isNotificationsEnabled && !isPushNotificationBannerDismissed && isSafeAdded && !isSafeRegistered
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rename isNotificationsEnabled to something like isFeatureEnabled? It's confusing wrt user enabling notifications/allowing push notifications.

@katspaugh katspaugh changed the base branch from release/1.19.1 to dev October 6, 2023 07:41
@iamacook iamacook requested a review from katspaugh October 6, 2023 08:02
Copy link
Member

@schmanu schmanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. We could consider writing a test for the Banner component as it's complexity grew a bit.

@francovenica
Copy link
Contributor

Looks good.

The pop up dissapears if you enable notifications in the safe settings
The pop up doesn't show if you enable the notifications from the global settings and then visit the safe.

@iamacook iamacook merged commit bcd8354 into dev Oct 6, 2023
9 checks passed
@iamacook iamacook deleted the notification-banner-preferences branch October 6, 2023 14:24
@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants