mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Bump the Rust SDK to 1.0.42-alpha, fix breaking changes
This commit is contained in:
committed by
Stefan Ceriu
parent
9e604c120b
commit
b5055d1680
@@ -95,8 +95,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "6cf248cfdf11237ae988f6e7ee11f273c551860a",
|
"revision" : "852bb356fbd2b5053f17b3c6c27c8c098cf5f055",
|
||||||
"version" : "1.0.41-alpha"
|
"version" : "1.0.42-alpha"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
private var slidingSyncObserverToken: TaskHandle?
|
private var slidingSyncObserverToken: TaskHandle?
|
||||||
private var slidingSync: SlidingSync?
|
private var slidingSync: SlidingSync?
|
||||||
|
|
||||||
var visibleRoomsSlidingSyncView: SlidingSyncView?
|
var visibleRoomsSlidingSyncView: SlidingSyncList?
|
||||||
var visibleRoomsSummaryProvider: RoomSummaryProviderProtocol?
|
var visibleRoomsSummaryProvider: RoomSummaryProviderProtocol?
|
||||||
|
|
||||||
var allRoomsSlidingSyncView: SlidingSyncView?
|
var allRoomsSlidingSyncView: SlidingSyncList?
|
||||||
var allRoomsSummaryProvider: RoomSummaryProviderProtocol?
|
var allRoomsSummaryProvider: RoomSummaryProviderProtocol?
|
||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
@@ -258,7 +258,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
|
|
||||||
// Build the visibleRoomsSlidingSyncView here so that it can take advantage of the SS builder cold cache
|
// Build the visibleRoomsSlidingSyncView here so that it can take advantage of the SS builder cold cache
|
||||||
// We will still register the allRoomsSlidingSyncView later, and than will have no cache
|
// We will still register the allRoomsSlidingSyncView later, and than will have no cache
|
||||||
let visibleRoomsView = try SlidingSyncViewBuilder()
|
let visibleRoomsView = try SlidingSyncListBuilder()
|
||||||
.timelineLimit(limit: UInt32(SlidingSyncConstants.initialTimelineLimit)) // Starts off with zero to quickly load rooms, then goes to 1 while scrolling to quickly load last messages and 20 when the scrolling stops to load room history
|
.timelineLimit(limit: UInt32(SlidingSyncConstants.initialTimelineLimit)) // Starts off with zero to quickly load rooms, then goes to 1 while scrolling to quickly load last messages and 20 when the scrolling stops to load room history
|
||||||
.requiredState(requiredState: slidingSyncRequiredState)
|
.requiredState(requiredState: slidingSyncRequiredState)
|
||||||
.filters(filters: slidingSyncFilters)
|
.filters(filters: slidingSyncFilters)
|
||||||
@@ -269,7 +269,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
.build()
|
.build()
|
||||||
|
|
||||||
let slidingSync = try slidingSyncBuilder
|
let slidingSync = try slidingSyncBuilder
|
||||||
.addView(v: visibleRoomsView)
|
.addList(v: visibleRoomsView)
|
||||||
.withCommonExtensions()
|
.withCommonExtensions()
|
||||||
.coldCache(name: "ElementX")
|
.coldCache(name: "ElementX")
|
||||||
.build()
|
.build()
|
||||||
@@ -285,7 +285,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func buildAndConfigureVisibleRoomsSlidingSyncView(slidingSync: SlidingSyncProtocol, visibleRoomsView: SlidingSyncView) {
|
private func buildAndConfigureVisibleRoomsSlidingSyncView(slidingSync: SlidingSyncProtocol, visibleRoomsView: SlidingSyncList) {
|
||||||
let visibleRoomsViewProxy = SlidingSyncViewProxy(slidingSync: slidingSync, slidingSyncView: visibleRoomsView)
|
let visibleRoomsViewProxy = SlidingSyncViewProxy(slidingSync: slidingSync, slidingSyncView: visibleRoomsView)
|
||||||
|
|
||||||
visibleRoomsSummaryProvider = RoomSummaryProvider(slidingSyncViewProxy: visibleRoomsViewProxy,
|
visibleRoomsSummaryProvider = RoomSummaryProvider(slidingSyncViewProxy: visibleRoomsViewProxy,
|
||||||
@@ -313,7 +313,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let allRoomsView = try SlidingSyncViewBuilder()
|
let allRoomsView = try SlidingSyncListBuilder()
|
||||||
.noTimelineLimit()
|
.noTimelineLimit()
|
||||||
.requiredState(requiredState: slidingSyncRequiredState)
|
.requiredState(requiredState: slidingSyncRequiredState)
|
||||||
.filters(filters: slidingSyncFilters)
|
.filters(filters: slidingSyncFilters)
|
||||||
@@ -359,7 +359,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
|
|
||||||
if let allRoomsSlidingSyncView {
|
if let allRoomsSlidingSyncView {
|
||||||
MXLog.info("Registering all rooms view")
|
MXLog.info("Registering all rooms view")
|
||||||
_ = slidingSync?.addView(view: allRoomsSlidingSyncView)
|
_ = slidingSync?.addList(list: allRoomsSlidingSyncView)
|
||||||
} else {
|
} else {
|
||||||
MXLog.error("All rooms sliding sync view unavailable")
|
MXLog.error("All rooms sliding sync view unavailable")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import Combine
|
|||||||
import Foundation
|
import Foundation
|
||||||
import MatrixRustSDK
|
import MatrixRustSDK
|
||||||
|
|
||||||
private class SlidingSyncViewObserver: SlidingSyncViewRoomListObserver, SlidingSyncViewStateObserver, SlidingSyncViewRoomsCountObserver {
|
private class SlidingSyncViewObserver: SlidingSyncListRoomListObserver, SlidingSyncListStateObserver, SlidingSyncListRoomsCountObserver {
|
||||||
/// Publishes room list diffs as they come in through sliding sync
|
/// Publishes room list diffs as they come in through sliding sync
|
||||||
let roomListDiffPublisher = PassthroughSubject<SlidingSyncViewRoomsListDiff, Never>()
|
let roomListDiffPublisher = PassthroughSubject<SlidingSyncListRoomsListDiff, Never>()
|
||||||
|
|
||||||
/// Publishes the current state of sliding sync, such as whether its catching up or live.
|
/// Publishes the current state of sliding sync, such as whether its catching up or live.
|
||||||
let stateUpdatePublisher = CurrentValueSubject<SlidingSyncState, Never>(.cold)
|
let stateUpdatePublisher = CurrentValueSubject<SlidingSyncState, Never>(.cold)
|
||||||
@@ -28,21 +28,21 @@ private class SlidingSyncViewObserver: SlidingSyncViewRoomListObserver, SlidingS
|
|||||||
/// Publishes the number of available rooms
|
/// Publishes the number of available rooms
|
||||||
let countUpdatePublisher = CurrentValueSubject<UInt, Never>(0)
|
let countUpdatePublisher = CurrentValueSubject<UInt, Never>(0)
|
||||||
|
|
||||||
// MARK: - SlidingSyncViewRoomListObserver
|
// MARK: - SlidingSyncListRoomListObserver
|
||||||
|
|
||||||
func didReceiveUpdate(diff: SlidingSyncViewRoomsListDiff) {
|
func didReceiveUpdate(diff: SlidingSyncListRoomsListDiff) {
|
||||||
MXLog.verbose("Received room diff")
|
MXLog.verbose("Received room diff")
|
||||||
roomListDiffPublisher.send(diff)
|
roomListDiffPublisher.send(diff)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - SlidingSyncViewStateObserver
|
// MARK: - SlidingSyncListStateObserver
|
||||||
|
|
||||||
func didReceiveUpdate(newState: SlidingSyncState) {
|
func didReceiveUpdate(newState: SlidingSyncState) {
|
||||||
MXLog.info("Updated state: \(newState)")
|
MXLog.info("Updated state: \(newState)")
|
||||||
stateUpdatePublisher.send(newState)
|
stateUpdatePublisher.send(newState)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - SlidingSyncViewRoomsCountObserver
|
// MARK: - SlidingSyncListRoomsCountObserver
|
||||||
|
|
||||||
func didReceiveUpdate(count: UInt32) {
|
func didReceiveUpdate(count: UInt32) {
|
||||||
MXLog.info("Updated room count: \(count)")
|
MXLog.info("Updated room count: \(count)")
|
||||||
@@ -52,7 +52,7 @@ private class SlidingSyncViewObserver: SlidingSyncViewRoomListObserver, SlidingS
|
|||||||
|
|
||||||
class SlidingSyncViewProxy {
|
class SlidingSyncViewProxy {
|
||||||
private let slidingSync: SlidingSyncProtocol
|
private let slidingSync: SlidingSyncProtocol
|
||||||
private let slidingSyncView: SlidingSyncViewProtocol
|
private let slidingSyncView: SlidingSyncListProtocol
|
||||||
|
|
||||||
private var listUpdateObserverToken: TaskHandle?
|
private var listUpdateObserverToken: TaskHandle?
|
||||||
private var stateUpdateObserverToken: TaskHandle?
|
private var stateUpdateObserverToken: TaskHandle?
|
||||||
@@ -60,7 +60,7 @@ class SlidingSyncViewProxy {
|
|||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
let diffPublisher = PassthroughSubject<SlidingSyncViewRoomsListDiff, Never>()
|
let diffPublisher = PassthroughSubject<SlidingSyncListRoomsListDiff, Never>()
|
||||||
let statePublisher = PassthroughSubject<SlidingSyncState, Never>()
|
let statePublisher = PassthroughSubject<SlidingSyncState, Never>()
|
||||||
let countPublisher = PassthroughSubject<UInt, Never>()
|
let countPublisher = PassthroughSubject<UInt, Never>()
|
||||||
let visibleRangeUpdatePublisher = PassthroughSubject<Void, Never>()
|
let visibleRangeUpdatePublisher = PassthroughSubject<Void, Never>()
|
||||||
@@ -71,7 +71,7 @@ class SlidingSyncViewProxy {
|
|||||||
countUpdateObserverToken?.cancel()
|
countUpdateObserverToken?.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
init(slidingSync: SlidingSyncProtocol, slidingSyncView: SlidingSyncViewProtocol) {
|
init(slidingSync: SlidingSyncProtocol, slidingSyncView: SlidingSyncListProtocol) {
|
||||||
self.slidingSync = slidingSync
|
self.slidingSync = slidingSync
|
||||||
self.slidingSyncView = slidingSyncView
|
self.slidingSyncView = slidingSyncView
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
fileprivate func updateRoomsWithDiffs(_ diffs: [SlidingSyncViewRoomsListDiff]) {
|
fileprivate func updateRoomsWithDiffs(_ diffs: [SlidingSyncListRoomsListDiff]) {
|
||||||
MXLog.info("Received \(diffs.count) diffs")
|
MXLog.info("Received \(diffs.count) diffs")
|
||||||
|
|
||||||
rooms = diffs
|
rooms = diffs
|
||||||
@@ -136,7 +136,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
||||||
private func buildDiff(from diff: SlidingSyncViewRoomsListDiff, on rooms: [RoomSummary]) -> CollectionDifference<RoomSummary>? {
|
private func buildDiff(from diff: SlidingSyncListRoomsListDiff, on rooms: [RoomSummary]) -> CollectionDifference<RoomSummary>? {
|
||||||
var changes = [CollectionDifference<RoomSummary>.Change]()
|
var changes = [CollectionDifference<RoomSummary>.Change]()
|
||||||
|
|
||||||
switch diff {
|
switch diff {
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ include:
|
|||||||
packages:
|
packages:
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||||
exactVersion: 1.0.41-alpha
|
exactVersion: 1.0.42-alpha
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
DesignKit:
|
DesignKit:
|
||||||
path: DesignKit
|
path: DesignKit
|
||||||
|
|||||||
Reference in New Issue
Block a user