Bump the RustSDK to v25.04.08, fix breaking changes

This commit is contained in:
Stefan Ceriu
2025-04-08 10:05:05 +03:00
committed by Stefan Ceriu
parent d92fecdc7e
commit c9dc7e63c5
7 changed files with 94 additions and 74 deletions
+1 -1
View File
@@ -8633,7 +8633,7 @@
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
requirement = { requirement = {
kind = exactVersion; kind = exactVersion;
version = 25.04.02; version = 25.04.08;
}; };
}; };
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
@@ -158,8 +158,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift", "location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : { "state" : {
"revision" : "1bc2c0b021107332e0691e288780e8a3adb87905", "revision" : "ed17777f10cca2282b2331e6e61f0b1c281f52ea",
"version" : "25.4.2" "version" : "25.4.8"
} }
}, },
{ {
@@ -208,8 +208,7 @@ final class AppSettings {
tosURI: acceptableUseURL, tosURI: acceptableUseURL,
policyURI: privacyURL, policyURI: privacyURL,
contacts: [supportEmailAddress], contacts: [supportEmailAddress],
staticRegistrations: oidcStaticRegistrations.mapKeys { $0.absoluteString }, staticRegistrations: oidcStaticRegistrations.mapKeys { $0.absoluteString })
dynamicRegistrationsFile: .sessionsBaseDirectory.appending(path: "oidc/registrations.json"))
/// A temporary hack to allow registration on matrix.org until MAS is deployed. /// A temporary hack to allow registration on matrix.org until MAS is deployed.
let webRegistrationEnabled = true let webRegistrationEnabled = true
@@ -6179,6 +6179,71 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder, @unchecked Sendabl
} }
} }
//MARK: - systemIsMemoryConstrained
var systemIsMemoryConstrainedUnderlyingCallsCount = 0
open var systemIsMemoryConstrainedCallsCount: Int {
get {
if Thread.isMainThread {
return systemIsMemoryConstrainedUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = systemIsMemoryConstrainedUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
systemIsMemoryConstrainedUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
systemIsMemoryConstrainedUnderlyingCallsCount = newValue
}
}
}
}
open var systemIsMemoryConstrainedCalled: Bool {
return systemIsMemoryConstrainedCallsCount > 0
}
var systemIsMemoryConstrainedUnderlyingReturnValue: ClientBuilder!
open var systemIsMemoryConstrainedReturnValue: ClientBuilder! {
get {
if Thread.isMainThread {
return systemIsMemoryConstrainedUnderlyingReturnValue
} else {
var returnValue: ClientBuilder? = nil
DispatchQueue.main.sync {
returnValue = systemIsMemoryConstrainedUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
systemIsMemoryConstrainedUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
systemIsMemoryConstrainedUnderlyingReturnValue = newValue
}
}
}
}
open var systemIsMemoryConstrainedClosure: (() -> ClientBuilder)?
open override func systemIsMemoryConstrained() -> ClientBuilder {
systemIsMemoryConstrainedCallsCount += 1
if let systemIsMemoryConstrainedClosure = systemIsMemoryConstrainedClosure {
return systemIsMemoryConstrainedClosure()
} else {
return systemIsMemoryConstrainedReturnValue
}
}
//MARK: - useEventCachePersistentStorage //MARK: - useEventCachePersistentStorage
var useEventCachePersistentStorageValueUnderlyingCallsCount = 0 var useEventCachePersistentStorageValueUnderlyingCallsCount = 0
@@ -21531,16 +21596,16 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable {
//MARK: - sendReply //MARK: - sendReply
open var sendReplyMsgEventIdThrowableError: Error? open var sendReplyMsgReplyParamsThrowableError: Error?
var sendReplyMsgEventIdUnderlyingCallsCount = 0 var sendReplyMsgReplyParamsUnderlyingCallsCount = 0
open var sendReplyMsgEventIdCallsCount: Int { open var sendReplyMsgReplyParamsCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return sendReplyMsgEventIdUnderlyingCallsCount return sendReplyMsgReplyParamsUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = sendReplyMsgEventIdUnderlyingCallsCount returnValue = sendReplyMsgReplyParamsUnderlyingCallsCount
} }
return returnValue! return returnValue!
@@ -21548,77 +21613,31 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline, @unchecked Sendable {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
sendReplyMsgEventIdUnderlyingCallsCount = newValue sendReplyMsgReplyParamsUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
sendReplyMsgEventIdUnderlyingCallsCount = newValue sendReplyMsgReplyParamsUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var sendReplyMsgEventIdCalled: Bool { open var sendReplyMsgReplyParamsCalled: Bool {
return sendReplyMsgEventIdCallsCount > 0 return sendReplyMsgReplyParamsCallsCount > 0
} }
open var sendReplyMsgEventIdReceivedArguments: (msg: RoomMessageEventContentWithoutRelation, eventId: String)? open var sendReplyMsgReplyParamsReceivedArguments: (msg: RoomMessageEventContentWithoutRelation, replyParams: ReplyParameters)?
open var sendReplyMsgEventIdReceivedInvocations: [(msg: RoomMessageEventContentWithoutRelation, eventId: String)] = [] open var sendReplyMsgReplyParamsReceivedInvocations: [(msg: RoomMessageEventContentWithoutRelation, replyParams: ReplyParameters)] = []
open var sendReplyMsgEventIdClosure: ((RoomMessageEventContentWithoutRelation, String) async throws -> Void)? open var sendReplyMsgReplyParamsClosure: ((RoomMessageEventContentWithoutRelation, ReplyParameters) async throws -> Void)?
open override func sendReply(msg: RoomMessageEventContentWithoutRelation, eventId: String) async throws { open override func sendReply(msg: RoomMessageEventContentWithoutRelation, replyParams: ReplyParameters) async throws {
if let error = sendReplyMsgEventIdThrowableError { if let error = sendReplyMsgReplyParamsThrowableError {
throw error throw error
} }
sendReplyMsgEventIdCallsCount += 1 sendReplyMsgReplyParamsCallsCount += 1
sendReplyMsgEventIdReceivedArguments = (msg: msg, eventId: eventId) sendReplyMsgReplyParamsReceivedArguments = (msg: msg, replyParams: replyParams)
DispatchQueue.main.async { DispatchQueue.main.async {
self.sendReplyMsgEventIdReceivedInvocations.append((msg: msg, eventId: eventId)) self.sendReplyMsgReplyParamsReceivedInvocations.append((msg: msg, replyParams: replyParams))
} }
try await sendReplyMsgEventIdClosure?(msg, eventId) try await sendReplyMsgReplyParamsClosure?(msg, replyParams)
}
//MARK: - sendThreadReply
open var sendThreadReplyMsgEventIdIsReplyThrowableError: Error?
var sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount = 0
open var sendThreadReplyMsgEventIdIsReplyCallsCount: Int {
get {
if Thread.isMainThread {
return sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
sendThreadReplyMsgEventIdIsReplyUnderlyingCallsCount = newValue
}
}
}
}
open var sendThreadReplyMsgEventIdIsReplyCalled: Bool {
return sendThreadReplyMsgEventIdIsReplyCallsCount > 0
}
open var sendThreadReplyMsgEventIdIsReplyReceivedArguments: (msg: RoomMessageEventContentWithoutRelation, eventId: String, isReply: Bool)?
open var sendThreadReplyMsgEventIdIsReplyReceivedInvocations: [(msg: RoomMessageEventContentWithoutRelation, eventId: String, isReply: Bool)] = []
open var sendThreadReplyMsgEventIdIsReplyClosure: ((RoomMessageEventContentWithoutRelation, String, Bool) async throws -> Void)?
open override func sendThreadReply(msg: RoomMessageEventContentWithoutRelation, eventId: String, isReply: Bool) async throws {
if let error = sendThreadReplyMsgEventIdIsReplyThrowableError {
throw error
}
sendThreadReplyMsgEventIdIsReplyCallsCount += 1
sendThreadReplyMsgEventIdIsReplyReceivedArguments = (msg: msg, eventId: eventId, isReply: isReply)
DispatchQueue.main.async {
self.sendThreadReplyMsgEventIdIsReplyReceivedInvocations.append((msg: msg, eventId: eventId, isReply: isReply))
}
try await sendThreadReplyMsgEventIdIsReplyClosure?(msg, eventId, isReply)
} }
//MARK: - sendVideo //MARK: - sendVideo
@@ -16,7 +16,6 @@ struct OIDCConfigurationProxy {
let policyURI: URL let policyURI: URL
let contacts: [String] let contacts: [String]
let staticRegistrations: [String: String] let staticRegistrations: [String: String]
let dynamicRegistrationsFile: URL
} }
#if canImport(MatrixRustSDK) #if canImport(MatrixRustSDK)
@@ -31,8 +30,7 @@ extension OIDCConfigurationProxy {
tosUri: tosURI.absoluteString, tosUri: tosURI.absoluteString,
policyUri: policyURI.absoluteString, policyUri: policyURI.absoluteString,
contacts: contacts, contacts: contacts,
staticRegistrations: staticRegistrations, staticRegistrations: staticRegistrations)
dynamicRegistrationsFile: dynamicRegistrationsFile.path(percentEncoded: false))
} }
} }
#endif #endif
@@ -404,7 +404,11 @@ final class TimelineProxy: TimelineProxyProtocol {
do { do {
if let inReplyToEventID { if let inReplyToEventID {
try await timeline.sendReply(msg: messageContent, eventId: inReplyToEventID) // `enforceThread` will force send the message a thread with `inReplyToEventID` while
// `replyWithinThread` will create an in-reply-to associated field *within* that same thread
try await timeline.sendReply(msg: messageContent, replyParams: .init(eventId: inReplyToEventID,
enforceThread: false,
replyWithinThread: false))
MXLog.info("Finished sending reply to eventID: \(inReplyToEventID)") MXLog.info("Finished sending reply to eventID: \(inReplyToEventID)")
} else { } else {
_ = try await timeline.send(msg: messageContent) _ = try await timeline.send(msg: messageContent)
+1 -1
View File
@@ -59,7 +59,7 @@ packages:
# Element/Matrix dependencies # Element/Matrix dependencies
MatrixRustSDK: MatrixRustSDK:
url: https://github.com/element-hq/matrix-rust-components-swift url: https://github.com/element-hq/matrix-rust-components-swift
exactVersion: 25.04.02 exactVersion: 25.04.08
# path: ../matrix-rust-sdk # path: ../matrix-rust-sdk
Compound: Compound:
url: https://github.com/element-hq/compound-ios url: https://github.com/element-hq/compound-ios