Update the SDK.

This commit is contained in:
Doug
2024-08-29 14:39:49 +01:00
committed by Stefan Ceriu
parent 4925884f6c
commit 342ad57ce7
8 changed files with 37 additions and 117 deletions
+1 -1
View File
@@ -7683,7 +7683,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 = 1.0.42; version = 1.0.43;
}; };
}; };
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
@@ -149,8 +149,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" : "ccae0615642728bbadcd051e4851d96ab298bab2", "revision" : "4acde0099d719f9f176d0df3594efd3e34ffa431",
"version" : "1.0.42" "version" : "1.0.43"
} }
}, },
{ {
@@ -13854,8 +13854,8 @@ class TimelineProxyMock: TimelineProxyProtocol {
var toggleReactionToCalled: Bool { var toggleReactionToCalled: Bool {
return toggleReactionToCallsCount > 0 return toggleReactionToCallsCount > 0
} }
var toggleReactionToReceivedArguments: (reaction: String, eventID: String)? var toggleReactionToReceivedArguments: (reaction: String, itemID: TimelineItemIdentifier)?
var toggleReactionToReceivedInvocations: [(reaction: String, eventID: String)] = [] var toggleReactionToReceivedInvocations: [(reaction: String, itemID: TimelineItemIdentifier)] = []
var toggleReactionToUnderlyingReturnValue: Result<Void, TimelineProxyError>! var toggleReactionToUnderlyingReturnValue: Result<Void, TimelineProxyError>!
var toggleReactionToReturnValue: Result<Void, TimelineProxyError>! { var toggleReactionToReturnValue: Result<Void, TimelineProxyError>! {
@@ -13881,16 +13881,16 @@ class TimelineProxyMock: TimelineProxyProtocol {
} }
} }
} }
var toggleReactionToClosure: ((String, String) async -> Result<Void, TimelineProxyError>)? var toggleReactionToClosure: ((String, TimelineItemIdentifier) async -> Result<Void, TimelineProxyError>)?
func toggleReaction(_ reaction: String, to eventID: String) async -> Result<Void, TimelineProxyError> { func toggleReaction(_ reaction: String, to itemID: TimelineItemIdentifier) async -> Result<Void, TimelineProxyError> {
toggleReactionToCallsCount += 1 toggleReactionToCallsCount += 1
toggleReactionToReceivedArguments = (reaction: reaction, eventID: eventID) toggleReactionToReceivedArguments = (reaction: reaction, itemID: itemID)
DispatchQueue.main.async { DispatchQueue.main.async {
self.toggleReactionToReceivedInvocations.append((reaction: reaction, eventID: eventID)) self.toggleReactionToReceivedInvocations.append((reaction: reaction, itemID: itemID))
} }
if let toggleReactionToClosure = toggleReactionToClosure { if let toggleReactionToClosure = toggleReactionToClosure {
return await toggleReactionToClosure(reaction, eventID) return await toggleReactionToClosure(reaction, itemID)
} else { } else {
return toggleReactionToReturnValue return toggleReactionToReturnValue
} }
@@ -9974,82 +9974,6 @@ open class NotificationSettingsSDKMock: MatrixRustSDK.NotificationSettings {
try await unmuteRoomRoomIdIsEncryptedIsOneToOneClosure?(roomId, isEncrypted, isOneToOne) try await unmuteRoomRoomIdIsEncryptedIsOneToOneClosure?(roomId, isEncrypted, isOneToOne)
} }
} }
open class OidcAuthorizationDataSDKMock: MatrixRustSDK.OidcAuthorizationData {
init() {
super.init(noPointer: .init())
}
public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
fatalError("init(unsafeFromRawPointer:) has not been implemented")
}
fileprivate var pointer: UnsafeMutableRawPointer!
//MARK: - loginUrl
var loginUrlUnderlyingCallsCount = 0
open var loginUrlCallsCount: Int {
get {
if Thread.isMainThread {
return loginUrlUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = loginUrlUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
loginUrlUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
loginUrlUnderlyingCallsCount = newValue
}
}
}
}
open var loginUrlCalled: Bool {
return loginUrlCallsCount > 0
}
var loginUrlUnderlyingReturnValue: String!
open var loginUrlReturnValue: String! {
get {
if Thread.isMainThread {
return loginUrlUnderlyingReturnValue
} else {
var returnValue: String? = nil
DispatchQueue.main.sync {
returnValue = loginUrlUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
loginUrlUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
loginUrlUnderlyingReturnValue = newValue
}
}
}
}
open var loginUrlClosure: (() -> String)?
open override func loginUrl() -> String {
loginUrlCallsCount += 1
if let loginUrlClosure = loginUrlClosure {
return loginUrlClosure()
} else {
return loginUrlReturnValue
}
}
}
open class QrCodeDataSDKMock: MatrixRustSDK.QrCodeData { open class QrCodeDataSDKMock: MatrixRustSDK.QrCodeData {
init() { init() {
super.init(noPointer: .init()) super.init(noPointer: .init())
@@ -20067,16 +19991,16 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline {
//MARK: - toggleReaction //MARK: - toggleReaction
open var toggleReactionEventIdKeyThrowableError: Error? open var toggleReactionUniqueIdKeyThrowableError: Error?
var toggleReactionEventIdKeyUnderlyingCallsCount = 0 var toggleReactionUniqueIdKeyUnderlyingCallsCount = 0
open var toggleReactionEventIdKeyCallsCount: Int { open var toggleReactionUniqueIdKeyCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return toggleReactionEventIdKeyUnderlyingCallsCount return toggleReactionUniqueIdKeyUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = toggleReactionEventIdKeyUnderlyingCallsCount returnValue = toggleReactionUniqueIdKeyUnderlyingCallsCount
} }
return returnValue! return returnValue!
@@ -20084,31 +20008,31 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
toggleReactionEventIdKeyUnderlyingCallsCount = newValue toggleReactionUniqueIdKeyUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
toggleReactionEventIdKeyUnderlyingCallsCount = newValue toggleReactionUniqueIdKeyUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var toggleReactionEventIdKeyCalled: Bool { open var toggleReactionUniqueIdKeyCalled: Bool {
return toggleReactionEventIdKeyCallsCount > 0 return toggleReactionUniqueIdKeyCallsCount > 0
} }
open var toggleReactionEventIdKeyReceivedArguments: (eventId: String, key: String)? open var toggleReactionUniqueIdKeyReceivedArguments: (uniqueId: String, key: String)?
open var toggleReactionEventIdKeyReceivedInvocations: [(eventId: String, key: String)] = [] open var toggleReactionUniqueIdKeyReceivedInvocations: [(uniqueId: String, key: String)] = []
open var toggleReactionEventIdKeyClosure: ((String, String) async throws -> Void)? open var toggleReactionUniqueIdKeyClosure: ((String, String) async throws -> Void)?
open override func toggleReaction(eventId: String, key: String) async throws { open override func toggleReaction(uniqueId: String, key: String) async throws {
if let error = toggleReactionEventIdKeyThrowableError { if let error = toggleReactionUniqueIdKeyThrowableError {
throw error throw error
} }
toggleReactionEventIdKeyCallsCount += 1 toggleReactionUniqueIdKeyCallsCount += 1
toggleReactionEventIdKeyReceivedArguments = (eventId: eventId, key: key) toggleReactionUniqueIdKeyReceivedArguments = (uniqueId: uniqueId, key: key)
DispatchQueue.main.async { DispatchQueue.main.async {
self.toggleReactionEventIdKeyReceivedInvocations.append((eventId: eventId, key: key)) self.toggleReactionUniqueIdKeyReceivedInvocations.append((uniqueId: uniqueId, key: key))
} }
try await toggleReactionEventIdKeyClosure?(eventId, key) try await toggleReactionUniqueIdKeyClosure?(uniqueId, key)
} }
//MARK: - unpinEvent //MARK: - unpinEvent
@@ -178,12 +178,8 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
func toggleReaction(_ reaction: String, to itemID: TimelineItemIdentifier) async { func toggleReaction(_ reaction: String, to itemID: TimelineItemIdentifier) async {
MXLog.info("Toggle reaction in \(roomID)") MXLog.info("Toggle reaction in \(roomID)")
guard let eventID = itemID.eventID else {
MXLog.error("Failed toggling reaction: missing eventID")
return
}
switch await activeTimeline.toggleReaction(reaction, to: eventID) { switch await activeTimeline.toggleReaction(reaction, to: itemID) {
case .success: case .success:
MXLog.info("Finished toggling reaction") MXLog.info("Finished toggling reaction")
case .failure(let error): case .failure(let error):
@@ -430,15 +430,15 @@ final class TimelineProxy: TimelineProxyProtocol {
} }
} }
func toggleReaction(_ reaction: String, to eventID: String) async -> Result<Void, TimelineProxyError> { func toggleReaction(_ reaction: String, to itemID: TimelineItemIdentifier) async -> Result<Void, TimelineProxyError> {
MXLog.info("Toggling reaction for eventID: \(eventID)") MXLog.info("Toggling reaction for event: \(itemID)")
do { do {
try await timeline.toggleReaction(eventId: eventID, key: reaction) try await timeline.toggleReaction(uniqueId: itemID.timelineID, key: reaction)
MXLog.info("Finished toggling reaction for eventID: \(eventID)") MXLog.info("Finished toggling reaction for event: \(itemID)")
return .success(()) return .success(())
} catch { } catch {
MXLog.error("Failed toggling reaction for eventID: \(eventID)") MXLog.error("Failed toggling reaction for event: \(itemID)")
return .failure(.sdkError(error)) return .failure(.sdkError(error))
} }
} }
@@ -101,7 +101,7 @@ protocol TimelineProxyProtocol {
inReplyTo eventID: String?, inReplyTo eventID: String?,
intentionalMentions: IntentionalMentions) async -> Result<Void, TimelineProxyError> intentionalMentions: IntentionalMentions) async -> Result<Void, TimelineProxyError>
func toggleReaction(_ reaction: String, to eventID: String) async -> Result<Void, TimelineProxyError> func toggleReaction(_ reaction: String, to itemID: TimelineItemIdentifier) async -> Result<Void, TimelineProxyError>
// Polls // Polls
func createPoll(question: String, answers: [String], pollKind: Poll.Kind) async -> Result<Void, TimelineProxyError> func createPoll(question: String, answers: [String], pollKind: Poll.Kind) async -> Result<Void, TimelineProxyError>
+1 -1
View File
@@ -60,7 +60,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: 1.0.42 exactVersion: 1.0.43
# 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