mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-16 22:31:38 +00:00
* fix(ios): keep reconnect errors visible * fix(ios): clear stale errors on gateway switch * chore(ios): keep release notes in PR * fix(ios): reset status when switching gateways * fix(ios): retain errors through same-target reconnect * fix(ios): unpause explicit pairing retries * fix(ios): isolate retained reconnect errors * chore(i18n): resync rebased native inventory * fix(ios): separate reconnect display state
42 lines
1.1 KiB
Swift
42 lines
1.1 KiB
Swift
import Foundation
|
|
import OpenClawKit
|
|
|
|
enum GatewayDisplayState: Equatable {
|
|
case connected
|
|
case connecting
|
|
case error
|
|
case disconnected
|
|
}
|
|
|
|
enum GatewayStatusBuilder {
|
|
@MainActor
|
|
static func build(appModel: NodeAppModel) -> GatewayDisplayState {
|
|
self.build(
|
|
gatewayServerName: appModel.gatewayServerName,
|
|
lastGatewayProblem: appModel.lastGatewayProblem,
|
|
gatewayStatusText: appModel.gatewayStatusText)
|
|
}
|
|
|
|
static func build(
|
|
gatewayServerName: String?,
|
|
lastGatewayProblem: GatewayConnectionProblem?,
|
|
gatewayStatusText: String) -> GatewayDisplayState
|
|
{
|
|
if gatewayServerName != nil { return .connected }
|
|
if lastGatewayProblem != nil { return .error }
|
|
|
|
let text = gatewayStatusText.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
if text.localizedCaseInsensitiveContains("connecting") ||
|
|
text.localizedCaseInsensitiveContains("reconnecting")
|
|
{
|
|
return .connecting
|
|
}
|
|
|
|
if text.localizedCaseInsensitiveContains("error") {
|
|
return .error
|
|
}
|
|
|
|
return .disconnected
|
|
}
|
|
}
|