mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 06:31:44 +00:00
refactor(ios): dedupe status, gateway, and service flows
This commit is contained in:
21
apps/ios/Sources/Status/GatewayStatusBuilder.swift
Normal file
21
apps/ios/Sources/Status/GatewayStatusBuilder.swift
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user