Skip to content

Commit 29cfcb0

Browse files
committed
Better document the various protocols and classes involved in dealing with room timelines.
1 parent 972084a commit 29cfcb0

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

ElementX/Sources/Screens/Timeline/TimelineInteractionHandler.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ enum TimelineInteractionHandlerAction {
2626
case viewInRoomTimeline(eventID: String)
2727
}
2828

29+
/// The interaction handler groups logic for dealing with various actions the user can take on a timeline's
30+
/// view that would've normally been part of the ``TimelineViewModel``
2931
@MainActor
3032
class TimelineInteractionHandler {
3133
private let roomProxy: JoinedRoomProxyProtocol

ElementX/Sources/Services/Timeline/TimelineController/TimelineControllerProtocol.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ enum TimelineControllerError: Error {
3333
case eventNotFound
3434
}
3535

36+
/// This protocol is a high level abstraction on top of the ``TimelineProxyProtocol``
37+
/// and its ``TimelineItemProviderProtocol`` that offers an UI layer oriented interface for dealing
38+
/// with Room timelines.
39+
/// It, for example, permits switching from a live timeline to an event focused one, building view specific
40+
/// timeline items, grouping together state events, donating intents to the larger system etc.
3641
@MainActor
3742
protocol TimelineControllerProtocol {
3843
var roomID: String { get }

ElementX/Sources/Services/Timeline/TimelineItemProviderProtocol.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ struct PaginationState: Equatable {
2727
let forward: PaginationStatus
2828
}
2929

30+
/// Entities implementing this protocol are responsible for processings diffs coming from the rust timeline
31+
/// and converting them into an array of Element X specific ``TimelineItemProxy``s that will be
32+
/// published as an array together with the pagination state through the ``updatePublisher``.
3033
@MainActor
31-
// sourcery: AutoMockable
3234
protocol TimelineItemProviderProtocol {
3335
/// A publisher that signals when ``itemProxies`` or ``paginationState`` are changed.
3436
var updatePublisher: AnyPublisher<([TimelineItemProxy], PaginationState), Never> { get }
@@ -43,3 +45,6 @@ protocol TimelineItemProviderProtocol {
4345
/// This is temporary and will be replace by a subscription on the room itself.
4446
var membershipChangePublisher: AnyPublisher<Void, Never> { get }
4547
}
48+
49+
// sourcery: AutoMockable
50+
extension TimelineItemProviderProtocol { }

ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ enum TimelineProxyError: Error {
3737
case failedPaginatingEndReached
3838
}
3939

40-
// sourcery: AutoMockable
40+
/// Element X proxies generally wrap the counterpart RustSDK objects while providing platform specific
41+
/// interfaces. In this case it composes methods for interacting with a room's timeline and should be used alongside
42+
/// the ``TimelineItemProviderProtocol`` which offers a reactive interface to timeline changes.
4143
protocol TimelineProxyProtocol {
4244
var timelineItemProvider: TimelineItemProviderProtocol { get }
4345

@@ -125,3 +127,6 @@ protocol TimelineProxyProtocol {
125127
html: String?,
126128
intentionalMentions: Mentions) -> RoomMessageEventContentWithoutRelation
127129
}
130+
131+
// sourcery: AutoMockable
132+
extension TimelineProxyProtocol { }

0 commit comments

Comments
 (0)