Update SDK to 1.0.102-alpha (#1408)

* Update SDK to 1.0.102-alpha

* Log error

* Notification Improvements API part 1 (#1410)

* changes

* WIP

* progress

* updated test

* removed unused

* code improvement

* Process diffs as batches provided by the SDK.

---------

Co-authored-by: Mauro <34335419+Velin92@users.noreply.github.com>
Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
Alfonso Grillo
2023-07-27 11:48:56 +02:00
committed by GitHub
parent 188d41e59d
commit 1529b5b8ca
12 changed files with 117 additions and 160 deletions
@@ -76,6 +76,8 @@ struct RoomEventStringBuilder {
member: sender.id,
memberIsYou: isOutgoing)
.map(AttributedString.init)
case .poll, .pollEnd:
return nil
}
}
@@ -35,7 +35,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
private let stateSubject = CurrentValueSubject<RoomSummaryProviderState, Never>(.notLoaded)
private let countSubject = CurrentValueSubject<UInt, Never>(0)
private let diffPublisher = PassthroughSubject<RoomListEntriesUpdate, Never>()
private let diffsPublisher = PassthroughSubject<[RoomListEntriesUpdate], Never>()
var roomListPublisher: CurrentValuePublisher<[RoomSummary], Never> {
roomListSubject.asCurrentValuePublisher()
@@ -59,8 +59,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
self.eventStringBuilder = eventStringBuilder
self.name = name
diffPublisher
.collect(.byTime(serialDispatchQueue, 0.025))
diffsPublisher
.receive(on: serialDispatchQueue)
.sink { [weak self] in self?.updateRoomsWithDiffs($0) }
.store(in: &cancellables)
}
@@ -73,10 +73,10 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
self.roomList = roomList
do {
let listUpdatesSubscriptionResult = try roomList.entries(listener: RoomListEntriesListenerProxy { [weak self] update in
let listUpdatesSubscriptionResult = try roomList.entries(listener: RoomListEntriesListenerProxy { [weak self] updates in
guard let self else { return }
MXLog.verbose("\(name): Received list update")
diffPublisher.send(update)
diffsPublisher.send(updates)
})
listUpdatesTaskHandle = listUpdatesSubscriptionResult.entriesStream
@@ -324,13 +324,13 @@ extension MatrixRustSDK.RoomListEntry {
}
private class RoomListEntriesListenerProxy: RoomListEntriesListener {
private let onUpdateClosure: (RoomListEntriesUpdate) -> Void
private let onUpdateClosure: ([RoomListEntriesUpdate]) -> Void
init(_ onUpdateClosure: @escaping (RoomListEntriesUpdate) -> Void) {
init(_ onUpdateClosure: @escaping ([RoomListEntriesUpdate]) -> Void) {
self.onUpdateClosure = onUpdateClosure
}
func onUpdate(roomEntriesUpdate: RoomListEntriesUpdate) {
func onUpdate(roomEntriesUpdate: [RoomListEntriesUpdate]) {
onUpdateClosure(roomEntriesUpdate)
}
}