Skip to content

Commit

Permalink
Add user icons to iOS app. Bump build number.
Browse files Browse the repository at this point in the history
  • Loading branch information
mierau committed Jan 3, 2024
1 parent f6d9799 commit 4d31acc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Hotline.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
DA0D698D2B1E7CF700C71DF5 /* UsersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0D698C2B1E7CF700C71DF5 /* UsersView.swift */; platformFilter = ios; };
DA0D698F2B1E841600C71DF5 /* MessageBoardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0D698E2B1E841600C71DF5 /* MessageBoardView.swift */; platformFilter = ios; };
DA0D69912B1E894800C71DF5 /* FilesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0D69902B1E894800C71DF5 /* FilesView.swift */; platformFilter = ios; };
DA2863D82B37AD1C00A7D050 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2863D72B37AD1C00A7D050 /* SettingsView.swift */; };
DA2863D82B37AD1C00A7D050 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2863D72B37AD1C00A7D050 /* SettingsView.swift */; platformFilters = (macos, ); };
DA2863DA2B37BF6E00A7D050 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2863D92B37BF6E00A7D050 /* Preferences.swift */; };
DA2863DD2B3E8B7000A7D050 /* FilePreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2863DC2B3E8B7000A7D050 /* FilePreview.swift */; };
DA32CD492B2931640053B98B /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA32CD482B2931640053B98B /* User.swift */; };
Expand Down Expand Up @@ -456,7 +456,7 @@
CODE_SIGN_ENTITLEMENTS = Hotline/Hotline.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_ASSET_PATHS = "\"Hotline/Preview Content\"";
DEVELOPMENT_TEAM = 5AEEV7QB2U;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
Expand Down Expand Up @@ -495,7 +495,7 @@
CODE_SIGN_ENTITLEMENTS = Hotline/Hotline.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_ASSET_PATHS = "\"Hotline/Preview Content\"";
DEVELOPMENT_TEAM = 5AEEV7QB2U;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
Expand Down
13 changes: 7 additions & 6 deletions Hotline/Models/Hotline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ import SwiftUI

#if os(macOS)
static func getClassicIcon(_ index: Int) -> NSImage? {
if let icon = NSImage(named: "Classic/\(index)") {
return icon
}
return nil
return NSImage(named: "Classic/\(index)")
}
#elseif os(iOS)
static func getClassicIcon(_ index: Int) -> UIImage? {
return UIImage(named: "Classic/\(index)")
}
#endif

// The icon ordering here was painsakenly pulled manually
// from the original Hotline client to display the classic icons
// in the same order as the original client.
static let classicIcons: [Int] = [
static let classicIconSet: [Int] = [
141, 149, 150, 151, 172, 184, 204,
2013, 2036, 2037, 2055, 2400, 2505, 2534,
2578, 2592, 4004, 4015, 4022, 4104, 4131,
Expand Down Expand Up @@ -98,7 +100,6 @@ import SwiftUI
6017, 6018, 6023, 6025, 6026, 6027, 6028,
6029, 6030, 6031, 6032, 6033, 6034, 6035
]
#endif

static let defaultIconSet: [Int: String] = [
414: "🙂",
Expand Down
23 changes: 17 additions & 6 deletions Hotline/iOS/UsersView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@ struct UsersView: View {
var body: some View {
NavigationStack {
List(model.users) { u in
Text("🤖 \(u.name)")
.fontWeight(.medium)
.lineLimit(1)
.truncationMode(.tail)
.foregroundStyle(u.status.contains(.admin) ? Color(hex: 0xE10000) : Color.accentColor)
.opacity(u.status.contains(.idle) ? 0.5 : 1.0)
HStack(alignment: .center, spacing: 4) {
HStack(alignment: .center, spacing: 0) {
if let iconImage = Hotline.getClassicIcon(Int(u.iconID)) {
Image(uiImage: iconImage)
.interpolation(.none)
.frame(width: 32, height: 16, alignment: .center)
.scaledToFit()
}
}
.frame(width: 32)
Text(u.name)
.fontWeight(.medium)
.lineLimit(1)
.truncationMode(.tail)
.foregroundStyle(u.isAdmin ? Color(hex: 0xE10000) : Color.accentColor)
}
.opacity(u.isIdle ? 0.5 : 1.0)
}
.scrollBounceBehavior(.basedOnSize)
.navigationBarTitleDisplayMode(.inline)
Expand Down
2 changes: 1 addition & 1 deletion Hotline/macOS/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct IconSettingsView: View {
GridItem(.fixed(4+64+4)),
GridItem(.fixed(4+64+4))
], spacing: 0) {
ForEach(Hotline.classicIcons, id: \.self) { iconID in
ForEach(Hotline.classicIconSet, id: \.self) { iconID in
HStack {
Image("Classic/\(iconID)")
.resizable()
Expand Down

0 comments on commit 4d31acc

Please sign in to comment.