Let account labels call the source by its title, not its host

An account with no user-set label was named username@host everywhere it
appears — the switcher menu, the settings rows, the playlist selector —
which overflows a menu row the moment the host has a subdomain. The
default name and the switcher's disambiguation suffixes now use the
instance's title when one is set, falling back to the host as before.
This commit is contained in:
Arkadiusz Fal
2026-09-12 23:44:35 +02:00
parent ea66d8f303
commit 839de238d3
3 changed files with 26 additions and 11 deletions

View File

@@ -142,6 +142,13 @@ struct Instance: Identifiable, Codable, Hashable, Sendable {
name ?? url.host ?? url.absoluteString
}
/// The shortest thing that names this source to the user: its title when
/// one is set, else its host. What account labels append after the `@`.
var shortLabel: String? {
if let name, !name.isEmpty { return name }
return url.host
}
/// Returns the URL string with embedded credentials stripped for safe display in the UI.
var displayURL: String {
guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false),