From f29c0a981115e032ab4b033aee4e41778732d64c Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 27 Jan 2023 16:04:46 +0200 Subject: [PATCH] Fix SS update observer and implicitly session verification not being requested --- .../Sources/Services/Client/ClientProxy.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index 0912e45e2..36c2d07bf 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -19,7 +19,7 @@ import Foundation import MatrixRustSDK import UIKit -private class WeakClientProxyWrapper: ClientDelegate { +private class WeakClientProxyWrapper: ClientDelegate, SlidingSyncObserver { private weak var clientProxy: ClientProxy? init(clientProxy: ClientProxy) { @@ -39,6 +39,13 @@ private class WeakClientProxyWrapper: ClientDelegate { MXLog.info("Did update restoration token") clientProxy?.didUpdateRestoreToken() } + + // MARK: - SlidingSyncDelegate + + func didReceiveSyncUpdate(summary: UpdateSummary) { + MXLog.info("Received sliding sync update") + clientProxy?.didReceiveSlidingSyncUpdate(summary: summary) + } } class ClientProxy: ClientProxyProtocol { @@ -267,6 +274,8 @@ class ClientProxy: ClientProxyProtocol { .coldCache(name: "ElementX") .build() + slidingSync.setObserver(observer: WeakClientProxyWrapper(clientProxy: self)) + self.slidingSync = slidingSync buildAndConfigureVisibleRoomsSlidingSyncView(slidingSync: slidingSync, visibleRoomsView: visibleRoomsView) @@ -370,6 +379,10 @@ class ClientProxy: ClientProxyProtocol { callbacks.send(.updatedRestoreToken) } + fileprivate func didReceiveSlidingSyncUpdate(summary: UpdateSummary) { + callbacks.send(.receivedSyncUpdate) + } + /// Convenience method to get the json string of an Encodable private func jsonString(from dictionary: [AnyHashable: Any]?) -> String? { guard let dictionary,