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

feat(NOTIFY-1096): add account syncing #11190

Open
wants to merge 53 commits into
base: main
Choose a base branch
from

Conversation

mathieuartu
Copy link

@mathieuartu mathieuartu commented Sep 13, 2024

Description

This PR adds account syncing to MetaMask.
As part of profile syncing, with this new feature, users will be able to synchronize all of their accounts and accounts' names across all of their devices.

Related issues

Fixes:

NOTIFY-1096

Manual testing steps

  1. Log in with SRP
  2. Activate profile syncing in preferences
  3. Add new accounts and rename others
  4. Using another browser, log in with SRP
  5. Activate profile syncing in preferences
  6. Watch the magic happen!

Pre-merge author checklist

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.

@mathieuartu mathieuartu added the team-notifications Notifications team label Sep 13, 2024
Copy link
Contributor

github-actions bot commented Sep 13, 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.

@mathieuartu
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Sep 13, 2024
Copy link

socket-security bot commented Sep 13, 2024

@codecov-commenter
Copy link

codecov-commenter commented Sep 13, 2024

Codecov Report

Attention: Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 55.68%. Comparing base (7475ab4) to head (9aca646).
Report is 29 commits behind head on main.

Files with missing lines Patch % Lines
app/components/Views/Wallet/index.tsx 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11190      +/-   ##
==========================================
+ Coverage   55.24%   55.68%   +0.43%     
==========================================
  Files        1558     1573      +15     
  Lines       37153    37497     +344     
  Branches     4406     4473      +67     
==========================================
+ Hits        20527    20880     +353     
+ Misses      16155    16126      -29     
- Partials      471      491      +20     

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

@mathieuartu mathieuartu added Run Smoke E2E Triggers smoke e2e on Bitrise and removed INVALID-PR-TEMPLATE PR's body doesn't match template labels Sep 13, 2024
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Sep 13, 2024
Copy link
Contributor

github-actions bot commented Sep 13, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: b9bb37a
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/2134006d-61ca-4b88-9604-1c8f52146b4d

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@mathieuartu mathieuartu added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Sep 13, 2024
Copy link
Contributor

github-actions bot commented Sep 13, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 6c9b2ce
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/79653e7d-5260-497f-b2ed-3cdcf84785e9

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@mathieuartu mathieuartu added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Sep 13, 2024
Copy link
Contributor

github-actions bot commented Sep 13, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: ab17435
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/362ae0c7-a89a-402c-956b-3c7737d8a7c0

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@mathieuartu mathieuartu added the Run Smoke E2E Triggers smoke e2e on Bitrise label Oct 9, 2024
Copy link
Contributor

github-actions bot commented Oct 9, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: b03fd6a
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/573d1eaf-b40c-46ad-9fe2-0ef1accc0601

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@mathieuartu mathieuartu added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 16, 2024
Copy link
Contributor

github-actions bot commented Oct 16, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: c953e4f
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/7782ae0f-377a-4e66-8fce-788def5ae4a4

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

app/components/Views/Wallet/index.tsx Show resolved Hide resolved
app/core/Engine.ts Show resolved Hide resolved
@mathieuartu mathieuartu marked this pull request as ready for review October 16, 2024 08:05
@mathieuartu mathieuartu requested review from a team as code owners October 16, 2024 08:05
Jonathansoufer
Jonathansoufer previously approved these changes Oct 16, 2024
Copy link
Contributor

@Jonathansoufer Jonathansoufer left a comment

Choose a reason for hiding this comment

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

LGTM!

Daniel-Cross
Daniel-Cross previously approved these changes Oct 16, 2024
Copy link
Contributor

@Daniel-Cross Daniel-Cross left a comment

Choose a reason for hiding this comment

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

Just one small listing issue fix and you're good to go!

Daniel-Cross
Daniel-Cross previously approved these changes Oct 16, 2024
Copy link
Contributor

@Daniel-Cross Daniel-Cross left a comment

Choose a reason for hiding this comment

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

GTG!

app/util/notifications/hooks/useProfileSyncing.ts Outdated Show resolved Hide resolved
useLayoutEffect(() => {
const handleAppStateChange = (nextAppState: AppStateStatus) => {
if (
appState.current.match(/inactive|background/) &&
nextAppState === 'active'
) {
listNotifications();
dispatchAccountSyncing();
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Can we test this effect in the unit tests?

Copy link
Author

Choose a reason for hiding this comment

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

It's a pain to locally test using jest for app/components/Views/Wallet/index.test.tsx, do you have a trick in mind so I can bypass this error?

Happy to explore that for both listNotifications and dispatchAccountSyncing in a subsequent PR as well. LMK

Capture d’écran 2024-10-16 à 11 29 24

Copy link

sonarcloud bot commented Oct 16, 2024

Comment on lines +1222 to +1233
MetaMetrics.getInstance().trackEvent(
MetaMetricsEvents.ACCOUNTS_SYNC_ADDED,
{
profile_id: profileId,
},
);
},
onAccountNameUpdated: (profileId) => {
MetaMetrics.getInstance().trackEvent(
MetaMetricsEvents.ACCOUNTS_SYNC_NAME_UPDATED,
{
profile_id: profileId,
Copy link
Contributor

Choose a reason for hiding this comment

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

C: trackEvent called with legacy way has been deprecated recently. You will find out how to use the new MetricsEventBuilder in the code documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template Run Smoke E2E Triggers smoke e2e on Bitrise team-notifications Notifications team
Projects
Status: Needs more work from the author
Development

Successfully merging this pull request may close these issues.

7 participants