// YOUR CLAUDE ASKS, IN THE APP'S OWN SHEET (owner, 23 Nov 2026, from his iPhone in Story; shared/DECISIONS.md "Your // Claude asks"): in Words, Days, Story and Comms the card "Let your Claude read your data" is the app's own sheet from // the foot (its ground, corner, scrim and faces, as the shake's "What looks wrong?"), never the old paper. Every line is // drawn whole: the title, who asks, the promise, What it can read (Everything by default, Let me choose opening the // groups as ticks), For how long (the durations on a timed card), and where to change it later. No table is named. // The waits line, Not now and Allow stand fixed at the foot; the words above scroll on their own. Allow is off while // Let me choose has nothing ticked. A tap outside or a pull down puts the card aside until the app is next opened (no // answer is sent); Not now answers it. Every word is the core's (`unlock.card`'s `card.ask`, `fields`, `acts`). #if os(iOS) import SwiftUI import UIKit extension VaultLook { /// The apps that raise the card in their own sheet. @MainActor static var raisesAsks: Bool { NotesRoot.applies || InkStoryRoot.applies || DaysRoot.applies || ChatRoot.applies } } /// The root's raise: while a card waits in an app with a look of its own, it stands in that look's panel. struct UnlockAskRaise: View { let asks: UnlockAsks let look: VaultLook @Environment(\.colorScheme) private var scheme var body: some View { let panel = look.reportPanel(scheme) Color.clear .allowsHitTesting(false) .lookPanel(isPresented: Binding(get: { asks.raised && asks.ask != nil }, set: { if !$0 { asks.putAside() } }), style: panel.style, name: asks.title) { UnlockAskSheet(asks: asks, look: look, grabber: panel.grabber) } .onAppear { asks.sheet = true } } } /// The card's words, the choice, the lengths, and the foot. struct UnlockAskSheet: View { let asks: UnlockAsks let look: VaultLook var grabber = false @Environment(\.colorScheme) private var scheme /// The words' own height: the sheet is as tall as they are, and scrolls past a share of the screen. @State private var wordsHigh: CGFloat = 0 private var room: CGFloat { UIScreen.main.bounds.height * 0.62 } var body: some View { VStack(spacing: 0) { if grabber { Capsule().fill(Pen.faint).frame(width: 36, height: 5) .padding(.top, 6).padding(.bottom, 5) .frame(maxWidth: .infinity) .accessibilityHidden(true) } ScrollView { words.onGeometryChange(for: CGFloat.self) { $0.size.height } action: { wordsHigh = $0 } } .frame(maxHeight: wordsHigh > 0 ? min(wordsHigh, room) : nil) .scrollBounceBehavior(.basedOnSize) .accessibilityIdentifier("unlock-scroll") foot } .environment(\.vault, look) .accessibilityElement(children: .contain) .accessibilityIdentifier("unlock-sheet") .onAppear { UnlockAsksLayer.landOnTheCard() } } @ViewBuilder private var words: some View { VStack(alignment: .leading, spacing: look.gap("m")) { if let title = asks.title { Text(verbatim: title).vault(look, "title").whole() .accessibilityAddTraits(.isHeader) .accessibilityIdentifier("unlock-title") } if let who = asks.ask?.who { Text(verbatim: who).vault(look, "row_detail", "secondary").whole().accessibilityIdentifier("unlock-who") } if let reason = asks.reason { Text(verbatim: reason).vault(look, "body").whole().accessibilityIdentifier("unlock-reason") } if let ask = asks.ask { if let what = ask.what { heading(what, "unlock-what") } VStack(alignment: .leading, spacing: 0) { if let everything = ask.everything { UnlockPick(choice: everything, on: !asks.choice.choosing, round: true, id: "unlock-everything") { asks.choosing(false) } } if let choose = ask.choose { UnlockPick(choice: choose, on: asks.choice.choosing, round: true, id: "unlock-choose") { asks.choosing(true) } } if asks.choice.choosing { VStack(alignment: .leading, spacing: 0) { ForEach(ask.groups) { group in UnlockPick(choice: .init(label: group.label, line: group.line), on: !asks.choice.off.contains(group.id), round: false, id: "unlock-group-\(group.id)") { asks.tick(group.id) } } } // Under Let me choose, set in by half its mark: at 30 a group's line lost the width it needed and // Scripts' broke onto two lines on a 393-point phone while Photos' stood on one (24 Nov 2026). .padding(.leading, UnlockPick.inset) .accessibilityElement(children: .contain) .accessibilityIdentifier("unlock-groups") } } .disabled(asks.busy) if let howLong = ask.howLong { heading(howLong, "unlock-how-long") } if !asks.durations.isEmpty { SettingsFlow(spacing: look.gap("s")) { ForEach(asks.durations, id: \.minutes) { duration in UnlockLength(label: duration.label, on: duration.minutes == asks.chosen, id: "unlock-duration-\(duration.minutes)") { asks.choose(duration) } } } .disabled(asks.busy) } if let line = ask.howLongLine { Text(verbatim: line).vault(look, "body").whole().accessibilityIdentifier("unlock-how-long-line") } if let settings = ask.settings { Text(verbatim: settings).vault(look, "row_detail", "secondary").whole().accessibilityIdentifier("unlock-settings") } } } .padding(.horizontal, look.gap("gutter")) .padding(.top, grabber ? look.gap("s") : look.gap("xl")) .padding(.bottom, look.gap("m")) .frame(maxWidth: .infinity, alignment: .leading) } private func heading(_ words: String, _ id: String) -> some View { Text(verbatim: words).vault(look, "label", "secondary").whole() .padding(.top, look.gap("s")) .accessibilityAddTraits(.isHeader) .accessibilityIdentifier(id) } /// The waits line, where an Allow already given stands, then Not now and Allow: always in sight. private var foot: some View { VStack(alignment: .leading, spacing: look.gap("s")) { ForEach(asks.waits, id: \.self) { line in Text(verbatim: line).vault(look, "row_detail", "tertiary").whole().accessibilityIdentifier("unlock-waits") } if let status = asks.status { Text(verbatim: status).vault(look, "body").whole().accessibilityIdentifier("unlock-status") } // Allow all (f1d096c29d): who else waits, then its quiet act on its own row; not while choosing groups. if let all = asks.allowAll, !asks.choice.choosing { if let line = all.line { Text(verbatim: line).vault(look, "body").whole().accessibilityIdentifier("unlock-all-line") } HStack { Spacer(minLength: 0) VaultButton(label: all.label, fill: .plain) { Task { await asks.allowEvery() } } .disabled(asks.busy) .accessibilityIdentifier("unlock-allow-all") } } if !asks.acts.isEmpty { HStack(spacing: look.gap("m")) { Spacer(minLength: 0) if let decline = asks.acts.first(where: { $0.id == "decline" }) { VaultButton(label: decline.label, fill: .plain) { Task { await asks.act(decline) } } .disabled(asks.busy) .accessibilityIdentifier("unlock-not-now") } if let allow = asks.acts.first(where: { $0.id == "allow" }) { let can = asks.ask.map(asks.choice.allows) ?? true VaultButton(label: allow.label, tone: .accent) { Task { await asks.act(allow) } } .disabled(asks.busy || !can) .opacity(can ? 1 : 0.4) .accessibilityIdentifier("unlock-allow") } } } } .padding(.horizontal, look.gap("gutter")) .padding(.top, look.gap("s")) .padding(.bottom, look.gap("l")) .frame(maxWidth: .infinity, alignment: .leading) .accessibilityElement(children: .contain) .accessibilityIdentifier("unlock-foot") } } /// One answer: a round mark for one of two ways, a square one for a group; its label in the look's text, its line quieter. private struct UnlockPick: View { /// How far the groups stand in under Let me choose. static let inset: CGFloat = 14 let choice: UnlockAskWords.Choice let on: Bool let round: Bool let id: String let tap: () -> Void @Environment(\.vault) private var look @Environment(\.colorScheme) private var scheme var body: some View { Button(action: tap) { HStack(alignment: .center, spacing: 12) { mark VStack(alignment: .leading, spacing: 2) { Text(verbatim: choice.label).vault(look, "row_title").whole() if let line = choice.line { Text(verbatim: line).vault(look, "row_detail", "secondary").whole() } } .frame(maxWidth: .infinity, alignment: .leading) } .frame(minHeight: 44) .padding(.vertical, 4) .contentShape(Rectangle()) } .buttonStyle(.plain) .accessibilityElement(children: .combine) .accessibilityAddTraits(on ? [.isButton, .isSelected] : .isButton) .accessibilityIdentifier(id) } @ViewBuilder private var mark: some View { let accent = look.colour("accent", scheme) let faint = look.colour("text", scheme).opacity(0.35) if round { Circle().strokeBorder(on ? accent : faint, lineWidth: 1.5) .overlay(Circle().fill(on ? accent : .clear).padding(5)) .frame(width: 22, height: 22) .accessibilityHidden(true) } else { RoundedRectangle(cornerRadius: 5, style: .continuous) .strokeBorder(on ? accent : faint, lineWidth: 1.5) .background(RoundedRectangle(cornerRadius: 5, style: .continuous).fill(on ? accent : .clear)) .overlay { if on { Image(systemName: "checkmark").font(.system(size: 12, weight: .bold)).foregroundStyle(look.colour("on_accent", scheme)) } } .frame(width: 22, height: 22) .accessibilityHidden(true) } } } /// One length the person may choose, the chosen one filled. private struct UnlockLength: View { let label: String let on: Bool let id: String let tap: () -> Void @Environment(\.vault) private var look @Environment(\.colorScheme) private var scheme var body: some View { let accent = look.colour("accent", scheme) Button(action: tap) { Text(verbatim: label) .vault(look, "label") .foregroundStyle(on ? look.colour("on_accent", scheme) : look.colour("text", scheme)) .padding(.horizontal, 14) .padding(.vertical, 8) .frame(minHeight: 36) .background(Capsule().fill(on ? accent : .clear)) .overlay(Capsule().strokeBorder(on ? accent : look.colour("text", scheme).opacity(0.3), lineWidth: 1)) } .buttonStyle(.plain) .accessibilityAddTraits(on ? [.isButton, .isSelected] : .isButton) .accessibilityIdentifier(id) } } private extension View { /// Drawn whole: wraps, never cut short. func whole() -> some View { fixedSize(horizontal: false, vertical: true) } } #endif #if COTTON_DEV import Foundation /// DEVELOPER TOOL: `-unlock-card-seed account|timed` stands the core's own card for an invented request /// (`Fixtures/unlock-card-seed.json`, written by `rules/unlock_tests.rs` `write_unlock_card_seed`) as if one waited, so /// a UI check can see the sheet and what Allow would send; nothing is sent. @MainActor enum UnlockCardSeed { static var asked: String? { let arguments = ProcessInfo.processInfo.arguments guard let at = arguments.firstIndex(of: "-unlock-card-seed"), at + 1 < arguments.count else { return nil } return arguments[at + 1] } private(set) static var answeredOnce = false /// What the last Allow would have sent, as words a check reads (`unlock-seed-sent`). private(set) static var sent: String? static func answer() -> UnlockCardAnswer? { guard let asked, let url = Bundle.module.url(forResource: "unlock-card-seed", withExtension: "json", subdirectory: "Fixtures"), let data = try? Data(contentsOf: url), let all = try? JSONDecoder().decode([String: RecordValue].self, from: data), let picked = all[asked], let again = try? JSONEncoder().encode(picked) else { return nil } return try? JSONDecoder().decode(UnlockCardAnswer.self, from: again) } /// Allow all, on the seed: the requests it would have allowed. static func answeredAll(_ ids: [String]) { answeredOnce = true sent = "all: " + ids.joined(separator: ",") Log.write("unlock seed: Allow all would send \(sent ?? "")") } static func answered(_ request: UnlockAllowRequest?) { answeredOnce = true guard let request else { return } sent = request.everything == true ? "everything" : "groups: " + (request.groups ?? []).joined(separator: ",") Log.write("unlock seed: Allow would send \(sent ?? "")") } } #endif