diff --git a/NucleicRemote/NucleicRemote/Models/HostConnection.swift b/NucleicRemote/NucleicRemote/Models/HostConnection.swift index f5ba00b..8587ad9 100644 --- a/NucleicRemote/NucleicRemote/Models/HostConnection.swift +++ b/NucleicRemote/NucleicRemote/Models/HostConnection.swift @@ -630,6 +630,21 @@ final class HostConnection { Task { await client.send(msg) } } + /// Pull the open session's *full* transcript via mesh full-transcript sync and merge it into the + /// transcript on screen. The cold `subscribe` only returns the host's 200-event tail, so without + /// this the phone shows nothing from before it connected. `afterSeq: 0` asks for the whole history + /// (overlap with the tail is deduped on arrival). Idempotent per open — guarded by + /// `didStartFullFetch` — and a no-op when the host predates `canSyncTranscripts` (the tail still + /// shows) or the connection isn't live yet (the reconnect handler retries once it is). + func fetchFullTranscript(_ sessionID: SessionID) { + guard sessionID == openSessionID, !didStartFullFetch, + capabilities.canSyncTranscripts, client != nil else { return } + didStartFullFetch = true + let requestID = UUID().uuidString + transcriptFetchRequestID = requestID + send(.fetchTranscript(TranscriptFetch(requestID: requestID, sessionID: sessionID, afterSeq: 0))) + } + /// The device's network path changed (Wi-Fi ⇄ cellular, joined/left a network). React now rather /// than waiting for a zombie LAN socket to time out or the reconnect backoff to elapse — this is /// what makes the transport switch feel immediate. Only reconnect-managed hosts (a pinned host)