feat: adult content filter toggle + native New Rule navigation

- Add Block Adult Content toggle to all three rule editors, persisted as
  BlockingRule.blockAdultContent (inline default for clean migration of
  existing stores) and surfaced in the detail sheet as an
  'Adult websites: Blocked/Allowed' row
- Engage Screen Time's adult-website filter
  (webContent.blockedByFilter = .auto()) alongside the rule's shield and
  clear it when the shield clears
- Replace the New Rule sheet's view-swap with a NavigationStack push
  (navigationDestination(item:)); the editor uses native chrome there
  (system back button, inline title, toolbar rename), enabling the push
  animation and edge-swipe back
- Tests: 93 passing (+2 unit: draft round-trip and enforcer forwarding;
  +3 UI: toggle-to-detail flow, default-allowed row, swipe-back as a
  behavioral proof of native navigation)
- Spec updated accordingly (editor sections, behavior, data model,
  navigation note)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-12 13:34:52 -04:00
parent e6c87baeba
commit c99538565c
11 changed files with 182 additions and 26 deletions

View File

@@ -126,6 +126,11 @@ Presented from "+ New". Full-height sheet, scrollable.
and a circular "+" button bottom-right. Tapping anywhere opens the
Schedule editor pre-filled with the preset's name/times/days.
> **Navigation (Severed):** picking a rule type or preset **pushes** the
> editor inside the sheet via native SwiftUI navigation (`NavigationStack` +
> `navigationDestination(item:)`), so the system push animation and
> edge-swipe-back work; the editor keeps its custom header chrome.
### 3.4 Rule Editor — Schedule type
Sheet with: back (top-left), centered **rule name** as title, ✎ pencil
@@ -145,7 +150,13 @@ Sections (each an inset rounded group with a small icon + caption header):
- Row: `Selected Apps``N Apps ` — pushes the App Picker.
4. **Hard Mode** `⚡PRO` badge — subtitle "No unblocks allowed"; trailing
toggle.
5. **CTA**
5. **Block Adult Content** *(Severed addition — not in the Opal video)*
subtitle "Filter adult websites while this rule is active"; trailing
toggle. Maps to Screen Time's web-content filter
(`ManagedSettingsStore.webContent.blockedByFilter = .auto(...)`), applied
and cleared together with the rule's shield. Surfaces in the rule detail
as an "Adult websites | Blocked/Allowed" row.
6. **CTA**
- Creating: full-width gradient pill "**Hold to Commit**" — a press-and-hold
interaction (deliberate friction) that fills, then saves and dismisses to
the Apps screen where the new card appears.
@@ -163,13 +174,14 @@ Same chrome (back / title / rename). Sections:
4. **🛡 Then block app** — row `Until` with stepper value `Tomorrow ⌃⌄`
(reset point — e.g. tomorrow/next morning).
5. **Hard Mode** toggle — same as Schedule.
6. **Hold to Commit**.
6. **Block Adult Content** toggle — same as Schedule.
7. **Hold to Commit**.
### 3.6 Rule Editor — Open Limit type
Not demoed beyond its card. Spec by analogy: "When I open [apps]" /
"More than `N opens ⌃⌄` (Daily)" / day picker / "Then block until …" /
Hard Mode / Hold to Commit.
Hard Mode / Block Adult Content / Hold to Commit.
### 3.7 App Picker (shared component — also used in onboarding & timer)
@@ -207,7 +219,9 @@ Full-height sheet:
1. **Activation** — a Schedule rule becomes active at `From` on an enabled
day and deactivates at `To` (windows crossing midnight, e.g. 22:0006:00,
must be supported — Deep Sleep preset does this).
2. **While active** — the rule's app selection is shielded; blocked apps also
2. **While active** — the rule's app selection is shielded (and, when the
rule's Block Adult Content toggle is on, Screen Time's adult-website
filter is engaged for the same span); blocked apps also
surface in the "Blocked Apps" row on the Apps screen; the card turns green
with a "Xh left" pill.
3. **Unblocking** — with Hard Mode off, the user may unblock mid-window
@@ -260,6 +274,7 @@ enum SelectionMode: String, Codable { case block, allowOnly }
var kind: RuleKind
var isEnabled: Bool
var hardMode: Bool
var blockAdultContent: Bool // webContent.blockedByFilter = .auto(...)
var selectionMode: SelectionMode
var selectionData: Data // encoded FamilyActivitySelection
var days: [Int] // 1...7, Calendar weekday numbers