mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Support sending gallery messages behind a feature flag
Adds the ability to send a gallery message (multiple attachments in one message) via the media upload preview, wired through the timeline controller/proxy to the SDK's sendGallery. Gated by a `galleryEnabled` developer flag (default off), matching Element X Android — with the flag off, attachments are sent as individual messages as before. Extends the community PR #5601, rebased onto develop. Tracking: element-hq/element-meta#3201 Co-authored-by: svetoslav.mitov <svetoslav.mitov@sportinno.com>
This commit is contained in:
@@ -374,6 +374,30 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
return .success(())
|
||||
}
|
||||
|
||||
func sendGallery(itemInfos: [GalleryItemInfo],
|
||||
caption: String?,
|
||||
formattedCaption: String?,
|
||||
inReplyToEventID: String?) async -> Result<Void, TimelineProxyError> {
|
||||
MXLog.info("Sending gallery with \(itemInfos.count) items")
|
||||
|
||||
do {
|
||||
let formatted = formattedCaption.map { FormattedBody(format: .html, body: $0) }
|
||||
let params = GalleryUploadParameters(caption: caption,
|
||||
formattedCaption: formatted,
|
||||
mentions: nil,
|
||||
inReplyTo: inReplyToEventID)
|
||||
|
||||
let handle = try timeline.sendGallery(params: params, itemInfos: itemInfos)
|
||||
try await handle.join()
|
||||
MXLog.info("Finished sending gallery")
|
||||
} catch {
|
||||
MXLog.error("Failed sending gallery with error: \(error)")
|
||||
return .failure(.sdkError(error))
|
||||
}
|
||||
|
||||
return .success(())
|
||||
}
|
||||
|
||||
func sendVoiceMessage(url: URL,
|
||||
audioInfo: AudioInfo,
|
||||
waveform: [Float],
|
||||
|
||||
Reference in New Issue
Block a user