Account name handling fix

This commit is contained in:
Arkadiusz Fal 2023-04-22 17:14:22 +02:00
parent c48301c788
commit 9a594b4a8d

View File

@ -60,29 +60,13 @@ struct Account: Defaults.Serializable, Hashable, Identifiable {
instanceID.isNil instanceID.isNil
} }
var shortUsername: String {
let (username, _) = credentials
guard let username,
username.count > 10
else {
return username ?? ""
}
let index = username.index(username.startIndex, offsetBy: 11)
return String(username[..<index])
}
var description: String { var description: String {
guard !isPublic else { guard !isPublic else {
return name return name
} }
guard !name.isEmpty else { let (username, _) = credentials
return shortUsername return username ?? name
}
return name
} }
var urlHost: String { var urlHost: String {