mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Update the SDK and use media filename and caption internally. (#3375)
Doesn't render captions (other than in fallback places).
This commit is contained in:
@@ -34,8 +34,8 @@ actor MediaLoader: MediaLoaderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func loadMediaFileForSource(_ source: MediaSourceProxy, body: String?) async throws -> MediaFileHandleProxy {
|
||||
let result = try await client.getMediaFile(mediaSource: source.underlyingSource, body: body, mimeType: source.mimeType ?? "application/octet-stream", useCache: true, tempDir: nil)
|
||||
func loadMediaFileForSource(_ source: MediaSourceProxy, filename: String?) async throws -> MediaFileHandleProxy {
|
||||
let result = try await client.getMediaFile(mediaSource: source.underlyingSource, body: filename, mimeType: source.mimeType ?? "application/octet-stream", useCache: true, tempDir: nil)
|
||||
|
||||
return MediaFileHandleProxy(handle: result)
|
||||
}
|
||||
|
||||
@@ -13,5 +13,5 @@ protocol MediaLoaderProtocol {
|
||||
|
||||
func loadMediaThumbnailForSource(_ source: MediaSourceProxy, width: UInt, height: UInt) async throws -> Data
|
||||
|
||||
func loadMediaFileForSource(_ source: MediaSourceProxy, body: String?) async throws -> MediaFileHandleProxy
|
||||
func loadMediaFileForSource(_ source: MediaSourceProxy, filename: String?) async throws -> MediaFileHandleProxy
|
||||
}
|
||||
|
||||
@@ -117,9 +117,9 @@ struct MediaProvider: MediaProviderProtocol {
|
||||
|
||||
// MARK: Files
|
||||
|
||||
func loadFileFromSource(_ source: MediaSourceProxy, body: String?) async -> Result<MediaFileHandleProxy, MediaProviderError> {
|
||||
func loadFileFromSource(_ source: MediaSourceProxy, filename: String?) async -> Result<MediaFileHandleProxy, MediaProviderError> {
|
||||
do {
|
||||
let file = try await mediaLoader.loadMediaFileForSource(source, body: body)
|
||||
let file = try await mediaLoader.loadMediaFileForSource(source, filename: filename)
|
||||
return .success(file)
|
||||
} catch {
|
||||
MXLog.error("Failed retrieving file with error: \(error)")
|
||||
|
||||
@@ -25,7 +25,7 @@ protocol MediaProviderProtocol {
|
||||
|
||||
func loadThumbnailForSource(source: MediaSourceProxy, size: CGSize) async -> Result<Data, MediaProviderError>
|
||||
|
||||
func loadFileFromSource(_ source: MediaSourceProxy, body: String?) async -> Result<MediaFileHandleProxy, MediaProviderError>
|
||||
func loadFileFromSource(_ source: MediaSourceProxy, filename: String?) async -> Result<MediaFileHandleProxy, MediaProviderError>
|
||||
}
|
||||
|
||||
extension MediaProviderProtocol {
|
||||
@@ -38,6 +38,6 @@ extension MediaProviderProtocol {
|
||||
}
|
||||
|
||||
func loadFileFromSource(_ source: MediaSourceProxy) async -> Result<MediaFileHandleProxy, MediaProviderError> {
|
||||
await loadFileFromSource(source, body: nil)
|
||||
await loadFileFromSource(source, filename: nil)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user