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

chore: move metrics identify to state listener #13203

Merged
merged 6 commits into from
Jan 31, 2025

Conversation

NicolasMassart
Copy link
Contributor

@NicolasMassart NicolasMassart commented Jan 27, 2025

Description

  • moves identify call to active app state listener
  • updates unit tests
  • also fixes trackEvent mock wrongly being used as async in app/core/AppStateEventListener.test.ts

Related issues

Fixes https://github.com/MetaMask/mobile-planning/issues/2119

Manual testing steps

Feature: identify users
  Scenario: identify on app state change to active
    Given an already onboarded app
    And user opted in for metrics
    When you open the app in local dev mode
    Then you have the `IDENTIFY event saved` log

Screenshots/Recordings

Before

IDENTIFY event sent but only on app open and not when foregrounding (active)

After

 INFO  IDENTIFY event saved {"traits": {"Batch account balance requests": "ON", "Enable OpenSea API": "ON", "NFT Autodetection": "ON", "Theme": "light", "applicationVersion": "7.37.1", "currentBuildNumber": "1520", "deviceBrand": "Apple", "operatingSystemVersion": "18.2", "platform": "ios", "security_providers": "blockaid", "token_detection_enable": "ON"}, "type": "identify", "userId": "150739a9-38b7-4098-b1f0-7afbba0b2e5d"}
 INFO  TRACK event saved {"event": "App Opened", "properties": {}, "type": "track"}
 INFO  Sent 2 events

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.

@NicolasMassart NicolasMassart self-assigned this Jan 27, 2025
@NicolasMassart NicolasMassart added the team-mobile-platform Mobile Platform team label Jan 27, 2025
Copy link
Contributor

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.

@NicolasMassart NicolasMassart marked this pull request as ready for review January 27, 2025 17:55
@NicolasMassart NicolasMassart requested a review from a team as a code owner January 27, 2025 17:55
@NicolasMassart NicolasMassart added needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) Run Smoke E2E Triggers smoke e2e on Bitrise labels Jan 27, 2025
Copy link
Contributor

github-actions bot commented Jan 27, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 9f9ef78
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d28d55ca-776b-4c43-9609-2c350dfbabf0

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

@NicolasMassart NicolasMassart changed the title chore: move ident to state listener chore: move metrics identify to state listener Jan 29, 2025
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

Left a comment

app/core/AppStateEventListener.ts Show resolved Hide resolved
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM

@NicolasMassart NicolasMassart added this pull request to the merge queue Jan 31, 2025
Copy link
Contributor

@chrisleewilcox chrisleewilcox left a comment

Choose a reason for hiding this comment

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

LGTM

Merged via the queue into main with commit 711a583 Jan 31, 2025
38 of 39 checks passed
@NicolasMassart NicolasMassart deleted the chore/2119_move_identify_call branch January 31, 2025 18:21
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jan 31, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2025
@metamaskbot metamaskbot added the release-7.41.0 Issue or pull request that will be included in release 7.41.0 label Jan 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.41.0 Issue or pull request that will be included in release 7.41.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-mobile-platform Mobile Platform team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants