mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-14 13:31:05 +00:00
31 lines
627 B
Swift
31 lines
627 B
Swift
import Foundation
|
|
import SwiftUI
|
|
|
|
public struct AppAccount: Codable, Identifiable, Hashable {
|
|
public let server: String
|
|
public var accountName: String?
|
|
public let oauthToken: OauthToken?
|
|
|
|
public var key: String {
|
|
if let oauthToken {
|
|
"\(server):\(oauthToken.createdAt)"
|
|
} else {
|
|
"\(server):anonymous"
|
|
}
|
|
}
|
|
|
|
public var id: String {
|
|
key
|
|
}
|
|
|
|
public init(server: String,
|
|
accountName: String?,
|
|
oauthToken: OauthToken? = nil)
|
|
{
|
|
self.server = server
|
|
self.accountName = accountName
|
|
self.oauthToken = oauthToken
|
|
}
|
|
}
|
|
|
|
extension AppAccount: Sendable {}
|