refactor(ios): dedupe status, gateway, and service flows

This commit is contained in:
Peter Steinberger
2026-03-02 11:32:00 +00:00
parent 2ca5722221
commit cd011897d0
19 changed files with 334 additions and 626 deletions

View 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
}
}