Audio Timeline Item support (#612)

* audio timeline item support

* improved the code to reduce cognitive complexity

* no need anymore for this swiftlint disabling of a rule

* pr comments
This commit is contained in:
Mauro
2023-02-23 12:06:31 +01:00
committed by GitHub
parent e48676e4eb
commit 698b0aea44
17 changed files with 204 additions and 70 deletions
@@ -53,3 +53,9 @@ extension VideoMessageContent: CustomStringConvertible {
String(describing: Self.self)
}
}
extension AudioMessageContent: CustomStringConvertible {
public var description: String {
String(describing: Self.self)
}
}
@@ -149,3 +149,16 @@ extension MessageTimelineItem where Content == MatrixRustSDK.FileMessageContent
return .init(source: src)
}
}
extension MatrixRustSDK.AudioMessageContent: MessageContentProtocol { }
/// A timeline item that represents an `m.room.message` event with a `msgtype` of `m.audio`.
extension MessageTimelineItem where Content == MatrixRustSDK.AudioMessageContent {
var source: MediaSourceProxy {
.init(source: content.source)
}
var duration: UInt64 {
content.info?.duration ?? 0
}
}