a31bc807cb
SwiftUI app for the MeshMonitor REST API: setup screen with token storage in Keychain, welcome dashboard mirroring the Emacs welcome buffer, and channel/node/DM/unread lists with a shared chat view supporting both channel and direct messages.
27 lines
465 B
Swift
27 lines
465 B
Swift
import Foundation
|
|
|
|
struct Channel: Identifiable, Hashable, Decodable {
|
|
let id: Int
|
|
let name: String?
|
|
let role: Int?
|
|
|
|
var displayName: String {
|
|
if let name, !name.isEmpty { return name }
|
|
return "Channel \(id)"
|
|
}
|
|
|
|
var roleName: String {
|
|
switch role ?? 0 {
|
|
case 1: return "Primary"
|
|
case 2: return "Secondary"
|
|
default: return "Disabled"
|
|
}
|
|
}
|
|
|
|
var isUsable: Bool { (role ?? 0) > 0 }
|
|
}
|
|
|
|
struct ChannelListResponse: Decodable {
|
|
let data: [Channel]
|
|
}
|