mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Allow previews in the timeline to include filtered galleries (#5943)
* remove the usage of the timeline kind override in favour of getting it properly from the timeline view model * allow the previews to include gallery items filtered by the allowed types when started outside the gallery sss asa * fix for actions not being forwarded to the timeline right * pr suggestions
This commit is contained in:
@@ -16,7 +16,7 @@ enum TimelineKind: Equatable {
|
||||
case pinned
|
||||
case thread(rootEventID: String)
|
||||
|
||||
enum MediaPresentation { case roomScreenLive, roomScreenDetached, pinnedEventsScreen, mediaFilesScreen }
|
||||
enum MediaPresentation { case roomScreenLive, roomScreenDetached, roomScreenThread, pinnedEventsScreen, mediaFilesScreen }
|
||||
case media(MediaPresentation)
|
||||
|
||||
var isThread: Bool {
|
||||
@@ -42,6 +42,34 @@ enum TimelineFocus {
|
||||
|
||||
enum TimelineAllowedMessageType {
|
||||
case audio, file, image, video, gallery
|
||||
|
||||
/// The gallery attachments this type allows, so that a gallery event's attachments can be
|
||||
/// filtered client side to match. A gallery can't contain another gallery, hence the `nil`.
|
||||
var allowedGalleryItemType: TimelineAllowedGalleryItemType? {
|
||||
switch self {
|
||||
case .audio: .audio
|
||||
case .file: .file
|
||||
case .image: .image
|
||||
case .video: .video
|
||||
case .gallery: nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The gallery attachments a timeline allows, mirroring the message types it is filtered to. The SDK can
|
||||
/// only filter whole events, so a gallery's attachments are filtered by these client side. Unlike a
|
||||
/// message type there's no gallery case, as a gallery can't contain another one.
|
||||
enum TimelineAllowedGalleryItemType {
|
||||
case audio, file, image, video
|
||||
}
|
||||
|
||||
extension [TimelineAllowedMessageType] {
|
||||
/// The gallery attachments these types allow, or `nil` when they place no restriction on them,
|
||||
/// which is the case for a timeline made up of galleries alone.
|
||||
var allowedGalleryItemTypes: [TimelineAllowedGalleryItemType]? {
|
||||
let types = compactMap(\.allowedGalleryItemType)
|
||||
return types.isEmpty ? nil : types
|
||||
}
|
||||
}
|
||||
|
||||
enum TimelineProxyError: Error {
|
||||
|
||||
Reference in New Issue
Block a user