// The two legal documents, each one printed sheet. // // On paper (redesign phase 26, inventory ยง8): ONE cream sheet that grows with // the document โ€” the title and every section heading in the serif, the "Last // updated" stamp typed in pencil under the title, a pencil rule, and the words // typewriter. Nothing else: a legal page earns nothing from decoration, and // every element that is not the words is one more thing between a reader and // what they agreed to. **No state, no loading path, no error path** โ€” both // routes carry a permanent `READ_LESS` line saying they read nothing, so there // is nothing that can fail. // // The title is on the SHEET, not in the bar: `PaperScreen` is given none, so // the page never draws "Privacy" over "Privacy" (`ScreenTitleGuardTests`). // // Both are reached from the Settings sheet's About rows (phase 16), which is // the in-app caller the documents lacked since the sign-in footer went. import SwiftUI public struct LegalDocument: View { private let title: String /// The "Last updated" line โ€” a legal page that hides its date is hiding /// edits. private let updated: String private let intro: String private let sections: [LegalSection] private let identifier: String @Environment(\.theme) private var theme public init( title: String, updated: String, intro: String, sections: [LegalSection], identifier: String ) { self.title = title self.updated = updated self.intro = intro self.sections = sections self.identifier = identifier } public var body: some View { PaperScreen { Paper(dye: .cream, edge: .cut, seed: identifier, tilt: false, inset: 24) { VStack(alignment: .leading, spacing: 0) { Text(title) .paperTitle(LegalSheetMetrics.titleSize) .accessibilityAddTraits(.isHeader) Text(updated) .paperMeta(13) .padding(.top, 6) PencilRule(seed: "\(identifier)-rule", theme: theme) .stroke(theme.print(.pencil), lineWidth: 1) .frame(height: 3) .padding(.top, 16) Text(intro) .paperBody(LegalSheetMetrics.bodySize) .lineSpacing(LegalSheetMetrics.lineSpacing) .fixedSize(horizontal: false, vertical: true) .padding(.top, 18) ForEach(sections) { section in VStack(alignment: .leading, spacing: 0) { Text(section.heading) .paperTitle(LegalSheetMetrics.headingSize) .accessibilityAddTraits(.isHeader) ForEach(Array(section.body.enumerated()), id: \.offset) { _, paragraph in Text(paragraph) .paperBody(LegalSheetMetrics.bodySize) .lineSpacing(LegalSheetMetrics.lineSpacing) .fixedSize(horizontal: false, vertical: true) .padding(.top, 10) } } .frame(maxWidth: .infinity, alignment: .leading) .padding(.top, LegalSheetMetrics.sectionGap) } } .frame(maxWidth: .infinity, alignment: .leading) } .padding(.bottom, 24) } .accessibilityIdentifier(identifier) } } /// The printed sheet's type sizes, in one place so the two documents cannot /// drift apart. enum LegalSheetMetrics { static let titleSize: CGFloat = 30 static let headingSize: CGFloat = 20 static let bodySize: CGFloat = 15 static let lineSpacing: CGFloat = 4 static let sectionGap: CGFloat = 26 } /// `/legal/privacy`. public struct PrivacyScreen: View { public init() {} public var body: some View { LegalDocument( title: CottonStrings.privacyTitle, updated: CottonStrings.legalUpdated, intro: CottonStrings.privacyIntro, sections: CottonStrings.privacySections, identifier: "legal-privacy" ) } } /// `/legal/terms`, exactly as `PrivacyScreen` is. /// /// Short on purpose: a personal notebook shared with a handful of people does /// not need a contract nobody reads, and padding one out with boilerplate the /// app cannot honour would be the dishonest option. public struct TermsScreen: View { public init() {} public var body: some View { LegalDocument( title: CottonStrings.termsTitle, updated: CottonStrings.legalUpdated, intro: CottonStrings.termsIntro, sections: CottonStrings.termsSections, identifier: "legal-terms" ) } }