From 10702cef96c752384b6eab3e5edab9525574e88d Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Mon, 5 Aug 2024 11:25:33 +0200 Subject: [PATCH] updated the SDK --- ElementX.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 +- .../Mocks/Generated/SDKGeneratedMocks.swift | 88 +++++++++++++------ .../Sources/Services/Room/RoomProxy.swift | 2 +- project.yml | 2 +- 5 files changed, 67 insertions(+), 31 deletions(-) diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 4705d05ca7..05a16fface 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -7553,7 +7553,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 1.0.30; + version = 1.0.31; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 19114cbe0e..3d793291f8 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -149,8 +149,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "bc534e15fa0749d668b201b923ee57204afb868a", - "version" : "1.0.30" + "revision" : "8e2b4049fb492dcf5b0c796784b7aa7a3c099943", + "version" : "1.0.31" } }, { diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index 7db135cb5a..056491d7f7 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -10989,6 +10989,42 @@ open class RoomSDKMock: MatrixRustSDK.Room { try await clearComposerDraftClosure?() } + //MARK: - clearPinnedEventsCache + + var clearPinnedEventsCacheUnderlyingCallsCount = 0 + open var clearPinnedEventsCacheCallsCount: Int { + get { + if Thread.isMainThread { + return clearPinnedEventsCacheUnderlyingCallsCount + } else { + var returnValue: Int? = nil + DispatchQueue.main.sync { + returnValue = clearPinnedEventsCacheUnderlyingCallsCount + } + + return returnValue! + } + } + set { + if Thread.isMainThread { + clearPinnedEventsCacheUnderlyingCallsCount = newValue + } else { + DispatchQueue.main.sync { + clearPinnedEventsCacheUnderlyingCallsCount = newValue + } + } + } + } + open var clearPinnedEventsCacheCalled: Bool { + return clearPinnedEventsCacheCallsCount > 0 + } + open var clearPinnedEventsCacheClosure: (() async -> Void)? + + open override func clearPinnedEventsCache() async { + clearPinnedEventsCacheCallsCount += 1 + await clearPinnedEventsCacheClosure?() + } + //MARK: - discardRoomKey open var discardRoomKeyThrowableError: Error? @@ -13007,16 +13043,16 @@ open class RoomSDKMock: MatrixRustSDK.Room { //MARK: - pinnedEventsTimeline - open var pinnedEventsTimelineInternalIdPrefixThrowableError: Error? - var pinnedEventsTimelineInternalIdPrefixUnderlyingCallsCount = 0 - open var pinnedEventsTimelineInternalIdPrefixCallsCount: Int { + open var pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadThrowableError: Error? + var pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingCallsCount = 0 + open var pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadCallsCount: Int { get { if Thread.isMainThread { - return pinnedEventsTimelineInternalIdPrefixUnderlyingCallsCount + return pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingCallsCount } else { var returnValue: Int? = nil DispatchQueue.main.sync { - returnValue = pinnedEventsTimelineInternalIdPrefixUnderlyingCallsCount + returnValue = pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingCallsCount } return returnValue! @@ -13024,29 +13060,29 @@ open class RoomSDKMock: MatrixRustSDK.Room { } set { if Thread.isMainThread { - pinnedEventsTimelineInternalIdPrefixUnderlyingCallsCount = newValue + pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingCallsCount = newValue } else { DispatchQueue.main.sync { - pinnedEventsTimelineInternalIdPrefixUnderlyingCallsCount = newValue + pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingCallsCount = newValue } } } } - open var pinnedEventsTimelineInternalIdPrefixCalled: Bool { - return pinnedEventsTimelineInternalIdPrefixCallsCount > 0 + open var pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadCalled: Bool { + return pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadCallsCount > 0 } - open var pinnedEventsTimelineInternalIdPrefixReceivedInternalIdPrefix: String? - open var pinnedEventsTimelineInternalIdPrefixReceivedInvocations: [String?] = [] + open var pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadReceivedArguments: (internalIdPrefix: String?, maxEventsToLoad: UInt16)? + open var pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadReceivedInvocations: [(internalIdPrefix: String?, maxEventsToLoad: UInt16)] = [] - var pinnedEventsTimelineInternalIdPrefixUnderlyingReturnValue: Timeline! - open var pinnedEventsTimelineInternalIdPrefixReturnValue: Timeline! { + var pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingReturnValue: Timeline! + open var pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadReturnValue: Timeline! { get { if Thread.isMainThread { - return pinnedEventsTimelineInternalIdPrefixUnderlyingReturnValue + return pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingReturnValue } else { var returnValue: Timeline? = nil DispatchQueue.main.sync { - returnValue = pinnedEventsTimelineInternalIdPrefixUnderlyingReturnValue + returnValue = pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingReturnValue } return returnValue! @@ -13054,29 +13090,29 @@ open class RoomSDKMock: MatrixRustSDK.Room { } set { if Thread.isMainThread { - pinnedEventsTimelineInternalIdPrefixUnderlyingReturnValue = newValue + pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingReturnValue = newValue } else { DispatchQueue.main.sync { - pinnedEventsTimelineInternalIdPrefixUnderlyingReturnValue = newValue + pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadUnderlyingReturnValue = newValue } } } } - open var pinnedEventsTimelineInternalIdPrefixClosure: ((String?) async throws -> Timeline)? + open var pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadClosure: ((String?, UInt16) async throws -> Timeline)? - open override func pinnedEventsTimeline(internalIdPrefix: String?) async throws -> Timeline { - if let error = pinnedEventsTimelineInternalIdPrefixThrowableError { + open override func pinnedEventsTimeline(internalIdPrefix: String?, maxEventsToLoad: UInt16) async throws -> Timeline { + if let error = pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadThrowableError { throw error } - pinnedEventsTimelineInternalIdPrefixCallsCount += 1 - pinnedEventsTimelineInternalIdPrefixReceivedInternalIdPrefix = internalIdPrefix + pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadCallsCount += 1 + pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadReceivedArguments = (internalIdPrefix: internalIdPrefix, maxEventsToLoad: maxEventsToLoad) DispatchQueue.main.async { - self.pinnedEventsTimelineInternalIdPrefixReceivedInvocations.append(internalIdPrefix) + self.pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadReceivedInvocations.append((internalIdPrefix: internalIdPrefix, maxEventsToLoad: maxEventsToLoad)) } - if let pinnedEventsTimelineInternalIdPrefixClosure = pinnedEventsTimelineInternalIdPrefixClosure { - return try await pinnedEventsTimelineInternalIdPrefixClosure(internalIdPrefix) + if let pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadClosure = pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadClosure { + return try await pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadClosure(internalIdPrefix, maxEventsToLoad) } else { - return pinnedEventsTimelineInternalIdPrefixReturnValue + return pinnedEventsTimelineInternalIdPrefixMaxEventsToLoadReturnValue } } diff --git a/ElementX/Sources/Services/Room/RoomProxy.swift b/ElementX/Sources/Services/Room/RoomProxy.swift index dea915945e..7067d175f0 100644 --- a/ElementX/Sources/Services/Room/RoomProxy.swift +++ b/ElementX/Sources/Services/Room/RoomProxy.swift @@ -30,7 +30,7 @@ class RoomProxy: RoomProxyProtocol { return innerPinnedEventsTimeline } else { do { - let timeline = try await TimelineProxy(timeline: room.pinnedEventsTimeline(internalIdPrefix: nil), isLive: false) + let timeline = try await TimelineProxy(timeline: room.pinnedEventsTimeline(internalIdPrefix: nil, maxEventsToLoad: 100), isLive: false) await timeline.subscribeForUpdates() innerPinnedEventsTimeline = timeline return timeline diff --git a/project.yml b/project.yml index 8b3ec05f93..91f61e8ea4 100644 --- a/project.yml +++ b/project.yml @@ -60,7 +60,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 1.0.30 + exactVersion: 1.0.31 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios