aboutsummaryrefslogtreecommitdiff
path: root/Hotline
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-05-03 14:46:42 -0700
committerDustin Mierau <dustin@mierau.me>2024-05-03 14:46:42 -0700
commitfc798a575aed94718dcc4c5555b6e01cf8da93e9 (patch)
treef2e8c0a54302c5a915e3792abd1c6aea8e422e1d /Hotline
parent0471c4c4594f0406e85687ef84a29d99616c16cf (diff)
Nicer about box.
Diffstat (limited to 'Hotline')
-rw-r--r--Hotline/Application-macOS.swift20
-rw-r--r--Hotline/Assets.xcassets/About Hotline.imageset/Contents.json23
-rw-r--r--Hotline/Assets.xcassets/About Hotline.imageset/Group 3.pngbin0 -> 14188 bytes
-rw-r--r--Hotline/Assets.xcassets/About Hotline.imageset/Group 3@2x.pngbin0 -> 38758 bytes
-rw-r--r--Hotline/Assets.xcassets/About Hotline.imageset/Group 3@3x.pngbin0 -> 71532 bytes
-rw-r--r--Hotline/Assets.xcassets/Hotline Red.colorset/Contents.json (renamed from Hotline/Assets.xcassets/Unread Message Dot.colorset/Contents.json)4
-rw-r--r--Hotline/macOS/AboutView.swift42
7 files changed, 87 insertions, 2 deletions
diff --git a/Hotline/Application-macOS.swift b/Hotline/Application-macOS.swift
index ec42a89..eb5be32 100644
--- a/Hotline/Application-macOS.swift
+++ b/Hotline/Application-macOS.swift
@@ -60,6 +60,25 @@ struct Application: App {
}
}
+ Window("About", id: "about") {
+ AboutView()
+ .ignoresSafeArea()
+ .background(Color.hotlineRed)
+ }
+ .windowResizability(.contentSize)
+ .windowStyle(.hiddenTitleBar)
+ .defaultSize(width: 300, height: 400)
+ .defaultPosition(.center)
+ .commands {
+ CommandGroup(replacing: CommandGroupPlacement.appInfo) {
+ Button(action: {
+ openWindow(id: "about")
+ }) {
+ Text("About Hotline")
+ }
+ }
+ }
+
// MARK: Server Window
WindowGroup(id: "server", for: Server.self) { server in
ServerView(server: server)
@@ -165,6 +184,7 @@ struct Application: App {
SettingsView()
}
+
// MARK: News Editor Window
// WindowGroup(id: "news-editor", for: NewsArticle.self) { $article in
// NewsEditorView(article: $article)
diff --git a/Hotline/Assets.xcassets/About Hotline.imageset/Contents.json b/Hotline/Assets.xcassets/About Hotline.imageset/Contents.json
new file mode 100644
index 0000000..84fb02e
--- /dev/null
+++ b/Hotline/Assets.xcassets/About Hotline.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "filename" : "Group 3.png",
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "Group 3@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "Group 3@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/Hotline/Assets.xcassets/About Hotline.imageset/Group 3.png b/Hotline/Assets.xcassets/About Hotline.imageset/Group 3.png
new file mode 100644
index 0000000..84f7790
--- /dev/null
+++ b/Hotline/Assets.xcassets/About Hotline.imageset/Group 3.png
Binary files differ
diff --git a/Hotline/Assets.xcassets/About Hotline.imageset/Group 3@2x.png b/Hotline/Assets.xcassets/About Hotline.imageset/Group 3@2x.png
new file mode 100644
index 0000000..e0961c2
--- /dev/null
+++ b/Hotline/Assets.xcassets/About Hotline.imageset/Group 3@2x.png
Binary files differ
diff --git a/Hotline/Assets.xcassets/About Hotline.imageset/Group 3@3x.png b/Hotline/Assets.xcassets/About Hotline.imageset/Group 3@3x.png
new file mode 100644
index 0000000..a3ef5d0
--- /dev/null
+++ b/Hotline/Assets.xcassets/About Hotline.imageset/Group 3@3x.png
Binary files differ
diff --git a/Hotline/Assets.xcassets/Unread Message Dot.colorset/Contents.json b/Hotline/Assets.xcassets/Hotline Red.colorset/Contents.json
index 05fcb96..1f6e488 100644
--- a/Hotline/Assets.xcassets/Unread Message Dot.colorset/Contents.json
+++ b/Hotline/Assets.xcassets/Hotline Red.colorset/Contents.json
@@ -7,7 +7,7 @@
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
- "red" : "0xF1"
+ "red" : "0xE1"
}
},
"idiom" : "universal"
@@ -25,7 +25,7 @@
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
- "red" : "0xF1"
+ "red" : "0xE1"
}
},
"idiom" : "universal"
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()
+}