| @@ -0,0 +1,83 @@ |
| 1 | #if os(iOS) |
| 2 | import SwiftUI |
| 3 | import UIKit |
| 4 | |
| 5 | /// The version, and where to read the manual and source, report a problem or ask for help. |
| 6 | struct AboutScreen: View { |
| 7 | /// The app icon in use, as `AppIcons` names it. |
| 8 | let appIcon: String |
| 9 | |
| 10 | static let supportEmail = "help@krz.sh" |
| 11 | |
| 12 | private static let repository = "https://gitbay.org/krz/orgstar" |
| 13 | |
| 14 | private var version: String { |
| 15 | let info = Bundle.main.infoDictionary |
| 16 | let short = info?["CFBundleShortVersionString"] as? String ?? "?" |
| 17 | let build = info?["CFBundleVersion"] as? String ?? "?" |
| 18 | return build == short ? short : "\(short) (\(build))" |
| 19 | } |
| 20 | |
| 21 | var body: some View { |
| 22 | Form { |
| 23 | Section { |
| 24 | VStack(spacing: 8) { |
| 25 | // Builds without the asset catalog have no preview. |
| 26 | if let icon = UIImage(named: "IconPreview-\(appIcon)") { |
| 27 | Image(uiImage: icon) |
| 28 | .resizable() |
| 29 | .frame(width: 80, height: 80) |
| 30 | .clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous)) |
| 31 | .accessibilityHidden(true) |
| 32 | } |
| 33 | Text("orgstar").font(.title2.bold()) |
| 34 | Text("Version \(version)").font(.subheadline).foregroundStyle(.secondary).textSelection(.enabled) |
| 35 | } |
| 36 | .frame(maxWidth: .infinity) |
| 37 | .listRowBackground(Color.clear) |
| 38 | } |
| 39 | Section { |
| 40 | link("Manual", "book", "https://krz.gitbay.site/orgstar/") |
| 41 | link("Release Notes", "sparkles", Self.repository + "/releases") |
| 42 | link("Website", "globe", "https://krz.sh/apps/orgstar") |
| 43 | } |
| 44 | Section { |
| 45 | link("Report an Issue", "ladybug", Self.repository + "/issues/new") |
| 46 | link("Email Support", "envelope", mail.absoluteString) |
| 47 | link("Rate on the App Store", "star", "https://apps.apple.com/app/id6821552018?action=write-review") |
| 48 | } footer: { |
| 49 | Text("Reporting an issue needs a gitbay account. Without one, email \(Self.supportEmail).") |
| 50 | } |
| 51 | Section { |
| 52 | link("Source Code", "chevron.left.forwardslash.chevron.right", Self.repository) |
| 53 | link("License", "doc.text", Self.repository + "/blob/main/LICENSE") |
| 54 | link("Third-Party Notices", "doc.on.doc", Self.repository + "/blob/main/THIRD_PARTY.org") |
| 55 | link("Privacy Policy", "hand.raised", "https://krz.sh/privacy/orgstar/") |
| 56 | } footer: { |
| 57 | Text("© 2026 Christian Cleberg. Free software under the 0BSD license.") |
| 58 | } |
| 59 | } |
| 60 | .navigationTitle("About") |
| 61 | .navigationBarTitleDisplayMode(.inline) |
| 62 | } |
| 63 | |
| 64 | /// A message to support with the version and device filled in. |
| 65 | private var mail: URL { |
| 66 | let device = UIDevice.current |
| 67 | var components = URLComponents() |
| 68 | components.scheme = "mailto" |
| 69 | components.path = Self.supportEmail |
| 70 | components.queryItems = [ |
| 71 | URLQueryItem(name: "subject", value: "orgstar \(version)"), |
| 72 | URLQueryItem(name: "body", value: "\n\n—\norgstar \(version), \(device.systemName) \(device.systemVersion), \(device.model)"), |
| 73 | ] |
| 74 | return components.url! |
| 75 | } |
| 76 | |
| 77 | private func link(_ title: LocalizedStringKey, _ systemImage: String, _ url: String) -> some View { |
| 78 | Link(destination: URL(string: url)!) { |
| 79 | Label(title, systemImage: systemImage) |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | #endif |