Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move metrics identify to state listener (#13203)
## **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 MetaMask/mobile-planning#2119 ## **Manual testing steps** ```gherkin 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** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **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** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). 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.
- Loading branch information