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:
Stefan Ceriu
2025-05-21 21:57:23 +03:00
committed by Stefan Ceriu
parent 7e5f9f1e17
commit 909aa086f2
7 changed files with 404 additions and 287 deletions
@@ -169,11 +169,13 @@ class ClientProxy: ClientProxyProtocol {
roomListStateUpdateTaskHandle = createRoomListServiceObserver(roomListService)
roomListStateLoadingStateUpdateTaskHandle = createRoomListLoadingStateUpdateObserver(roomListService)
delegateHandle = client.setDelegate(delegate: ClientDelegateWrapper { [weak self] isSoftLogout in
delegateHandle = try client.setDelegate(delegate: ClientDelegateWrapper { [weak self] isSoftLogout in
self?.hasEncounteredAuthError = true
self?.actionsSubject.send(.receivedAuthError(isSoftLogout: isSoftLogout))
})
try await client.setUtdDelegate(utdDelegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
networkMonitor.reachabilityPublisher
.removeDuplicates()
.receive(on: DispatchQueue.main)
@@ -900,24 +902,6 @@ class ClientProxy: ClientProxyProtocol {
})
}
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) })
}()
private func buildRoomForIdentifier(_ roomID: String) async -> RoomProxyType? {
do {
let roomListItem = try roomListService.room(roomId: roomID)
@@ -935,13 +919,14 @@ class ClientProxy: ClientProxyProtocol {
}
return nil
case .joined:
if roomListItem.isTimelineInitialized() == false {
try await roomListItem.initTimeline(eventTypeFilter: eventFilters, internalIdPrefix: nil)
guard let room = try client.getRoom(roomId: roomID) else {
MXLog.error("Could not find room with ID: \(roomID)")
return nil
}
let roomProxy = try await JoinedRoomProxy(roomListService: roomListService,
roomListItem: roomListItem,
room: roomListItem.fullRoom())
room: room)
return .joined(roomProxy)
case .left:
@@ -1119,7 +1104,6 @@ private struct ClientProxyServices {
let syncService = try await client
.syncService()
.withCrossProcessLock()
.withUtdHook(delegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
.finish()
let roomListService = syncService.roomListService()