From e2eccde99075d2ca355a80bbbb7a3160d766b920 Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Sat, 23 Dec 2023 11:10:32 -0800 Subject: Quick pass at an emoji based icon set, matching icons to classic Hotline icons where possible. --- Hotline/Hotline/HotlineClient.swift | 2 +- Hotline/Models/Hotline.swift | 69 ++++++++++++++++++++++++++++++++++++- Hotline/macOS/ServerView.swift | 14 ++++++-- 3 files changed, 80 insertions(+), 5 deletions(-) diff --git a/Hotline/Hotline/HotlineClient.swift b/Hotline/Hotline/HotlineClient.swift index bbaec5b..6eb6f42 100644 --- a/Hotline/Hotline/HotlineClient.swift +++ b/Hotline/Hotline/HotlineClient.swift @@ -764,7 +764,7 @@ class HotlineClient { let userIconID = userIconIDField.getUInt16(), let userFlagsField = transaction.getField(type: .userFlags), let userFlags = userFlagsField.getUInt16() { - print("HotlineClient: User changed \(username)") + print("HotlineClient: User changed \(username) icon: \(userIconID)") let user = HotlineUser(id: userID, iconID: userIconID, status: userFlags, name: username) diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift index 0e9ca9e..229f085 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -4,6 +4,73 @@ import SwiftUI let trackerClient: HotlineTrackerClient let client: HotlineClient + static let defaultIconSet: [Int: String] = [ + 414: "๐Ÿ™‚", + 2000: "๐Ÿ“Ÿ", + 2001: "๐Ÿ’€", + 2002: "๐Ÿชฉ", + 2003: "๐Ÿ’ฅ", + 2004: "๐Ÿž", + 2014: "๐ŸŽ", + 2006: "๐Ÿ’ ", + 2007: "๐Ÿฆ ", + 2008: "๐Ÿช€", + 2009: "๐Ÿ›Ÿ", + 2010: "๐Ÿ‰", + 2011: "๐Ÿ", + 2012: "๐Ÿšฆ", + 145: "๐Ÿš”", + 2015: "๐Ÿ‘ป", + 2016: "๐Ÿ’ป", + 2017: "โ˜€๏ธ", + 2018: "โžก๏ธ", + 417: "๐Ÿงโ€โ™‚๏ธ", + 140: "๐ŸŽจ", + 141: "๐Ÿ‘ฝ", + 142: "๐Ÿš€", + 143: "๐Ÿ•ท๏ธ", + 138: "๐Ÿ˜บ", + 146: "๐ŸŒ…", + 149: "๐Ÿฎ", + 150: "๐Ÿฆ–", + 151: "๐Ÿงป", + 154: "๐Ÿ–", + 182: "โœ‹", + 207: "โš ๏ธ", + 2061: "โ˜•๏ธ", + 2063: "๐ŸŒฎ", + 2064: "๐Ÿ•", + 2065: "๐Ÿ”", + 2066: "๐ŸŒญ", + 2067: "๐Ÿญ", + 2013: "๐Ÿง", + 2037: "โš ๏ธ", + 2055: "โšก๏ธ", + 2400: "๐Ÿ‡จ๐Ÿ‡ฆ", + 2036: "โ˜ฃ๏ธ", + 4134: "๐Ÿฆˆ", + 4247: "๐Ÿ—", + 135: "โ˜ฏ๏ธ", + 137: "๐Ÿ", + 144: "๐Ÿš€", + 165: "๐ŸŽถ", + 166: "โค๏ธ", + 2549: "๐Ÿ‡ฎ๐Ÿ‡ฑ", + 2553: "๐Ÿ‡บ๐Ÿ‡ธ", + 2555: "๐Ÿ‡จ๐Ÿ‡ฆ", + 2552: "๐Ÿ‡ฎ๐Ÿ‡ณ", + 2556: "๐Ÿ‡ฆ๐Ÿ‡บ", + 2565: "๐Ÿ‡ฌ๐Ÿ‡ง", + 2567: "๐Ÿ‡ฏ๐Ÿ‡ต", + 2566: "๐Ÿ‡ซ๐Ÿ‡ท", + 2564: "๐Ÿ‡ฉ๐Ÿ‡ช", + 2563: "๐Ÿ‡ฎ๐Ÿ‡น", + 2550: "๐Ÿ‡ญ๐Ÿ‡บ", + 2551: "๐Ÿ‡ต๐Ÿ‡ฑ", + 2560: "๐Ÿ‡ช๐Ÿ‡ธ", + 2561: "๐Ÿ‡ธ๐Ÿ‡ช", + ] + var status: HotlineClientStatus = .disconnected var server: Server? { @@ -23,7 +90,7 @@ import SwiftUI } var serverTitle: String = "Server" var username: String = "bolt" - var iconID: UInt = 128 + var iconID: UInt = 414 var access: HotlineUserAccessOptions? var agreed: Bool = false diff --git a/Hotline/macOS/ServerView.swift b/Hotline/macOS/ServerView.swift index ce9b3dc..a385109 100644 --- a/Hotline/macOS/ServerView.swift +++ b/Hotline/macOS/ServerView.swift @@ -161,9 +161,17 @@ struct ServerView: View { Section("Users") { ForEach(model.users) { user in HStack { - Text("๐Ÿ™‚") - .font(.headline) - .opacity(controlActiveState == .inactive ? 0.5 : 1.0) + if let iconString = Hotline.defaultIconSet[Int(user.iconID)] { + Text(iconString) + .font(.headline) + .frame(width: 18) + .opacity(controlActiveState == .inactive ? 0.5 : 1.0) + } + else { + Text("") + .frame(width: 18) + } + if user.status.contains(.admin) { if user.status.contains(.idle) { Text(user.name) -- cgit