Repository navigation
refactor(ui): split the Advanced mode row with MenuItem's row action - #1440
Conversation
The Advanced mode row wrapped a MenuItem with a switch inside a Button that opened the explainer, and an accessibility representation made the pair read as one switch. MenuItem(action:) from DashUIKit#63 does the split itself: the icon and text are a button that opens the explainer, and the switch is its own element named after the row. ToggleRowAccessibility now covers only the plain toggle rows, where the whole row is the switch. The Settings rows UI-test fixture made its own window in AppDelegate, which the scene replaced since the UIScene adoption, so SettingsRowsUITests saw onboarding. It is now shown through installWindowInScene: like the other fixtures. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
✅ Final review complete — no blockers (commit f657e82) · triage: normal |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The change correctly implements the split Advanced mode interaction and updates the fixture through the scene lifecycle. CI reports the affected app build/tests and accessibility audit passing. Two non-blocking maintainability issues remain in the changed SettingsScreen code: one comment overstates the tap area, and the branch predicate is duplicated.
💬 2 nitpick(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — This is a small, well-contained UI accessibility and test-fixture refactor with limited behavior changes and no critical security, funds, or persistence surfaces involved. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 99% left, weekly 99% left; passed overgemini-3.8-flash-high(antigravity quota lookup failed) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `DashWallet/Sources/UI/Menu/Settings/SettingsScreen.swift`:
- [NITPICK] DashWallet/Sources/UI/Menu/Settings/SettingsScreen.swift:148-153: Tap-target comment incorrectly describes the explainer-toggle branch
This comment says the row's full height is the tap target, but the `explainsToggle` branch no longer wraps the content in an outer button. In that branch, `MenuItem` supplies a button for the icon and text while the switch is separate, so the empty strip added by `frame(minHeight:)` does not open the explainer. Scope the comment to the plain-toggle Button branches so it remains accurate after this refactor.
- [NITPICK] DashWallet/Sources/UI/Menu/Settings/SettingsScreen.swift:175-188: MenuItem initializer re-derives the row-branch predicate
`row(for:)` uses `explainsToggle(item)` to choose the split interaction, while `menuItem(for:isOn:)` independently checks `item.showToggle` and `item.infoAction` to choose the action initializer. These conditions currently match, but future changes to one predicate could make the row branch and the MenuItem initializer disagree. Reuse the same helper so there is one decision point.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- DashUIKit dependency remains pinned to an unversioned master branch — The new call depends on a recently added DashUIKit API while the project resolves DashUIKit from
branch = masterwithout a committed Package.resolved. A fresh checkout whose package cache predates the API can fail to compile even though the current CI resolution succeeds. This is a pre-existing dependency-management issue rather than a defect introduced by the SettingsScreen change.- Follow-up: Open a separate dependency-management PR to pin DashUIKit to a compatible release/tag or commit a reproducible Package.resolved.
| // The row's full height is the tap target: `MenuItem` draws no | ||
| // background of its own, so without the shape a plain-style button | ||
| // would answer only on the icon and text, not on the gaps or the | ||
| // strip the minimum height adds. | ||
| .frame(minHeight: 60) | ||
| .contentShape(Rectangle()) |
There was a problem hiding this comment.
✅ Resolved at
f657e827; see the replies below.
💬 Nitpick: Tap-target comment incorrectly describes the explainer-toggle branch
This comment says the row's full height is the tap target, but the explainsToggle branch no longer wraps the content in an outer button. In that branch, MenuItem supplies a button for the icon and text while the switch is separate, so the empty strip added by frame(minHeight:) does not open the explainer. Scope the comment to the plain-toggle Button branches so it remains accurate after this refactor.
| // The row's full height is the tap target: `MenuItem` draws no | |
| // background of its own, so without the shape a plain-style button | |
| // would answer only on the icon and text, not on the gaps or the | |
| // strip the minimum height adds. | |
| .frame(minHeight: 60) | |
| .contentShape(Rectangle()) | |
| // The row's full height is the tap target for the Button branches: | |
| // `MenuItem` draws no background of its own, so without the shape a | |
| // plain-style button would answer only on the icon and text, not on | |
| // the gaps or the strip the minimum height adds. The explainsToggle | |
| // branch has no outer button, so the strip above and below the text is | |
| // intentionally inert. | |
| .frame(minHeight: 60) | |
| .contentShape(Rectangle()) |
source: glm-5.3-flash (phase1-reviewer: general)
There was a problem hiding this comment.
Fixed in f657e82: the comment now says the full-height tap target applies to rows wrapped in a button, and that on the explainer row only MenuItem's icon-and-text button opens the explainer.
There was a problem hiding this comment.
Resolved (re-reviewed at f657e827): Fixed in f657e82: the comment now limits the full-height tap-target explanation to rows wrapped in a button and explicitly states that the explainer row's surrounding strip is inert.
| private static func explainsToggle(_ item: MenuItemModel) -> Bool { | ||
| item.showToggle && item.infoAction != nil | ||
| } | ||
|
|
||
| private static func menuItem(for item: MenuItemModel, isOn: Binding<Bool>) -> DashUIKit.MenuItem { | ||
| let leadingIcon = item.icon.map(iconSource) | ||
| let info: MenuItemInfo? = item.showInfo ? .round(color: Color.dash.gray300Alpha70) : nil | ||
| let accessory: MenuItemAccessory = item.showToggle | ||
| ? .toggle(isOn: isOn) | ||
| : (item.details.map { .text($0) } ?? .none) | ||
|
|
||
| if item.showToggle, let infoAction = item.infoAction { | ||
| return DashUIKit.MenuItem(leadingIcon: leadingIcon, title: item.title, helpText: item.subtitle, | ||
| info: info, accessory: accessory, action: infoAction) |
There was a problem hiding this comment.
✅ Resolved at
f657e827; see the replies below.
💬 Nitpick: MenuItem initializer re-derives the row-branch predicate
row(for:) uses explainsToggle(item) to choose the split interaction, while menuItem(for:isOn:) independently checks item.showToggle and item.infoAction to choose the action initializer. These conditions currently match, but future changes to one predicate could make the row branch and the MenuItem initializer disagree. Reuse the same helper so there is one decision point.
| private static func explainsToggle(_ item: MenuItemModel) -> Bool { | |
| item.showToggle && item.infoAction != nil | |
| } | |
| private static func menuItem(for item: MenuItemModel, isOn: Binding<Bool>) -> DashUIKit.MenuItem { | |
| let leadingIcon = item.icon.map(iconSource) | |
| let info: MenuItemInfo? = item.showInfo ? .round(color: Color.dash.gray300Alpha70) : nil | |
| let accessory: MenuItemAccessory = item.showToggle | |
| ? .toggle(isOn: isOn) | |
| : (item.details.map { .text($0) } ?? .none) | |
| if item.showToggle, let infoAction = item.infoAction { | |
| return DashUIKit.MenuItem(leadingIcon: leadingIcon, title: item.title, helpText: item.subtitle, | |
| info: info, accessory: accessory, action: infoAction) | |
| if Self.explainsToggle(item), let infoAction = item.infoAction { | |
| return DashUIKit.MenuItem(leadingIcon: leadingIcon, title: item.title, helpText: item.subtitle, | |
| info: info, accessory: accessory, action: infoAction) | |
| } |
source: glm-5.3-flash (phase1-reviewer: general)
There was a problem hiding this comment.
Fixed in f657e82: explainerAction(_:) returns the explainer for a toggle row (or nil), and both row(for:) and menuItem(for:isOn:) read it, so the branch and the initializer cannot disagree. SettingsRowsUITests (4) still pass.
There was a problem hiding this comment.
Resolved (re-reviewed at f657e827): Fixed in f657e82: explainerAction(_:) is now the shared decision used by both row(for:) and menuItem(for:isOn:), so the row branch and MenuItem initializer cannot diverge.
explainerAction(_:) is what both row(for:) and menuItem(for:isOn:) read to tell a toggle row that opens an explainer from the others, so the two cannot disagree. The tap-target comment now says the full-height shape applies to rows wrapped in a button, not to the explainer row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The reviewed head correctly centralizes the Advanced-mode split predicate, delegates the explainer action to DashUIKit's row-action initializer, and keeps the switch independent from the body button. The settings UI-test fixture now follows the scene-based window lifecycle used by the other fixtures. No in-scope findings remain; workflow lint, target-membership, and accessibility checks passed, while the simulator test job was still in progress with no reported failure.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a contained UI behavior and accessibility refactor with accompanying UI-test fixture changes, so its correctness requires ordinary review but does not affect a critical surface. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
Summary
Uses
MenuItem(…, action:)from dashpay/DashUIKit#63 for the Settings row that has both a switch and an explainer (Advanced mode), and drops the app-side workaround for it.Buttonthat opened the explainer, wrapped around aMenuItemwith an interactive switch, and an accessibility representation made the pair read as one switch with a "Learn more" action. NowMenuItemsplits it: the icon and text are one button that opens the explainer, and the switch is its own element, labelled "Advanced mode". The switch is no longer nested inside a button.MenuItemhas no "the row is the switch" mode, soToggleRowAccessibilitystays for these rows only, without the explainer part.SettingsRowsUITestshad not reached the Settings screen since the UIScene adoption (fix(wallet): adopt the UIScene life cycle so the app launches on iOS 27 #1145): the fixture made its own window inAppDelegate, and the scene replaced it, so the tests saw onboarding. The fixture is now shown throughinstallWindowInScene:, like the username-recovery and shielded-history fixtures.No visual change. One behaviour difference: on the Advanced mode row, the empty strip above and below the text no longer opens the explainer. The icon and text do.
Test plan
SettingsRowsUITests(DashPayRecovery scheme), 4 pass:scripts/a11y_audit.py --check: no new findingsNotes from the tests:
SwitchViewkeeps a zero-size switch inside its own element. VoiceOver does not enter an element, so it is not read; the tests count only the row's direct children.advanced_mode_info_sheetidentifier covers its children's, so the test cleanup finds the close button by its "Close" label rather thannavigationbar-close.🤖 Generated with Claude Code
Summary by CodeRabbit