Commit feb0582
authored
feat: remove wallet activity in-app and push toggles + source preferences from Trigger API (MetaMask#35474)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
<!--
mms-check directive vocabulary — read by
.github/scripts/shared/pr-template-checks.ts
at module load to build the validation plan. Directives are invisible in
rendered
markdown and must NOT be removed or edited without updating the
validator registry.
type=text Section must contain non-placeholder prose.
type=changelog Section must have a valid CHANGELOG entry: line.
type=issue-link Section must have a Fixes:/Closes:/Refs: line with a
value.
type=manual-testing Section must have real testing steps or an explicit
N/A.
type=screenshot Section must have evidence (image/URL) or an explicit
N/A.
type=checklist Section must have all checkboxes consciously checked.
required=true|false Whether a missing/invalid section runs the validator
at all.
blocking=true|false Whether a failure of this check fails the CI
workflow.
Default: false — failures are shown as warnings in the sticky
comment but do not block the PR.
Sections without a directive are checked for structural presence only.
-->
## **Description**
<!-- mms-check: type=text required=true -->
<!--
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?
-->
**Reason for the change.** Since
`@metamask/notification-services-controller` v24, the wallet-activity
address list has been read from Authenticated User Storage, which is
keyed by canonical profile ID. Profile pairing shares that ID across
every SRP belonging to the same user, so the stored list pooled the
addresses of unrelated SRPs and users could receive wallet-activity
notifications for addresses they do not own.
[MetaMask/core#9985](MetaMask/core#9985)
restores the pre-v24 model: the keyring is the source of truth for
*which* addresses exist, and the Trigger API for *which* of them are
enabled. This PR consumes that controller change on mobile and adapts
the wallet-activity settings UI to it.
**What changes.**
- Bumps `@metamask/notification-services-controller` to the preview
build of the core fix (`26.0.1-preview-1a9713847`; to be replaced by the
stable release once the core PR is merged and released).
- Wallet activity settings section no longer shows the section-level
Push and In-app channel toggles — per-account subscriptions in the
Trigger API are now the whole settings surface. The Wallet activity row
in Settings → Notifications correspondingly no longer shows the "Push,
In app" subtext; the row keeps the same height as before with its title
vertically centered (min-height derived from the `sBodyMD`/`sBodySM`
typography tokens, no hardcoded value).
- Select all / Deselect all no longer writes channel flags to AUS; it
only flips the per-account Trigger API subscriptions.
- A failed account-settings read is now surfaced as an inline error with
switches disabled, instead of silently rendering every account as off —
the controller now rejects on an unreadable Trigger API config rather
than reporting all accounts disabled.
- Account toggles no longer refetch the AUS preferences blob (account
writes no longer touch AUS).
- Appium mock trigger server now mocks the reintroduced `POST
/api/v2/notifications` upsert endpoint (statefully, so reads reflect
writes) and seeds the fixture account as subscribed, which the
keyring-driven fetch path requires for wallet notifications to appear in
smoke tests.
No client-side migration is needed: the controller change heals affected
users on its own — the in-app list is correct immediately and push links
are replaced on the first daily re-subscribe after update.
## **Changelog**
<!-- mms-check: type=changelog required=true blocking=true -->
<!--
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: Fixed wallet activity notifications being scoped to
shared profile storage instead of the wallet's own accounts, and
simplified the Wallet activity settings screen to per-account switches
## **Related issues**
<!-- mms-check: type=issue-link required=true -->
Refs: [MetaMask/core#9985](MetaMask/core#9985)
JIRA: https://consensyssoftware.atlassian.net/browse/GE-460
## **Manual testing steps**
<!-- mms-check: type=manual-testing required=true -->
```gherkin
Feature: Wallet activity notification settings
Scenario: user views the notifications settings list
Given the user has notifications enabled
When user opens Settings > Notifications
Then the Wallet activity row shows no "Push, In app" subtext
And the Wallet activity row has the same height as the other section rows
And every other section row still shows its channel subtext ("Push, In app" or "Off")
Scenario: user manages per-account wallet activity notifications
Given the user has notifications enabled
When user opens Settings > Notifications > Wallet activity
Then no Push or In-app channel toggles are shown
And the user sees their accounts with individual switches reflecting their subscription state
When user turns off an account's switch
Then the switch stays off after closing and reopening the app
And no wallet activity notifications arrive for that account
Scenario: user toggles all accounts at once
Given the user is on the Wallet activity settings section with at least one account enabled
When user taps "Deselect all"
Then every account switch turns off
And the selection persists after relaunching the app
Scenario: user sees only their own wallet activity
Given the user has notifications enabled
When user opens the notifications list
Then only notifications for accounts in the user's wallet are shown
```
## **Screenshots/Recordings**
<!-- mms-check: type=screenshot required=true -->
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<img width="371" height="786" alt="before-nav"
src="https://github.com/user-attachments/assets/6416acfa-a8b9-4f85-aaa2-d9abc269c69e"
/>
<img width="384" height="775" alt="before-settings"
src="https://github.com/user-attachments/assets/767580d5-3c2f-4ba9-a596-ddf1a002ca2e"
/>
### **After**
<img width="383" height="787" alt="after-nav"
src="https://github.com/user-attachments/assets/8f3e6c44-ed9b-4fdf-97f4-6059db3991c0"
/>
<img width="377" height="786" alt="after-settings"
src="https://github.com/user-attachments/assets/17b02517-5938-462f-bc9e-15a1b2eee6c5"
/>
## **Pre-merge author checklist**
<!-- mms-check: type=checklist required=true -->
<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.
Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->
- [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.
#### Performance checks (if applicable)
- [x] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **Pre-merge reviewer checklist**
<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->
- [ ] 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.
<!-- Generated with the help of the pr-description AI skill -->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes wallet-activity notification source of truth and settings UX;
incorrect Trigger API or error handling could mis-scope subscriptions or
block account toggles, but scope is limited to notifications settings
and test mocks.
>
> **Overview**
> Aligns mobile wallet-activity notification settings with
**@metamask/notification-services-controller** `^27.0.1`: per-account
enablement is read and written via the **Trigger API**, not
Authenticated User Storage channel flags.
>
> **Wallet activity UI** no longer shows Push/In-app toggles on the
section screen or a channel summary on the main Notifications list row
(layout keeps row height via `notificationRow` / optional `status`).
**Select all / Deselect all** only calls `toggleAllAccounts` and
analytics; it does **not** `updatePreferencesSection` for push/in-app.
**`refetchAccountSettings`** only refetches account settings from the
Trigger API (preferences blob refetch removed).
>
> **Failed reads** from the Trigger API expose `accountSettingsError`,
show the new `accounts_load_error` copy, and disable switches when there
is no cached data; if earlier settings exist, switches stay enabled and
the error is hidden.
>
> Smoke **Appium** mocks add the Trigger API **upsert** route and seed
the default fixture account as subscribed so keyring-driven fetches work
in E2E.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
45a458b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent c1baf11 commit feb0582
14 files changed
Lines changed: 274 additions & 229 deletions
File tree
- app/components/Views/Settings/NotificationsSettings
- locales/languages
- tests/smoke-appium/notifications/utils
Lines changed: 23 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 39 | + | |
46 | 40 | | |
47 | 41 | | |
48 | 42 | | |
| |||
246 | 240 | | |
247 | 241 | | |
248 | 242 | | |
249 | | - | |
250 | | - | |
251 | 243 | | |
252 | 244 | | |
253 | 245 | | |
| |||
369 | 361 | | |
370 | 362 | | |
371 | 363 | | |
372 | | - | |
373 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
374 | 371 | | |
375 | | - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
376 | 377 | | |
377 | | - | |
378 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
379 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
380 | 389 | | |
381 | 390 | | |
382 | 391 | | |
| |||
498 | 507 | | |
499 | 508 | | |
500 | 509 | | |
501 | | - | |
502 | | - | |
503 | 510 | | |
504 | 511 | | |
505 | 512 | | |
| |||
Lines changed: 14 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | | - | |
| 17 | + | |
19 | 18 | | |
20 | | - | |
21 | 19 | | |
22 | | - | |
23 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 31 | | |
29 | | - | |
30 | | - | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
192 | 194 | | |
193 | 195 | | |
194 | 196 | | |
| 197 | + | |
195 | 198 | | |
196 | 199 | | |
197 | 200 | | |
| |||
Lines changed: 17 additions & 102 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | 100 | | |
117 | 101 | | |
118 | 102 | | |
| |||
176 | 160 | | |
177 | 161 | | |
178 | 162 | | |
179 | | - | |
| 163 | + | |
180 | 164 | | |
181 | 165 | | |
182 | 166 | | |
| |||
206 | 190 | | |
207 | 191 | | |
208 | 192 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 193 | + | |
| 194 | + | |
219 | 195 | | |
220 | 196 | | |
221 | | - | |
| 197 | + | |
222 | 198 | | |
223 | 199 | | |
224 | 200 | | |
| |||
250 | 226 | | |
251 | 227 | | |
252 | 228 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 229 | + | |
263 | 230 | | |
264 | 231 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 232 | + | |
299 | 233 | | |
300 | 234 | | |
301 | 235 | | |
| |||
312 | 246 | | |
313 | 247 | | |
314 | 248 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 249 | + | |
| 250 | + | |
336 | 251 | | |
337 | 252 | | |
338 | 253 | | |
| |||
479 | 394 | | |
480 | 395 | | |
481 | 396 | | |
482 | | - | |
483 | | - | |
484 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
485 | 400 | | |
486 | 401 | | |
487 | 402 | | |
| |||
499 | 414 | | |
500 | 415 | | |
501 | 416 | | |
502 | | - | |
| 417 | + | |
503 | 418 | | |
504 | 419 | | |
505 | 420 | | |
| |||
519 | 434 | | |
520 | 435 | | |
521 | 436 | | |
522 | | - | |
523 | | - | |
524 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
525 | 440 | | |
526 | 441 | | |
527 | 442 | | |
| |||
569 | 484 | | |
570 | 485 | | |
571 | 486 | | |
572 | | - | |
| 487 | + | |
573 | 488 | | |
574 | 489 | | |
575 | 490 | | |
576 | 491 | | |
577 | 492 | | |
578 | | - | |
| 493 | + | |
579 | 494 | | |
580 | 495 | | |
581 | 496 | | |
| |||
0 commit comments