Commit 9402870
authored
fix: metrics for hardware wallets cp-7.61.0 (MetaMask#22773)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
This PR standardises the metrics for hardware wallets to align with the
extension.
The schemas follow the following
-
https://www.figma.com/design/9sGBc6mZkQVBKitQzsD0iI/Hardware-Wallet-Metrics?node-id=0-1&p=f&t=Q6IqeowrBX3vu5rF-0
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
Fixes:
https://consensyssoftware.atlassian.net/browse/MUL-1241?atlOrigin=eyJpIjoiZTNiNWQzNDEzZGMwNDc0OGFlMTc4YTJmYWJmMzQ5NTMiLCJwIjoiaiJ9
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
N/a no user facing changes.
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Unifies hardware wallet analytics with new events and properties
across QR and Ledger flows, adds device info/count tracking and
permission/error metrics, plus comprehensive tests and utilities.
>
> - **Analytics (Hardware Wallets)**:
> - Replace legacy `LEDGER_*`/QR events with unified `HARDWARE_WALLET_*`
events (e.g., `CONNECT_HARDWARE_WALLET`, `HARDWARE_WALLET_ADD_ACCOUNT`,
`HARDWARE_WALLET_ERROR`, `HARDWARE_WALLET_ACCOUNT_SELECTOR_OPEN`,
`HARDWARE_WALLET_CONNECTION_RETRY`, `HARDWARE_WALLET_MARKETING`,
`HARDWARE_WALLET_CONNECT_INSTRUCTIONS`).
> - Add common properties: `device_type`, `device_model` (incl. BLE UUID
mapping), `connected_device_count`, `hd_path`, and detailed error
strings.
> - Track permission requests/results
(`HARDWARE_WALLET_PERMISSION_REQUEST`) and camera/QR scanning errors.
> - Update cancel events to `DAPP_TRANSACTION_CANCELLED` where
applicable.
> - **Flows Updated**:
> - QR: `AnimatedQRScanner`, `ConnectQRHardware` (continue, account
selector, add account, forget device, error),
`ConnectQRHardware/Instruction` (marketing links).
> - Ledger: `LedgerConnect` (instructions, found device, continue/retry,
marketing), `LedgerConnect/Scan` (permission/BT errors with model),
`LedgerConfirmationModal` (errors/cancel), `LedgerSelectAccount`
(account selector open/add/forget/error).
> - Account screens: `AccountConnect` and `AccountPermissions` track HW
connect with device count; `AccountActions` forget-device metrics per
keyring.
> - Multichain actions: use `ADD_HARDWARE_WALLET` for HW button.
> - **Utilities & Hooks**:
> - New `getConnectedDevicesCount` (counts connected HW keyrings).
> - New `useLedgerDeviceForAccount` hook for per-account Ledger device
context.
> - New device utilities: `sanitizeDeviceName`,
`ledgerDeviceUUIDToModelName`.
> - **Testing & Mocks**:
> - Extensive test coverage added/updated for all flows; enhanced
`react-native-vision-camera` mock to capture callbacks.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9c9bf99. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 5ba6d92 commit 9402870
36 files changed
Lines changed: 3976 additions & 215 deletions
File tree
- app
- __mocks__
- component-library/components-temp/MultichainAccounts/MultichainAddWalletActions
- components
- UI
- LedgerModals
- QRHardware
- Views
- AccountActions
- AccountConnect
- AccountPermissions
- ConnectHardware/SelectHardware
- ConnectQRHardware
- Instruction
- LedgerConnect
- LedgerSelectAccount
- __snapshots__
- confirmations
- context/qr-hardware-context
- legacy/components/PersonalSign
- hooks/Ledger
- core
- Analytics
- HardwareWallets
- QrKeyring
- util/hardwareWallet
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
33 | 63 | | |
34 | 64 | | |
35 | 65 | | |
36 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
37 | 75 | | |
38 | 76 | | |
Lines changed: 87 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
21 | 34 | | |
22 | 35 | | |
23 | 36 | | |
| |||
147 | 160 | | |
148 | 161 | | |
149 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
150 | 237 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
Lines changed: 34 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
| |||
47 | 45 | | |
48 | 46 | | |
49 | 47 | | |
| 48 | + | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
53 | 71 | | |
54 | 72 | | |
55 | 73 | | |
| |||
71 | 89 | | |
72 | 90 | | |
73 | 91 | | |
74 | | - | |
| 92 | + | |
75 | 93 | | |
76 | 94 | | |
77 | 95 | | |
| |||
143 | 161 | | |
144 | 162 | | |
145 | 163 | | |
146 | | - | |
| 164 | + | |
147 | 165 | | |
148 | | - | |
149 | 166 | | |
| 167 | + | |
150 | 168 | | |
151 | 169 | | |
152 | 170 | | |
| |||
166 | 184 | | |
167 | 185 | | |
168 | 186 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | 187 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 188 | + | |
| 189 | + | |
184 | 190 | | |
| 191 | + | |
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
| |||
351 | 358 | | |
352 | 359 | | |
353 | 360 | | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | 361 | | |
358 | 362 | | |
359 | 363 | | |
360 | | - | |
361 | 364 | | |
362 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
363 | 369 | | |
364 | 370 | | |
365 | 371 | | |
| |||
380 | 386 | | |
381 | 387 | | |
382 | 388 | | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | 389 | | |
387 | | - | |
388 | 390 | | |
389 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
390 | 395 | | |
391 | 396 | | |
392 | 397 | | |
| |||
407 | 412 | | |
408 | 413 | | |
409 | 414 | | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | 415 | | |
414 | 416 | | |
415 | 417 | | |
| |||
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 98 | + | |
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
| |||
209 | 207 | | |
210 | 208 | | |
211 | 209 | | |
212 | | - | |
| 210 | + | |
213 | 211 | | |
214 | 212 | | |
215 | 213 | | |
| |||
242 | 240 | | |
243 | 241 | | |
244 | 242 | | |
245 | | - | |
| 243 | + | |
246 | 244 | | |
247 | 245 | | |
248 | 246 | | |
| |||
258 | 256 | | |
259 | 257 | | |
260 | 258 | | |
261 | | - | |
| 259 | + | |
262 | 260 | | |
263 | 261 | | |
264 | 262 | | |
| |||
0 commit comments