Wire iOS media downloads through session bridge
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user