mac: show build metadata in About

This commit is contained in:
Peter Steinberger
2025-12-07 00:30:47 +01:00
parent b2e3013898
commit 0a6b934ac1

View File

@@ -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)
}
}
}