aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS/AboutView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline/macOS/AboutView.swift')
-rw-r--r--Hotline/macOS/AboutView.swift42
1 files changed, 42 insertions, 0 deletions
diff --git a/Hotline/macOS/AboutView.swift b/Hotline/macOS/AboutView.swift
new file mode 100644
index 0000000..378385a
--- /dev/null
+++ b/Hotline/macOS/AboutView.swift
@@ -0,0 +1,42 @@
+import SwiftUI
+
+struct AboutView: View {
+ @Environment(\.openURL) private var openURL
+
+ var body: some View {
+ VStack(alignment: .center) {
+ Spacer()
+ Image("About Hotline")
+ .padding(.top, 32)
+ Text("Hotline")
+ .font(.title)
+ .fontWeight(.semibold)
+ .padding(.top, 16)
+ let appDetails = getAppVersionAndBuild()
+ Text("\(appDetails.version)b\(appDetails.build)")
+ .fontWeight(.semibold)
+ .opacity(0.6)
+ Button("Download Latest") {
+ if let url = URL(string: "https://github.com/mierau/hotline/releases/latest") {
+ openURL(url)
+ }
+ }
+ .controlSize(.large)
+ .padding(.top, 16)
+ Spacer()
+ }
+ .frame(width: 300, height: 400)
+ .ignoresSafeArea()
+ }
+
+ func getAppVersionAndBuild() -> (version: String, build: String) {
+ let infoDictionary = Bundle.main.infoDictionary
+ let version = infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
+ let build = infoDictionary?["CFBundleVersion"] as? String ?? "Unknown"
+ return (version, build)
+ }
+}
+
+#Preview {
+ AboutView()
+}