Bump the RustSDK to v25.03.05

- adopt the new timeline configuration which now exposes read receipts tracking. For now it should be set to `false` for all timelines except the live one, which still gets configured properly on the rust side through `init_timeline`. Eventually we will converge on this configuration API for all of them.
- also adopt the new rust side cache clearing method and remove our own
This commit is contained in:
Stefan Ceriu
2025-03-05 13:30:18 +02:00
committed by Stefan Ceriu
parent fb8a1f33d8
commit 4d34a1ed56
12 changed files with 226 additions and 66 deletions
@@ -4258,6 +4258,71 @@ class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable {
return getElementWellKnownReturnValue
}
}
//MARK: - clearCaches
var clearCachesUnderlyingCallsCount = 0
var clearCachesCallsCount: Int {
get {
if Thread.isMainThread {
return clearCachesUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = clearCachesUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
clearCachesUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
clearCachesUnderlyingCallsCount = newValue
}
}
}
}
var clearCachesCalled: Bool {
return clearCachesCallsCount > 0
}
var clearCachesUnderlyingReturnValue: Result<Void, ClientProxyError>!
var clearCachesReturnValue: Result<Void, ClientProxyError>! {
get {
if Thread.isMainThread {
return clearCachesUnderlyingReturnValue
} else {
var returnValue: Result<Void, ClientProxyError>? = nil
DispatchQueue.main.sync {
returnValue = clearCachesUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
clearCachesUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
clearCachesUnderlyingReturnValue = newValue
}
}
}
}
var clearCachesClosure: (() async -> Result<Void, ClientProxyError>)?
@discardableResult
func clearCaches() async -> Result<Void, ClientProxyError> {
clearCachesCallsCount += 1
if let clearCachesClosure = clearCachesClosure {
return await clearCachesClosure()
} else {
return clearCachesReturnValue
}
}
//MARK: - ignoreUser
var ignoreUserUnderlyingCallsCount = 0
@@ -17572,47 +17637,6 @@ class UserSessionStoreMock: UserSessionStoreProtocol, @unchecked Sendable {
}
logoutUserSessionClosure?(userSession)
}
//MARK: - clearCache
var clearCacheForUnderlyingCallsCount = 0
var clearCacheForCallsCount: Int {
get {
if Thread.isMainThread {
return clearCacheForUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = clearCacheForUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
clearCacheForUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
clearCacheForUnderlyingCallsCount = newValue
}
}
}
}
var clearCacheForCalled: Bool {
return clearCacheForCallsCount > 0
}
var clearCacheForReceivedUserID: String?
var clearCacheForReceivedInvocations: [String] = []
var clearCacheForClosure: ((String) -> Void)?
func clearCache(for userID: String) {
clearCacheForCallsCount += 1
clearCacheForReceivedUserID = userID
DispatchQueue.main.async {
self.clearCacheForReceivedInvocations.append(userID)
}
clearCacheForClosure?(userID)
}
}
class VoiceMessageCacheMock: VoiceMessageCacheProtocol, @unchecked Sendable {
var urlForRecording: URL {
@@ -552,6 +552,46 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
}
}
//MARK: - clearCaches
open var clearCachesThrowableError: Error?
var clearCachesUnderlyingCallsCount = 0
open var clearCachesCallsCount: Int {
get {
if Thread.isMainThread {
return clearCachesUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = clearCachesUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
clearCachesUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
clearCachesUnderlyingCallsCount = newValue
}
}
}
}
open var clearCachesCalled: Bool {
return clearCachesCallsCount > 0
}
open var clearCachesClosure: (() async throws -> Void)?
open override func clearCaches() async throws {
if let error = clearCachesThrowableError {
throw error
}
clearCachesCallsCount += 1
try await clearCachesClosure?()
}
//MARK: - createRoom
open var createRoomRequestThrowableError: Error?
@@ -3389,6 +3429,52 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
try await setDisplayNameNameClosure?(name)
}
//MARK: - setMediaRetentionPolicy
open var setMediaRetentionPolicyPolicyThrowableError: Error?
var setMediaRetentionPolicyPolicyUnderlyingCallsCount = 0
open var setMediaRetentionPolicyPolicyCallsCount: Int {
get {
if Thread.isMainThread {
return setMediaRetentionPolicyPolicyUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = setMediaRetentionPolicyPolicyUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
setMediaRetentionPolicyPolicyUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
setMediaRetentionPolicyPolicyUnderlyingCallsCount = newValue
}
}
}
}
open var setMediaRetentionPolicyPolicyCalled: Bool {
return setMediaRetentionPolicyPolicyCallsCount > 0
}
open var setMediaRetentionPolicyPolicyReceivedPolicy: MediaRetentionPolicy?
open var setMediaRetentionPolicyPolicyReceivedInvocations: [MediaRetentionPolicy] = []
open var setMediaRetentionPolicyPolicyClosure: ((MediaRetentionPolicy) async throws -> Void)?
open override func setMediaRetentionPolicy(policy: MediaRetentionPolicy) async throws {
if let error = setMediaRetentionPolicyPolicyThrowableError {
throw error
}
setMediaRetentionPolicyPolicyCallsCount += 1
setMediaRetentionPolicyPolicyReceivedPolicy = policy
DispatchQueue.main.async {
self.setMediaRetentionPolicyPolicyReceivedInvocations.append(policy)
}
try await setMediaRetentionPolicyPolicyClosure?(policy)
}
//MARK: - setPusher
open var setPusherIdentifiersKindAppDisplayNameDeviceDisplayNameProfileTagLangThrowableError: Error?
@@ -13725,6 +13811,52 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
try await reportContentEventIdScoreReasonClosure?(eventId, score, reason)
}
//MARK: - reportRoom
open var reportRoomReasonThrowableError: Error?
var reportRoomReasonUnderlyingCallsCount = 0
open var reportRoomReasonCallsCount: Int {
get {
if Thread.isMainThread {
return reportRoomReasonUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = reportRoomReasonUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
reportRoomReasonUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
reportRoomReasonUnderlyingCallsCount = newValue
}
}
}
}
open var reportRoomReasonCalled: Bool {
return reportRoomReasonCallsCount > 0
}
open var reportRoomReasonReceivedReason: String?
open var reportRoomReasonReceivedInvocations: [String?] = []
open var reportRoomReasonClosure: ((String?) async throws -> Void)?
open override func reportRoom(reason: String?) async throws {
if let error = reportRoomReasonThrowableError {
throw error
}
reportRoomReasonCallsCount += 1
reportRoomReasonReceivedReason = reason
DispatchQueue.main.async {
self.reportRoomReasonReceivedInvocations.append(reason)
}
try await reportRoomReasonClosure?(reason)
}
//MARK: - resetPowerLevels
open var resetPowerLevelsThrowableError: Error?