ios: show the server host under the drawer title instead of "as <name>" (#79)
The screen name added nothing (you know who you are); the host is what distinguishes servers. Suppressed when the title already is the host (no group name loaded yet) so it isn't shown twice.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2 files changed,
+11
−1
ios/LChat/Models.swift+6 −0ios/LChat/Views/InstanceSidebar.swift+5 −1
diff --git a/ios/LChat/Models.swift b/ios/LChat/Models.swift| index 72512b3..6cb3746 100644 |
| --- a/ios/LChat/Models.swift |
| +++ b/ios/LChat/Models.swift |
| @@ -22,6 +22,12 @@ struct SavedInstance: Codable, Identifiable, Equatable { |
| /// A human label for the switcher until the real group name loads. |
| var displayName: String { groupName.isEmpty ? (baseURL?.host ?? "lchat") : groupName } |
| + |
| + /// The server's host (dropping a leading www.), for the switcher subtitle. |
| + var hostLabel: String { |
| + let h = baseURL?.host ?? origin |
| + return h.hasPrefix("www.") ? String(h.dropFirst(4)) : h |
| + } |
| } |
| // ---- server JSON -------------------------------------------------------- |
diff --git a/ios/LChat/Views/InstanceSidebar.swift b/ios/LChat/Views/InstanceSidebar.swift| index 74d1786..37e104d 100644 |
| --- a/ios/LChat/Views/InstanceSidebar.swift |
| +++ b/ios/LChat/Views/InstanceSidebar.swift |
| @@ -52,7 +52,11 @@ struct ServerDrawer: View { |
| Avatar(name: inst.displayName, size: 36) |
| VStack(alignment: .leading, spacing: 2) { |
| Text(inst.displayName).font(.headline).lineLimit(1) |
| - Text("as \(inst.screenName)").font(.caption).foregroundStyle(.secondary).lineLimit(1) |
| + // The host, unless the title already IS the host (no group |
| + // name yet) — no point showing it twice. |
| + if inst.displayName != inst.hostLabel { |
| + Text(inst.hostLabel).font(.caption).foregroundStyle(.secondary).lineLimit(1) |
| + } |
| } |
| Spacer() |
| if inst.id == activeID { |