mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Add mechanism for opening up a threaded timeline
This commit is contained in:
committed by
Stefan Ceriu
parent
2f938d3cbf
commit
10fb2b5dda
@@ -21,6 +21,23 @@ struct TimelineControllerFactory: TimelineControllerFactoryProtocol {
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
}
|
||||
|
||||
func buildThreadTimelineController(eventID: String,
|
||||
roomProxy: JoinedRoomProxyProtocol,
|
||||
timelineItemFactory: RoomTimelineItemFactoryProtocol,
|
||||
mediaProvider: MediaProviderProtocol) async -> Result<TimelineControllerProtocol, TimelineFactoryControllerError> {
|
||||
switch await roomProxy.threadTimeline(eventID: eventID) {
|
||||
case .success(let timelineProxy):
|
||||
return .success(TimelineController(roomProxy: roomProxy,
|
||||
timelineProxy: timelineProxy,
|
||||
initialFocussedEventID: nil,
|
||||
timelineItemFactory: timelineItemFactory,
|
||||
mediaProvider: mediaProvider,
|
||||
appSettings: ServiceLocator.shared.settings))
|
||||
case .failure(let error):
|
||||
return .failure(.roomProxyError(error))
|
||||
}
|
||||
}
|
||||
|
||||
func buildPinnedEventsTimelineController(roomProxy: JoinedRoomProxyProtocol,
|
||||
timelineItemFactory: RoomTimelineItemFactoryProtocol,
|
||||
mediaProvider: MediaProviderProtocol) async -> TimelineControllerProtocol? {
|
||||
|
||||
+5
@@ -19,6 +19,11 @@ protocol TimelineControllerFactoryProtocol {
|
||||
timelineItemFactory: RoomTimelineItemFactoryProtocol,
|
||||
mediaProvider: MediaProviderProtocol) -> TimelineControllerProtocol
|
||||
|
||||
func buildThreadTimelineController(eventID: String,
|
||||
roomProxy: JoinedRoomProxyProtocol,
|
||||
timelineItemFactory: RoomTimelineItemFactoryProtocol,
|
||||
mediaProvider: MediaProviderProtocol) async -> Result<TimelineControllerProtocol, TimelineFactoryControllerError>
|
||||
|
||||
func buildPinnedEventsTimelineController(roomProxy: JoinedRoomProxyProtocol,
|
||||
timelineItemFactory: RoomTimelineItemFactoryProtocol,
|
||||
mediaProvider: MediaProviderProtocol) async -> TimelineControllerProtocol?
|
||||
|
||||
@@ -97,7 +97,7 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
switch kind {
|
||||
case .live:
|
||||
return await paginateBackwardsOnLive(requestSize: requestSize)
|
||||
case .detached, .media:
|
||||
case .detached, .media, .thread:
|
||||
return await focussedPaginate(.backwards, requestSize: requestSize)
|
||||
case .pinned:
|
||||
return .success(())
|
||||
@@ -596,7 +596,7 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
MXLog.error("Failed to subscribe to back pagination status with error: \(error)")
|
||||
}
|
||||
forwardPaginationStatusSubject.send(.timelineEndReached)
|
||||
case .detached:
|
||||
case .detached, .thread:
|
||||
// Detached timelines don't support observation, set the initial state ourself.
|
||||
backPaginationStatusSubject.send(.idle)
|
||||
forwardPaginationStatusSubject.send(.idle)
|
||||
|
||||
@@ -13,6 +13,7 @@ enum TimelineKind: Equatable {
|
||||
case live
|
||||
case detached
|
||||
case pinned
|
||||
case thread
|
||||
|
||||
enum MediaPresentation { case roomScreenLive, roomScreenDetached, pinnedEventsScreen, mediaFilesScreen }
|
||||
case media(MediaPresentation)
|
||||
@@ -21,6 +22,7 @@ enum TimelineKind: Equatable {
|
||||
enum TimelineFocus {
|
||||
case live
|
||||
case eventID(String)
|
||||
case thread(eventID: String)
|
||||
case pinned
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user