aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-01-02 19:14:45 -0800
committerDustin Mierau <dustin@mierau.me>2024-01-02 19:15:43 -0800
commit7d670c5b63db44e32d33b7db3495b4d792866f86 (patch)
tree0daff89e0cdac7e6becbc01f00d268e66f2849b6 /Hotline/macOS
parent78a93e5f5ed74010a130367d27221b2a11fb6542 (diff)
Fix banners not loading. First crack at adding a classic icon set with icons painsakenly pulled from the original Hotline client. May try to "remaster" these somehow.
Diffstat (limited to 'Hotline/macOS')
-rw-r--r--Hotline/macOS/ChatView.swift19
-rw-r--r--Hotline/macOS/FileImageView.swift9
-rw-r--r--Hotline/macOS/ServerView.swift7
-rw-r--r--Hotline/macOS/SettingsView.swift4
-rw-r--r--Hotline/macOS/TrackerView.swift4
5 files changed, 24 insertions, 19 deletions
diff --git a/Hotline/macOS/ChatView.swift b/Hotline/macOS/ChatView.swift
index 4399de6..d94634a 100644
--- a/Hotline/macOS/ChatView.swift
+++ b/Hotline/macOS/ChatView.swift
@@ -38,10 +38,21 @@ struct ChatView: View {
if msg.type == .agreement {
VStack(alignment: .center, spacing: 16) {
- FileImageView()
- .environment(self.model)
- .frame(maxWidth: 468.0)
- .clipShape(RoundedRectangle(cornerRadius: 3))
+ if let bannerImage = self.model.bannerImage {
+ #if os(macOS)
+ Image(nsImage: bannerImage)
+ .resizable()
+ .scaledToFit()
+ .frame(maxWidth: 468.0)
+ .clipShape(RoundedRectangle(cornerRadius: 3))
+ #elseif os(iOS)
+ Image(uiImage: bannerImage)
+ .resizable()
+ .scaledToFit()
+ .frame(maxWidth: 468.0)
+ .clipShape(RoundedRectangle(cornerRadius: 3))
+ #endif
+ }
VStack(spacing: 0) {
ScrollView(.vertical) {
diff --git a/Hotline/macOS/FileImageView.swift b/Hotline/macOS/FileImageView.swift
index 867fb45..99fd7b5 100644
--- a/Hotline/macOS/FileImageView.swift
+++ b/Hotline/macOS/FileImageView.swift
@@ -21,14 +21,7 @@ struct FileImageView: View {
}
self.status = .loading
- self.model.downloadBanner { success in
- if success {
- self.status = .loaded
- }
- else {
- self.status = .notloaded
- }
- }
+ self.model.downloadBanner()
}
var body: some View {
diff --git a/Hotline/macOS/ServerView.swift b/Hotline/macOS/ServerView.swift
index 7d89481..ae8a104 100644
--- a/Hotline/macOS/ServerView.swift
+++ b/Hotline/macOS/ServerView.swift
@@ -262,11 +262,11 @@ struct ServerView: View {
Section("Users") {
ForEach(model.users) { user in
HStack {
- if let iconString = Hotline.defaultIconSet[Int(user.iconID)] {
- Text(iconString)
- .font(.headline)
+ if let iconImage = Hotline.getClassicIcon(Int(user.iconID)) {
+ Image(nsImage: iconImage)
.frame(width: 18)
.opacity(controlActiveState == .inactive ? 0.5 : 1.0)
+ .opacity(user.isIdle ? 0.5 : 1.0)
}
else {
Text("")
@@ -373,6 +373,7 @@ struct ServerView: View {
print("GETTING USER LIST????!")
self.sendPreferences()
self.model.getUserList()
+ self.model.downloadBanner()
}
}
}
diff --git a/Hotline/macOS/SettingsView.swift b/Hotline/macOS/SettingsView.swift
index 2b11ecc..879fbeb 100644
--- a/Hotline/macOS/SettingsView.swift
+++ b/Hotline/macOS/SettingsView.swift
@@ -44,8 +44,8 @@ struct IconSettingsView: View {
GridItem(.flexible(minimum: 20, maximum: 50)),
GridItem(.flexible(minimum: 20, maximum: 50))
]) {
- ForEach(Hotline.defaultIconSet.sorted(by: >), id: \.key) { iconID, iconText in
- Text(iconText)
+ ForEach(Hotline.classicIcons, id: \.self) { iconID in
+ Image("Classic/\(iconID)")
.font(.largeTitle)
.frame(maxWidth: .infinity)
.padding(4)
diff --git a/Hotline/macOS/TrackerView.swift b/Hotline/macOS/TrackerView.swift
index 3870a38..0f6b6b2 100644
--- a/Hotline/macOS/TrackerView.swift
+++ b/Hotline/macOS/TrackerView.swift
@@ -62,7 +62,7 @@ class TrackerItem: Identifiable, Hashable {
self.loading = true
// self.servers = []
- let fetchedServers: [HotlineServer] = await client.fetchServers(address: bookmark.address, port: Tracker.defaultPort)
+ let fetchedServers: [HotlineServer] = await client.fetchServers(address: bookmark.address, port: HotlinePorts.DefaultTrackerPort)
client.disconnect()
@@ -311,7 +311,7 @@ struct TrackerView: View {
else if
let bookmark = clickedItem.bookmark,
bookmark.type == .server {
- let server = Server(name: bookmark.name, description: nil, address: bookmark.address, port: Server.defaultPort)
+ let server = Server(name: bookmark.name, description: nil, address: bookmark.address, port: HotlinePorts.DefaultServerPort)
openWindow(value: server)
}
}