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:
Doug
2024-10-08 11:00:58 +01:00
committed by GitHub
parent 794d0eead1
commit 6e51969d27
42 changed files with 581 additions and 358 deletions
@@ -532,30 +532,35 @@ class TimelineInteractionHandler {
private func displayMediaActionIfPossible(timelineItem: RoomTimelineItemProtocol) async -> RoomTimelineControllerAction {
var source: MediaSourceProxy?
var body: String
var filename: String
var caption: String?
switch timelineItem {
case let item as ImageRoomTimelineItem:
source = item.content.source
body = item.content.body
filename = item.content.filename
caption = item.content.caption
case let item as VideoRoomTimelineItem:
source = item.content.source
body = item.content.body
filename = item.content.filename
caption = item.content.caption
case let item as FileRoomTimelineItem:
source = item.content.source
body = item.content.body
filename = item.content.filename
caption = item.content.caption
case let item as AudioRoomTimelineItem:
// For now we are just displaying audio messages with the File preview until we create a timeline player for them.
source = item.content.source
body = item.content.body
filename = item.content.filename
caption = item.content.caption
default:
return .none
}
guard let source else { return .none }
switch await mediaProvider.loadFileFromSource(source, body: body) {
switch await mediaProvider.loadFileFromSource(source, filename: filename) {
case .success(let file):
return .displayMediaFile(file: file, title: body)
return .displayMediaFile(file: file, title: caption ?? filename)
case .failure:
return .none
}