Add support for the new RoomList API (#1092)

* Add support for the new RoomList API

Squashed commits:
[8c2625a] Re-enable invites
[339e59b5] Add automatic syncing restarts after entering the terminated state for whatever reason
[b5498e96] Reimplemented room list state management and usage
[8154b0cf] Fix visible rooms range setting after scrolling stops
[5155c44d] Hook up initial loading idicator and session verification banner to room list service states
[700a5a2e] Enable back room subscriptions, timeline listeners and unread notifications / counts
[9df383bc] Enable last messages and timestamps, they don't crash on release builds
[7c4da9da] Add back certain fields now that the "full room" is available
[9f6534a7] Adopt interfaces to new RoomList API, untested as requests don't go to the right URL

* Tweaks following code review

* Bump the RustSDK to v1.0.76-alpha
This commit is contained in:
Stefan Ceriu
2023-06-16 16:11:45 +03:00
committed by GitHub
parent de0213abb2
commit d2d626f724
25 changed files with 343 additions and 661 deletions
@@ -28,13 +28,12 @@ enum RoomSummaryProviderState {
enum RoomSummary: CustomStringConvertible {
case empty
case filled(details: RoomSummaryDetails)
case invalidated(details: RoomSummaryDetails)
var id: String? {
switch self {
case .empty:
return nil
case .invalidated(let details), .filled(let details):
case .filled(let details):
return details.id
}
}
@@ -43,7 +42,7 @@ enum RoomSummary: CustomStringConvertible {
switch self {
case .empty:
return nil
case .invalidated(let details), .filled(let details):
case .filled(let details):
return details.name
}
}
@@ -52,8 +51,6 @@ enum RoomSummary: CustomStringConvertible {
switch self {
case .empty:
return "\(String(describing: Self.self)): Empty"
case .invalidated(let details):
return "\(String(describing: Self.self)): Invalidated(\(details.id))"
case .filled(let details):
return "\(String(describing: Self.self)): Filled(\(details.id))"
}
@@ -67,8 +64,10 @@ protocol RoomSummaryProviderProtocol {
/// Publishes the current state the summary provider is finding itself in
var statePublisher: CurrentValuePublisher<RoomSummaryProviderState, Never> { get }
/// Publishes the total number of rooms
var countPublisher: CurrentValuePublisher<UInt, Never> { get }
func updateVisibleRange(_ range: Range<Int>, timelineLimit: UInt)
/// A separate subscription method is needed instead of running this in the constructor because the invites list is added later on the Rust side.
/// Wanted to be able to build the InvitesSummaryProvider directly instead of having to inform the HomeScreenViewModel about it later
func subscribeIfNecessary(entriesFunction: (RoomListEntriesListener) async throws -> RoomListEntriesResult,
entriesLoadingStateFunction: (SlidingSyncListStateObserver) async throws -> RoomListEntriesLoadingStateResult) async
func updateVisibleRange(_ range: Range<Int>)
}