// WHO DRAWS A PASSING LINE (22 Nov 2026). Every toast in // a redesigned app is drawn in that app's own look, once. The shell says its // lines (an approval, a sync failure, a sealed key, Free up space, a report // sent) into the one `ToastCenter`; the window's receipt overlay asks this // seam whether the app draws its own toast and, when it does, hands it the // words, its Undo and its way to go. Words, Days, Story and Comms each draw // them as their own lines are drawn; Vault and Health keep theirs in their // look (`VaultToastView`); only the apps still on paper draw the paper strip. // // Seen on the owner's iPhone in Comms (22 Nov 2026): "Approved. … is signing // in." stood twice at once, as the paper strip and as Comms' rounded pill. The // window's overlay hung outside the app look (so it drew paper) while the // stack's, inside it, drew the look; both drew every shell line. import CottonKit import SwiftUI /// An app that draws the shell's passing lines in a toast of its own. enum AppToast: String, CaseIterable, Sendable { case words, days, story, comms /// The app for a flavour (the registry's), or nil for an app that has no toast of its own. static func of(flavour: String?) -> AppToast? { guard let flavour else { return nil } if flavour.hasPrefix("notes") { return .words } if flavour.hasPrefix("messages") { return .comms } switch flavour { case "days": return .days case "story": return .story default: return nil } } /// This build's. static var standing: AppToast? { of(flavour: FlavourManifest.current?.flavour) } /// The toast's name to a test: `toast-words`, `toast-days`, `toast-story`, `toast-comms`. var identifier: String { "toast-\(rawValue)" } } extension EnvironmentValues { /// The app that draws the shell's passing lines itself (`RootView` sets it beside `\.vaultLook`). @Entry var appToast: AppToast? = nil } #if os(iOS) /// The shell's line in the app's own toast. struct AppToastView: View { let app: AppToast let toast: CottonToast let onUndo: () -> Void let onDismiss: () -> Void var body: some View { face .accessibilityElement(children: .contain) .accessibilityIdentifier(app.identifier) .accessibilityAddTraits(.updatesFrequently) .accessibilityAction(named: "Dismiss", onDismiss) } @ViewBuilder private var face: some View { switch app { case .words: NotesToast(toast: toast, onUndo: onUndo, onDismiss: onDismiss) case .days: DaysToast(toast: toast, onUndo: onUndo, onDismiss: onDismiss) case .story: InkToast(toast: toast, onUndo: onUndo, onDismiss: onDismiss) case .comms: ChatToast(toast: toast, onUndo: onUndo, onDismiss: onDismiss) } } /// How many lines a tone may take: a failure explains, a receipt stays terse (as the strip). static func lineLimit(_ tone: CottonToast.Tone) -> Int { tone == .error || tone == .warning ? 6 : 3 } } #endif