Files
openclaw/apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel+SessionKeys.swift
Colin Johnson f6e51ff99a feat(ios): refresh pro UI and gateway flows (#87367)
Summary:
- Replace the legacy iOS shell with Pro Command, Chat, Agents, and Settings tabs.
- Wire iOS chat/session/settings/diagnostics and realtime Talk flows through gateway-backed APIs.
- Add gateway/session and shared chat coverage for the new iOS flow.

Verification:
- git diff --check
- node scripts/run-vitest.mjs src/gateway/server.sessions.create.test.ts src/gateway/talk-realtime-relay.test.ts
- swift test --filter ChatViewModelTests (apps/shared/OpenClawKit)
- xcodebuild build for Nimrod's iPhone succeeded; install succeeded; launch was blocked because the phone was locked

Known follow-up:
- Preserve traceLevel in sessions.create parent runtime inheritance and keep the changelog credit in the follow-up patch.
2026-05-28 17:23:26 +03:00

40 lines
1.5 KiB
Swift

import Foundation
extension OpenClawChatViewModel {
func matchesCurrentSessionKey(incoming: String, current: String) -> Bool {
Self.matchesCurrentSessionKey(
incoming: incoming,
current: current,
mainSessionKey: self.resolvedMainSessionKey)
}
static func matchesCurrentSessionKey(incoming: String, current: String, mainSessionKey: String) -> Bool {
let incomingNormalized = incoming.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
let currentNormalized = current.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
if incomingNormalized == currentNormalized {
return true
}
let mainNormalized = mainSessionKey.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
if Self.matchesMainAlias(
incoming: incomingNormalized,
current: currentNormalized,
mainSessionKey: mainNormalized)
{
return true
}
return false
}
private static func matchesMainAlias(incoming: String, current: String, mainSessionKey: String) -> Bool {
if current == "main", incoming == mainSessionKey, mainSessionKey != "main" {
return true
}
if incoming == "main", current == mainSessionKey, mainSessionKey != "main" {
return true
}
return (current == "main" && incoming == "agent:main:main") ||
(incoming == "main" && current == "agent:main:main")
}
}