mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-05 23:47:44 +02:00
Aggregate chunks in voice broacast
This commit is contained in:
@@ -18,11 +18,24 @@ import Foundation
|
||||
|
||||
struct VoiceBroadcastBuilder {
|
||||
|
||||
func build(voiceBroadcastStartEventContent: VoiceBroadcastInfo, events: [MXEvent], currentUserIdentifier: String, hasBeenEdited: Bool = false) -> VoiceBroadcast {
|
||||
func build(mediaManager: MXMediaManager,
|
||||
voiceBroadcastStartEventId: String,
|
||||
voiceBroadcastInvoiceBroadcastStartEventContent: VoiceBroadcastInfo,
|
||||
events: [MXEvent],
|
||||
currentUserIdentifier: String,
|
||||
hasBeenEdited: Bool = false) -> VoiceBroadcast {
|
||||
|
||||
let voiceBroadcast = VoiceBroadcast()
|
||||
var voiceBroadcast = VoiceBroadcast()
|
||||
|
||||
// TODO: VB set voice broadcast object
|
||||
voiceBroadcast.chunks = Set(events.compactMap { event in
|
||||
guard let attachment = MXKAttachment(event: event, andMediaManager: mediaManager),
|
||||
let chunkInfo = event.content[VoiceBroadcastSettings.voiceBroadcastContentKeyChunkType] as? [String: UInt],
|
||||
let sequence = chunkInfo[VoiceBroadcastSettings.voiceBroadcastContentKeyChunkSequence] else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return VoiceBroadcastChunk(voiceBroadcastInfoEventId: voiceBroadcastStartEventId, sequence: sequence, attachment: attachment)
|
||||
})
|
||||
|
||||
return voiceBroadcast
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user