import SwiftUI import BucksleyKit import BucksleyUI struct PhoneSettingsScreen: View { @Environment(PhoneModel.self) private var model @Environment(\.palette) private var palette @Environment(\.colorScheme) private var colorScheme @Environment(\.openURL) private var openURL @AppStorage(BucksleyTheme.preferenceKey) private var themeRaw = BucksleyTheme.defaultPreference.rawValue @AppStorage(BucksleyAppearance.preferenceKey) private var appearanceRaw = BucksleyAppearance.system.rawValue @State private var showShare = false var body: some View { let theme = BucksleyTheme(preference: themeRaw) Form { Section { Text("Settings").font(palette.title(32)).tracking(palette.titleTracking) .listRowBackground(Color.clear).listRowInsets(EdgeInsets(top: 4, leading: 0, bottom: 4, trailing: 0)) } Section("Theme") { ForEach(BucksleyTheme.allCases) { option in Button { themeRaw = option.rawValue } label: { HStack(spacing: 12) { ThemeSwatch(theme: option, dark: colorScheme == .dark).frame(width: 64, height: 40) VStack(alignment: .leading, spacing: 2) { Text(option.title).font(.system(size: 16, weight: .semibold)).foregroundStyle(palette.text) Text(option.summary).font(.system(size: 12)).foregroundStyle(palette.muted) } Spacer() if option == theme { Image(systemName: "checkmark").font(.system(size: 14, weight: .bold)).foregroundStyle(palette.accent) } } } .accessibilityIdentifier("settings.theme.\(option.rawValue)") } Picker("Appearance", selection: $appearanceRaw) { ForEach(BucksleyAppearance.allCases) { Text($0.title).tag($0.rawValue) } } Text("The home screen icon changes with the theme.").font(.system(size: 12)).foregroundStyle(palette.muted) } .listRowBackground(palette.card) Section("Your Mac") { LabeledContent("iCloud", value: model.status).font(.system(size: 14)) Button("Sync now") { Task { await model.refresh() } }.disabled(model.refreshing) Text("Bank connections live on your Mac. This \(UIDevice.current.userInterfaceIdiom == .pad ? "iPad" : "iPhone") reads what the Mac shares through your private iCloud and sends your reviews, categories and notes back.") .font(.system(size: 12)).foregroundStyle(palette.muted) } .listRowBackground(palette.card) Section("Apple Wallet") { Button { Task { await model.importWallet() } } label: { Label("Add Apple Card, Cash and Savings", systemImage: "wallet.pass") } Text("Reads your Apple Wallet accounts with your permission and shares them with Bucksley on your Mac.") .font(.system(size: 12)).foregroundStyle(palette.muted) } .listRowBackground(palette.card) Section("Support") { Button { SupportPrompt.record(.support); openURL(SupportPrompt.Links.support) } label: { row("Technical Support", "Free help from a real person", "person.crop.circle.badge.questionmark") } .accessibilityIdentifier("settings.technicalSupport") } .listRowBackground(palette.card) Section { Button { SupportPrompt.record(.feedback); openURL(SupportPrompt.Links.feedback) } label: { row("Share Your Experience", "Rate Bucksley or send feedback", "star.fill") } .accessibilityIdentifier("settings.review") Button { SupportPrompt.record(.share); showShare = true } label: { row("Share Bucksley", "Tell a friend about it", "square.and.arrow.up") } .accessibilityIdentifier("settings.share") Button { SupportPrompt.record(.apps); openURL(SupportPrompt.Links.protomotaApps) } label: { row("More Free Apps from Project ATOM", "projectatom.ai/apps", "square.grid.2x2.fill") } .accessibilityIdentifier("settings.apps") } header: { Text("Support Bucksley") } footer: { Text("Bucksley is free. Every feature, including support, stays free.") } .listRowBackground(palette.card) Section("About") { Text("Bucksley").font(.system(size: 14, weight: .semibold)) Text("Free and open source, public domain (Unlicense). Read-only: Bucksley never moves money.").font(.system(size: 12)).foregroundStyle(palette.muted) Text("Version \(Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "0") (\(Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "0"))") .font(.system(size: 12)).foregroundStyle(palette.muted) } .listRowBackground(palette.card) Section { VStack(spacing: 10) { ProtomotaProductPill() Text("A Project ATOM project").font(.system(size: 12)).foregroundStyle(palette.muted) } .frame(maxWidth: .infinity) .listRowBackground(Color.clear) } } .scrollContentBackground(.hidden) .background(palette.canvas.ignoresSafeArea()) .tint(palette.accent) .toolbar(.hidden, for: .navigationBar) .sheet(isPresented: $showShare) { ShareSheet(items: [SupportPrompt.Links.website]) } } func row(_ title: String, _ detail: String, _ symbol: String) -> some View { HStack(spacing: 12) { Image(systemName: symbol).font(.system(size: 15, weight: .semibold)).foregroundStyle(palette.accent).frame(width: 26) VStack(alignment: .leading, spacing: 1) { Text(title).font(.system(size: 15, weight: .medium)).foregroundStyle(palette.text) Text(detail).font(.system(size: 12)).foregroundStyle(palette.muted) } } } } struct ShareSheet: UIViewControllerRepresentable { let items: [Any] func makeUIViewController(context: Context) -> UIActivityViewController { UIActivityViewController(activityItems: items, applicationActivities: nil) } func updateUIViewController(_ controller: UIActivityViewController, context: Context) {} }