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

@@ -105,6 +105,14 @@ public actor UniFfiSessionBridge: SessionBridge {
try handle.copyPayload(chatId: chatId, messageId: messageId)
}
public func downloadPhoto(fileId: Int32) async throws -> DownloadedFile {
try Self.mapDownloadedFile(handle.downloadPhoto(fileId: fileId))
}
public func downloadVoice(fileId: Int32) async throws -> DownloadedFile {
try Self.mapDownloadedFile(handle.downloadVoice(fileId: fileId))
}
private static func mapAuthState(_ state: IosAuthState) -> AuthState {
switch state {
case .waitTdlibParameters:
@@ -192,6 +200,10 @@ public actor UniFfiSessionBridge: SessionBridge {
)
}
private static func mapDownloadedFile(_ file: IosDownloadedFile) -> DownloadedFile {
DownloadedFile(fileId: file.fileId, path: file.path)
}
private static func mapEvent(_ event: IosEvent) -> SessionEvent {
switch event {
case let .authChanged(state):