Wire iOS media downloads through session bridge

This commit is contained in:
Mikhail Kilin
2026-05-21 00:29:47 +03:00
parent 4fd2a18ed9
commit 892582df67
8 changed files with 50 additions and 2 deletions

View File

@@ -18,6 +18,8 @@ public protocol SessionBridge: Sendable {
func react(chatId: Int64, messageId: Int64, reaction: String) async throws -> [Reaction]
func pinnedMessages(chatId: Int64) async throws -> [Message]
func copyPayload(chatId: Int64, messageId: Int64) async throws -> String
func downloadPhoto(fileId: Int32) async throws -> DownloadedFile
func downloadVoice(fileId: Int32) async throws -> DownloadedFile
}
public actor FakeSessionBridge: SessionBridge {
@@ -201,6 +203,14 @@ public actor FakeSessionBridge: SessionBridge {
}
return message.text
}
public func downloadPhoto(fileId: Int32) async throws -> DownloadedFile {
DownloadedFile(fileId: fileId, path: "/tmp/fake-photo-\(fileId).jpg")
}
public func downloadVoice(fileId: Int32) async throws -> DownloadedFile {
DownloadedFile(fileId: fileId, path: "/tmp/fake-voice-\(fileId).ogg")
}
}
public enum FakeBridgeError: LocalizedError {