MetaMask / MetaMask/metamask-mobile

Extract analytics related code from ApproveView/Approve in to hook

Open
#5,601 1 comment 0 reactions 0 assignees View on GitHub
area-transactions team-confirmations-planning type-pinned type-tech-debt
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

### **Description**

Extracting out analytics related code from ApproveView/Approve into a separate hook.

After this task is completed https://github.com/MetaMask/metamask-mobile/issues/5574 ApproveView/Approve will be converted into a functional component. With about 740 lines of code the component is currently huge. Analytics related code is not directly related to the functionality of approving can be extracted out a separate hook thus reducing complexity of this component.

This can include following functions being moved to the hook:

1. trackApproveEvent
2. getAnalyticsParams
3. setAnalyticsParams
4. getGasAnalyticsParams
5. create new functions: trackApprovalCompleted, trackApprovalCancelled, ...

### **Acceptance Criteria**
- Approve functionality continue to work as before and analytics work as expected.

### **References**
https://docs.google.com/document/d/19xKY4e07UThOa1jsDQA8pjsNLUBRn39EdUbaFpz3OR0/edit?usp=sharing

Contributor guide

Open the contributing guide

Research direction

Start by locating ApproveView/Approve and the listed analytics functions: trackApproveEvent, getAnalyticsParams, setAnalyticsParams, and getGasAnalyticsParams. Extract the analytics responsibilities into a hook, add completion and cancellation tracking as needed, then verify that approval behavior and analytics continue to work as before.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
analytics, mobile
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.