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";
requirement = {
kind = exactVersion;
version = 1.0.42;
version = 1.0.43;
};
};
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
@@ -149,8 +149,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : {
"revision" : "ccae0615642728bbadcd051e4851d96ab298bab2",
"version" : "1.0.42"
"revision" : "4acde0099d719f9f176d0df3594efd3e34ffa431",
"version" : "1.0.43"
}
},
{
@@ -13854,8 +13854,8 @@ class TimelineProxyMock: TimelineProxyProtocol {
var toggleReactionToCalled: Bool {
return toggleReactionToCallsCount > 0
}
var toggleReactionToReceivedArguments: (reaction: String, eventID: String)?
var toggleReactionToReceivedInvocations: [(reaction: String, eventID: String)] = []
var toggleReactionToReceivedArguments: (reaction: String, itemID: TimelineItemIdentifier)?
var toggleReactionToReceivedInvocations: [(reaction: String, itemID: TimelineItemIdentifier)] = []
var toggleReactionToUnderlyingReturnValue: 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
toggleReactionToReceivedArguments = (reaction: reaction, eventID: eventID)
toggleReactionToReceivedArguments = (reaction: reaction, itemID: itemID)
DispatchQueue.main.async {
self.toggleReactionToReceivedInvocations.append((reaction: reaction, eventID: eventID))
self.toggleReactionToReceivedInvocations.append((reaction: reaction, itemID: itemID))
}
if let toggleReactionToClosure = toggleReactionToClosure {
return await toggleReactionToClosure(reaction, eventID)
return await toggleReactionToClosure(reaction, itemID)
} else {
return toggleReactionToReturnValue
}
@@ -9974,82 +9974,6 @@ open class NotificationSettingsSDKMock: MatrixRustSDK.NotificationSettings {
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 {
init() {
super.init(noPointer: .init())
@@ -20067,16 +19991,16 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline {
//MARK: - toggleReaction
open var toggleReactionEventIdKeyThrowableError: Error?
var toggleReactionEventIdKeyUnderlyingCallsCount = 0
open var toggleReactionEventIdKeyCallsCount: Int {
open var toggleReactionUniqueIdKeyThrowableError: Error?
var toggleReactionUniqueIdKeyUnderlyingCallsCount = 0
open var toggleReactionUniqueIdKeyCallsCount: Int {
get {
if Thread.isMainThread {
return toggleReactionEventIdKeyUnderlyingCallsCount
return toggleReactionUniqueIdKeyUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = toggleReactionEventIdKeyUnderlyingCallsCount
returnValue = toggleReactionUniqueIdKeyUnderlyingCallsCount
}
return returnValue!
@@ -20084,31 +20008,31 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline {
}
set {
if Thread.isMainThread {
toggleReactionEventIdKeyUnderlyingCallsCount = newValue
toggleReactionUniqueIdKeyUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
toggleReactionEventIdKeyUnderlyingCallsCount = newValue
toggleReactionUniqueIdKeyUnderlyingCallsCount = newValue
}
}
}
}
open var toggleReactionEventIdKeyCalled: Bool {
return toggleReactionEventIdKeyCallsCount > 0
open var toggleReactionUniqueIdKeyCalled: Bool {
return toggleReactionUniqueIdKeyCallsCount > 0
}
open var toggleReactionEventIdKeyReceivedArguments: (eventId: String, key: String)?
open var toggleReactionEventIdKeyReceivedInvocations: [(eventId: String, key: String)] = []
open var toggleReactionEventIdKeyClosure: ((String, String) async throws -> Void)?
open var toggleReactionUniqueIdKeyReceivedArguments: (uniqueId: String, key: String)?
open var toggleReactionUniqueIdKeyReceivedInvocations: [(uniqueId: String, key: String)] = []
open var toggleReactionUniqueIdKeyClosure: ((String, String) async throws -> Void)?
open override func toggleReaction(eventId: String, key: String) async throws {
if let error = toggleReactionEventIdKeyThrowableError {
open override func toggleReaction(uniqueId: String, key: String) async throws {
if let error = toggleReactionUniqueIdKeyThrowableError {
throw error
}
toggleReactionEventIdKeyCallsCount += 1
toggleReactionEventIdKeyReceivedArguments = (eventId: eventId, key: key)
toggleReactionUniqueIdKeyCallsCount += 1
toggleReactionUniqueIdKeyReceivedArguments = (uniqueId: uniqueId, key: key)
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
@@ -178,12 +178,8 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
func toggleReaction(_ reaction: String, to itemID: TimelineItemIdentifier) async {
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:
MXLog.info("Finished toggling reaction")
case .failure(let error):
@@ -430,15 +430,15 @@ final class TimelineProxy: TimelineProxyProtocol {
}
}
func toggleReaction(_ reaction: String, to eventID: String) async -> Result<Void, TimelineProxyError> {
MXLog.info("Toggling reaction for eventID: \(eventID)")
func toggleReaction(_ reaction: String, to itemID: TimelineItemIdentifier) async -> Result<Void, TimelineProxyError> {
MXLog.info("Toggling reaction for event: \(itemID)")
do {
try await timeline.toggleReaction(eventId: eventID, key: reaction)
MXLog.info("Finished toggling reaction for eventID: \(eventID)")
try await timeline.toggleReaction(uniqueId: itemID.timelineID, key: reaction)
MXLog.info("Finished toggling reaction for event: \(itemID)")
return .success(())
} catch {
MXLog.error("Failed toggling reaction for eventID: \(eventID)")
MXLog.error("Failed toggling reaction for event: \(itemID)")
return .failure(.sdkError(error))
}
}
@@ -101,7 +101,7 @@ protocol TimelineProxyProtocol {
inReplyTo eventID: String?,
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
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
MatrixRustSDK:
url: https://github.com/element-hq/matrix-rust-components-swift
exactVersion: 1.0.42
exactVersion: 1.0.43
# path: ../matrix-rust-sdk
Compound:
url: https://github.com/element-hq/compound-ios