mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-13 11:00:50 +00:00
22 lines
617 B
Swift
22 lines
617 B
Swift
import Foundation
|
|
|
|
enum GatewayStatusBuilder {
|
|
@MainActor
|
|
static func build(appModel: NodeAppModel) -> StatusPill.GatewayState {
|
|
if appModel.gatewayServerName != nil { return .connected }
|
|
|
|
let text = appModel.gatewayStatusText.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
if text.localizedCaseInsensitiveContains("connecting") ||
|
|
text.localizedCaseInsensitiveContains("reconnecting")
|
|
{
|
|
return .connecting
|
|
}
|
|
|
|
if text.localizedCaseInsensitiveContains("error") {
|
|
return .error
|
|
}
|
|
|
|
return .disconnected
|
|
}
|
|
}
|