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

[Counterfactual] Disable notifications and message signing #3240

Merged
merged 6 commits into from
Feb 14, 2024

Conversation

usame-algan
Copy link
Member

@usame-algan usame-algan commented Feb 12, 2024

What it solves

Part of #3156

How this PR fixes it

  • Disables the Notifications Banner for newly created counterfactual safes
  • Disables the Button on the Notifications settings page
  • Hides counterfactual safes from the Global notifications page
  • Disables the sign message flow for counterfactual safes

How to test it

  1. Create a new counterfactual safe
  2. Observe no Popup saying "Enable all"
  3. Go to the Notification settings
  4. Observe a disabled button
  5. Go to the global notification preferences
  6. Observe the safe is not showing up in the list
  7. Connect your safe with an app to create an off-chain message (e.g. opensea)
  8. Observe an error message in the modal and the Sign button is disabled

Screenshots

Screenshot 2024-02-12 at 17 57 40 Screenshot 2024-02-12 at 17 57 55 Screenshot 2024-02-13 at 17 25 59

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) 🧑‍💻

Copy link

github-actions bot commented Feb 12, 2024

Copy link

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 1 0
Ignored 0 N/A
  • Result: ✅ success

  • Annotations: 1 total


[warning] react-hooks/exhaustive-deps

verifies the list of dependencies for Hooks like useEffect and similar


Report generated by eslint-plus-action

Copy link

github-actions bot commented Feb 12, 2024

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1.02 MB (🟡 +30 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/settings/notifications 12.49 KB (🟡 +798 B) 1.04 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link

github-actions bot commented Feb 12, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.89% (+0% 🔼)
11522/14606
🔴 Branches
56.88% (+0.05% 🔼)
2578/4532
🟡 Functions
63.65% (+0.04% 🔼)
1833/2880
🟢 Lines
80.2% (+0% 🔼)
10393/12959

Test suite run success

1400 tests passing in 190 suites.

Report generated by 🧪jest coverage report action from 6feb75a

@usame-algan usame-algan changed the title fix: Disable notifications for undeployed safes [Counterfactual] Disable notifications for undeployed safes Feb 12, 2024
Copy link

github-actions bot commented Feb 13, 2024

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

@usame-algan usame-algan changed the title [Counterfactual] Disable notifications for undeployed safes [Counterfactual] Disable notifications and message signing for undeployed safes Feb 13, 2024
@usame-algan usame-algan changed the title [Counterfactual] Disable notifications and message signing for undeployed safes [Counterfactual] Disable notifications and message signing Feb 13, 2024
@francovenica
Copy link
Contributor

Looks good to me

Notifications pop up when creating a CF doesn't show up.
Notifications are locked for CF safes in the settings
The CF is not listed in the global settings for notifications
The error message is in the Message Form to sign (and the sign button is disabled)

Also checked that:
Enabling all notifications in all the safes in the network, then deployed the CF safe, then checking the global settings for notifications the CF safe is not checked (confirming that the enabling of notifcations was not affecting the CF safe)
The notification pop up still works for deployed safes (adding deployed safes, or paying for the creation of one)
Notifications can be enabled for a CF safe that was deployed.

@@ -37,6 +41,16 @@ import css from './styles.module.css'

// UI logic

const _filterUndeployedSafes = (safes: NotifiableSafes, undeployedSafes: UndeployedSafesState) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

safes here is a {[chain]: [address1, address2]} but since the variable name is safes I thought it was a safe object and later when we do difference(safes, undeployedAddresses) I was astonished that it works :)
Maybe at least in mapValues we could call it safeAddresses?

@@ -121,7 +121,12 @@ export const PushNotificationsBanner = ({ children }: { children: ReactElement }
const isSafeAdded = !!addedSafesOnChain?.[safeAddress]
const isSafeRegistered = getPreferences(safe.chainId, safeAddress)
const shouldShowBanner = useDebounce(
Copy link
Collaborator

Choose a reason for hiding this comment

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

just curious - why do we have to debounce here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the issue was that there were too many popups opening up at the same time which looked messy. This way there is a small delay before this popup opens. Not ideal but a bit better on the UX side.

@@ -140,7 +140,7 @@ export const PushNotifications = (): ReactElement => {
<FormControlLabel
control={<Switch checked={!!preferences} onChange={handleOnChange} />}
label={preferences ? 'On' : 'Off'}
disabled={!isOk || isRegistering}
disabled={!isOk || isRegistering || !safe.deployed}
Copy link
Collaborator

Choose a reason for hiding this comment

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

in SignMessage we do const isDisabled= which I prefer, but ok :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree, with that many variables it makes sense to extract it into a new one for better readability.

Copy link
Member Author

Choose a reason for hiding this comment

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

One issue is that here we have the isOk variable which comes from the HoC so we can't extract that easily.

@usame-algan usame-algan merged commit 558d48e into dev Feb 14, 2024
15 checks passed
@usame-algan usame-algan deleted the cf-disable-notifications branch February 14, 2024 12:53
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2024
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.

3 participants