// A server's refusal of this phone, drawn ABOVE the app rather than instead// of it.//// `device_not_approved` and `device_bad_signature` are the server's answer// about this device's key — a roster or key mismatch, the case of a Mac// re-paired under a new key. They used to replace every screen with// `ServerRefusalScreen`, and the person's full copy — theirs, whole, on this// phone — sat unreadable behind it for as long as the server said no. With a// replica open the refusal is this banner: the title, what still works and// what is held, while everything under it reads as it always did, every write answers the// refusal's sentence (the core's `write_refusal`, `WriteGate` on this side),// and the mailboxes wait (`BootModel.holdsDrains`).//// **A revocation is not drawn here.** `device_revoked` is the owner's// deliberate removal — a lost phone is the case — and that phone keeps the// full-screen refusal with its erase: `READ_ONLY_REFUSALS` in// `CottonKit/BootGate.swift` is the rule, `BootModel.readOnly` is what this// is drawn off. The slip is `ServerRefusalScreen`'s pink torn paper at the// width of a banner.importCottonKitimportSwiftUIpublicstructReadOnlyBanner: View {privatelet refusal: ServerRefusal @Environment(\.theme) privatevar themepublicinit(refusal: ServerRefusal) {self.refusal = refusal }publicvar body: someView {Paper(dye: .pink, edge: .torn, seed: "read-only-\(refusal.code)", tilt: false, inset: 16) { VStack(alignment: .leading, spacing: 8) {Text(refusal.title) .paperTitle(17) .fixedSize(horizontal: false, vertical: true) .accessibilityIdentifier("read-only-title")Text(CottonStrings.readOnlyBody) .paperRed(12.5) .fixedSize(horizontal: false, vertical: true) .accessibilityIdentifier("read-only-body")Text(CottonStrings.readOnlyHeld) .paperRed(12.5) .fixedSize(horizontal: false, vertical: true) .accessibilityIdentifier("read-only-held") } } .padding(.horizontal, ChromeKnobs.chromeSettingsMargin) .padding(.top, 6) .padding(.bottom, 8) .accessibilityIdentifier("read-only-banner") }}extensionView {/// The banner above this view when a refusal stands, and this view alone/// when none does. A top inset rather than an overlay, so the content/// under it moves down and nothing is covered — a banner is a line the/// person reads past, never a wall.publicfunc readOnlyBanner(_ refusal: ServerRefusal?) -> someView { safeAreaInset(edge: .top, spacing: 0) {iflet refusal {ReadOnlyStanding(refusal: refusal) } } }}/// The read-only card: Vault's look inside Cotton Vault, paper elsewhere.structReadOnlyStanding: View {let refusal: ServerRefusal @Environment(\.vaultLook) privatevar vaultLookvar body: someView { #if os(iOS)iflet look = vaultLook { VaultReadOnlyCard(refusal: refusal, look: look) } else { ReadOnlyBanner(refusal: refusal) } #elseReadOnlyBanner(refusal: refusal) #endif }}extensionEnvironmentValues {/// The sentence every write is refused with while this device reads/// only (`WriteGate`), or nil while it writes. @Entry var writeRefusal: String? = nil}