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(notifications): Ensure notifications feature is disabled/hidden when no basic functionality #25070

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Jun 5, 2024

Description

This ensures that our feature is fully disabled when the basic functionality is disabled.
This is mostly a Hot-Fix, and a more structured UX/UI will be available once discussed with design and product.

Open in GitHub Codespaces

Related issues

Fixes: The current Profile Syncing Feature doesn't fully respect Basic Functionality when turned off. This ensures that the notifications feature and profile syncing are actually turned off when Basic Functionality if off.

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Updated/Fixed Onboarding flow for Basic Functionality + Profile Syncing
See vid

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@Prithpal-Sooriya Prithpal-Sooriya added the team-notifications Notifications team label Jun 5, 2024
Copy link
Contributor

github-actions bot commented Jun 5, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

flexDirection={FlexDirection.Row}
alignItems={AlignItems.center}
justifyContent={JustifyContent.spaceBetween}
{basicFunctionality && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are hiding notifications when basic functionality is disabled. We can rethink this in a future PR to re-engage users to notifications.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I agree. I'm not a big fan of the idea of completely hiding the functionality. It might be more interesting to follow the flow used for notifications: if the user wants to enable profile sync and basic functionality is turned off, then show a modal that informs the user that to enable profile sync, basic functionality must also be enabled. By clicking the button on the modal, we can cascade the turning on of basic functionality, authentication, and profile sync.

setIsProfileSyncingEnabled(false);
}
}, [basicFunctionality, setIsProfileSyncingEnabled]);
}

const ProfileSyncToggle = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Prith Note) this is a little annoying, we have basically 2 of the same toggles. 1 for Onboarding, and another here. I wish we could use the same component (but I understand the use-case/logic is different.)

@metamaskbot
Copy link
Collaborator

Builds ready [5fa3bb7]
Page Load Metrics (52 ± 4 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint711028794
domContentLoaded9131011
load41655284
domInteractive8131011
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 1.08 KiB (0.02%)
  • common: 101 Bytes (0.00%)

@Prithpal-Sooriya Prithpal-Sooriya changed the title feat(notifications): Ensure notifications feature is disabled/hidden when no basic functionality fix(notifications): Ensure notifications feature is disabled/hidden when no basic functionality Jun 6, 2024
@@ -49,5 +49,6 @@
"authentication.api.cx.metamask.io",
"oidc.api.cx.metamask.io",
"price.api.cx.metamask.io",
"token.api.cx.metamask.io"
"token.api.cx.metamask.io",
"sepolia.infura.io"
Copy link
Contributor Author

@Prithpal-Sooriya Prithpal-Sooriya Jun 6, 2024

Choose a reason for hiding this comment

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

Ran the vault tests locally to make sure onboarding is okay. Needed to update the snapshot to include sepolia. Is this intended? (@MetaMask/notifications we do not touch any network logic)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vault Test: yarn test:e2e:single test/e2e/vault-decryption-chrome.spec.js --browser=chrome, this flow turns off basic functionality so wanted to make sure the new fix/changes worked as expected.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should be needed. You should be able to remove this change and this PR's build will still pass.

Comment on lines -523 to -531
await driver.clickElement(
'[data-testid="profile-sync-toggle"] .toggle-button',
);
await driver.clickElement('[data-testid="submit-button"]');

await Promise.all(
(
await driver.findClickableElements(
'.toggle-button.toggle-button--on:not([data-testid="basic-functionality-toggle"] .toggle-button):not([data-testid="profile-sync-toggle"] .toggle-button)',
Copy link
Contributor Author

@Prithpal-Sooriya Prithpal-Sooriya Jun 6, 2024

Choose a reason for hiding this comment

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

We do not need this e2e setup for onboarding.

Context: This helper goes through onboarding without basic functionality (no additional APIs), and thus also turned off profile syncing. However now we automatically turn off this feature when basic functionality is disabled.

@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review June 6, 2024 15:54
@Prithpal-Sooriya Prithpal-Sooriya requested review from a team as code owners June 6, 2024 15:54
… NOTIFY-724-hide-notifications-when-basic-functionality-is-disabled
… NOTIFY-724-hide-notifications-when-basic-functionality-is-disabled
@metamaskbot
Copy link
Collaborator

Builds ready [9337e69]
Page Load Metrics (252 ± 291 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6714987188
domContentLoaded8171121
load422161252606291
domInteractive8171121
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 964 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 82.97872% with 8 lines in your changes missing coverage. Please review.

Project coverage is 65.66%. Comparing base (ed5ec2d) to head (b296851).
Report is 3 commits behind head on develop.

Files Patch % Lines
...i/components/multichain/global-menu/global-menu.js 33.33% 4 Missing ⚠️
...boarding-flow/privacy-settings/privacy-settings.js 86.36% 3 Missing ⚠️
...ty-tab/profile-sync-toggle/profile-sync-toggle.tsx 87.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25070      +/-   ##
===========================================
+ Coverage    65.64%   65.66%   +0.02%     
===========================================
  Files         1362     1362              
  Lines        54189    54210      +21     
  Branches     14112    14119       +7     
===========================================
+ Hits         35572    35594      +22     
+ Misses       18617    18616       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

matteoscurati
matteoscurati previously approved these changes Jun 7, 2024
Copy link
Contributor

@matteoscurati matteoscurati left a comment

Choose a reason for hiding this comment

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

Great work. Just one comment for future development. Other than that, it’s super okay for me

flexDirection={FlexDirection.Row}
alignItems={AlignItems.center}
justifyContent={JustifyContent.spaceBetween}
{basicFunctionality && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I agree. I'm not a big fan of the idea of completely hiding the functionality. It might be more interesting to follow the flow used for notifications: if the user wants to enable profile sync and basic functionality is turned off, then show a modal that informs the user that to enable profile sync, basic functionality must also be enabled. By clicking the button on the modal, we can cascade the turning on of basic functionality, authentication, and profile sync.

@@ -49,5 +49,6 @@
"authentication.api.cx.metamask.io",
"oidc.api.cx.metamask.io",
"price.api.cx.metamask.io",
"token.api.cx.metamask.io"
"token.api.cx.metamask.io",
"sepolia.infura.io"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should be needed. You should be able to remove this change and this PR's build will still pass.

… NOTIFY-724-hide-notifications-when-basic-functionality-is-disabled
we don't actually need this change (CI passes without it)
… NOTIFY-724-hide-notifications-when-basic-functionality-is-disabled
@Prithpal-Sooriya Prithpal-Sooriya requested a review from danjm June 10, 2024 08:41
@metamaskbot
Copy link
Collaborator

Builds ready [b296851]
Page Load Metrics (50 ± 3 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6710484115
domContentLoaded9161121
load41625063
domInteractive9161121
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 964 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

@Prithpal-Sooriya
Copy link
Contributor Author

@danjm yep you are correct, we do not need to update the privacy snapshot. Reverted the snapshot change.

Copy link
Contributor

@matteoscurati matteoscurati left a comment

Choose a reason for hiding this comment

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

I approve again!

@Prithpal-Sooriya Prithpal-Sooriya merged commit 556b43f into develop Jun 10, 2024
105 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the NOTIFY-724-hide-notifications-when-basic-functionality-is-disabled branch June 10, 2024 15:44
@github-actions github-actions bot locked and limited conversation to collaborators Jun 10, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-notifications Notifications team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants