From 0a6b934ac1dae47c99b57ecb22fb0bfc536f68a1 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 7 Dec 2025 00:30:47 +0100 Subject: [PATCH] mac: show build metadata in About --- .../macos/Sources/Clawdis/AboutSettings.swift | 50 ++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/apps/macos/Sources/Clawdis/AboutSettings.swift b/apps/macos/Sources/Clawdis/AboutSettings.swift index ba96d908f..c36178711 100644 --- a/apps/macos/Sources/Clawdis/AboutSettings.swift +++ b/apps/macos/Sources/Clawdis/AboutSettings.swift @@ -29,7 +29,7 @@ struct AboutSettings: View { Text("Version \(self.versionString)") .foregroundStyle(.secondary) if let buildTimestamp { - Text("Built \(buildTimestamp)") + Text("Built \(buildTimestamp)\(self.buildSuffix)") .font(.footnote) .foregroundStyle(.secondary) } @@ -40,6 +40,18 @@ struct AboutSettings: View { .padding(.horizontal, 18) } + VStack(alignment: .leading, spacing: 6) { + AboutMetaRow(label: "Bundle ID", value: self.bundleID) + AboutMetaRow(label: "Git commit", value: self.gitCommit) + #if DEBUG + AboutMetaRow(label: "Build", value: "Debug") + #else + AboutMetaRow(label: "Build", value: "Release") + #endif + } + .frame(maxWidth: .infinity) + .padding(.horizontal, 4) + VStack(alignment: .center, spacing: 6) { AboutLinkRow( icon: "chevron.left.slash.chevron.right", @@ -84,6 +96,26 @@ struct AboutSettings: View { formatter.locale = .current return formatter.string(from: date) } + + private var gitCommit: String { + Bundle.main.object(forInfoDictionaryKey: "ClawdisGitCommit") as? String ?? "unknown" + } + + private var bundleID: String { + Bundle.main.bundleIdentifier ?? "unknown" + } + + private var buildSuffix: String { + let git = self.gitCommit + guard !git.isEmpty, git != "unknown" else { return "" } + + var suffix = " (\(git)" + #if DEBUG + suffix += " DEBUG" + #endif + suffix += ")" + return suffix + } } @MainActor @@ -109,3 +141,19 @@ private struct AboutLinkRow: View { .onHover { self.hovering = $0 } } } + +private struct AboutMetaRow: View { + let label: String + let value: String + + var body: some View { + HStack { + Text(self.label) + .foregroundStyle(.secondary) + Spacer() + Text(self.value) + .font(.caption.monospaced()) + .foregroundStyle(.primary) + } + } +}