fix: route iOS chat via operator session
This commit is contained in:
1 parent
bcedeb4e1f
commit
c23ccee6ad
7 files changed
+107
-12
No files matched your search
@@ -8,7 +8,7 @@ struct ChatSheet: View {
|
||||
private let userAccent: Color?
|
||||
|
||||
init(gateway: GatewayNodeSession, sessionKey: String, userAccent: Color? = nil) {
|
||||
let transport = IOSGatewayChatTransport(gateway: gateway)
|
||||
let transport = IOSGatewayChatTransport(gateway: gateway, supportsChatSubscribe: false)
|
||||
self._viewModel = State(
|
||||
initialValue: ClawdbotChatViewModel(
|
||||
sessionKey: sessionKey,
|
||||
|
||||
@@ -5,9 +5,11 @@ import Foundation
|
||||
|
||||
struct IOSGatewayChatTransport: ClawdbotChatTransport, Sendable {
|
||||
private let gateway: GatewayNodeSession
|
||||
private let supportsChatSubscribe: Bool
|
||||
|
||||
init(gateway: GatewayNodeSession) {
|
||||
init(gateway: GatewayNodeSession, supportsChatSubscribe: Bool = true) {
|
||||
self.gateway = gateway
|
||||
self.supportsChatSubscribe = supportsChatSubscribe
|
||||
}
|
||||
|
||||
func abortRun(sessionKey: String, runId: String) async throws {
|
||||
@@ -33,6 +35,7 @@ struct IOSGatewayChatTransport: ClawdbotChatTransport, Sendable {
|
||||
}
|
||||
|
||||
func setActiveSessionKey(_ sessionKey: String) async throws {
|
||||
guard self.supportsChatSubscribe else { return }
|
||||
struct Subscribe: Codable { var sessionKey: String }
|
||||
let data = try JSONEncoder().encode(Subscribe(sessionKey: sessionKey))
|
||||
let json = String(data: data, encoding: .utf8)
|
||||
|
||||
Reference in new issue
Block a user