fix(mac): show disconnected sessions + sleeping eyes

This commit is contained in:
Peter Steinberger
2025-12-22 21:13:33 +01:00
parent 9d47b15575
commit 469c8a1a4b
2 changed files with 59 additions and 19 deletions

View File

@@ -411,6 +411,16 @@ struct MenuContent: View {
self.sessionLoading = true
self.sessionErrorText = nil
if case .connected = self.controlChannel.state {
// ok
} else {
self.sessionStorePath = nil
self.sessionMenu = []
self.sessionErrorText = "No connection to gateway"
self.sessionLoading = false
return
}
do {
let snapshot = try await SessionLoader.loadSnapshot(limit: 32)
self.sessionStorePath = snapshot.storePath
@@ -426,7 +436,8 @@ struct MenuContent: View {
return (lhs.updatedAt ?? .distantPast) > (rhs.updatedAt ?? .distantPast)
}
} catch {
// Keep the previous snapshot (if any) so the menu doesn't go empty while the gateway is flaky.
self.sessionStorePath = nil
self.sessionMenu = []
self.sessionErrorText = self.compactSessionError(error)
}
@@ -437,12 +448,12 @@ struct MenuContent: View {
if let loadError = error as? SessionLoadError {
switch loadError {
case .gatewayUnavailable:
return "Sessions unavailable — gateway unreachable"
return "No connection to gateway"
case .decodeFailed:
return "Sessions unavailable — invalid payload"
return "Sessions unavailable"
}
}
return "Sessions unavailable"
return "No connection to gateway"
}
private func open(tab: SettingsTab) {