mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Bump the SDK to 25.05.21 and adopt the new way of dealing with timelines and delegates.
The room list items no longer hold any timeline instances and they can now be created through the normal `room.timelineWithConfiguration` mechanism. This also means that we can move the UTD hook away from the sync service and into the client itself but setting it is now fallible as it can only be set once.
This commit is contained in:
committed by
Stefan Ceriu
parent
7e5f9f1e17
commit
909aa086f2
@@ -39,7 +39,8 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
filter: .all,
|
||||
internalIdPrefix: nil,
|
||||
dateDividerMode: .daily,
|
||||
trackReadReceipts: false))
|
||||
trackReadReceipts: false,
|
||||
reportUtds: true))
|
||||
|
||||
let timeline = TimelineProxy(timeline: sdkTimeline, kind: .pinned)
|
||||
|
||||
@@ -108,7 +109,14 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
self.room = room
|
||||
|
||||
infoSubject = try await .init(RoomInfoProxy(roomInfo: room.roomInfo()))
|
||||
timeline = try await TimelineProxy(timeline: room.timeline(), kind: .live)
|
||||
|
||||
timeline = try await TimelineProxy(timeline: room.timelineWithConfiguration(configuration: .init(focus: .live,
|
||||
filter: .eventTypeFilter(filter: eventFilters),
|
||||
internalIdPrefix: nil,
|
||||
dateDividerMode: .daily,
|
||||
trackReadReceipts: true,
|
||||
reportUtds: true)),
|
||||
kind: .live)
|
||||
|
||||
Task {
|
||||
await updateMembers()
|
||||
@@ -123,6 +131,24 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
private let eventFilters: TimelineEventTypeFilter = {
|
||||
var stateEventFilters: [StateEventType] = [.roomAliases,
|
||||
.roomCanonicalAlias,
|
||||
.roomGuestAccess,
|
||||
.roomHistoryVisibility,
|
||||
.roomJoinRules,
|
||||
.roomPinnedEvents,
|
||||
.roomPowerLevels,
|
||||
.roomServerAcl,
|
||||
.roomTombstone,
|
||||
.spaceChild,
|
||||
.spaceParent,
|
||||
.policyRuleRoom,
|
||||
.policyRuleServer,
|
||||
.policyRuleUser]
|
||||
return .exclude(eventTypes: stateEventFilters.map { FilterTimelineEventType.state(eventType: $0) })
|
||||
}()
|
||||
|
||||
func subscribeForUpdates() async {
|
||||
guard !subscribedForUpdates else {
|
||||
MXLog.warning("Room already subscribed for updates")
|
||||
@@ -169,7 +195,8 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
filter: .all,
|
||||
internalIdPrefix: UUID().uuidString,
|
||||
dateDividerMode: .daily,
|
||||
trackReadReceipts: false))
|
||||
trackReadReceipts: false,
|
||||
reportUtds: true))
|
||||
|
||||
return .success(TimelineProxy(timeline: sdkTimeline, kind: .detached))
|
||||
} catch let error as FocusEventError {
|
||||
@@ -196,7 +223,8 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
filter: .all,
|
||||
internalIdPrefix: UUID().uuidString,
|
||||
dateDividerMode: .daily,
|
||||
trackReadReceipts: true))
|
||||
trackReadReceipts: true,
|
||||
reportUtds: true))
|
||||
|
||||
let timeline = TimelineProxy(timeline: sdkTimeline, kind: .thread)
|
||||
await timeline.subscribeForUpdates()
|
||||
@@ -232,7 +260,8 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
filter: .onlyMessage(types: rustMessageTypes),
|
||||
internalIdPrefix: nil,
|
||||
dateDividerMode: .monthly,
|
||||
trackReadReceipts: false))
|
||||
trackReadReceipts: false,
|
||||
reportUtds: true))
|
||||
|
||||
let timeline = TimelineProxy(timeline: sdkTimeline, kind: .media(presentation))
|
||||
await timeline.subscribeForUpdates()
|
||||
|
||||
Reference in New Issue
Block a user