Skip to content

Commit

Permalink
Sdk v1.0.47 (#3265)
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 authored Sep 11, 2024
1 parent b85bd60 commit 0d9d8f9
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 140 deletions.
2 changes: 1 addition & 1 deletion ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7691,7 +7691,7 @@
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
requirement = {
kind = exactVersion;
version = 1.0.46;
version = 1.0.47;
};
};
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : {
"revision" : "50f8730000a1cc9ebe75ecf879c2b85b36adfd34",
"version" : "1.0.46"
"revision" : "5de28d48e35bcb19ba94bf1cbc7baec41281a54a",
"version" : "1.0.47"
}
},
{
Expand Down
130 changes: 4 additions & 126 deletions ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -18686,8 +18610,8 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline {
open var editItemNewContentCalled: Bool {
return editItemNewContentCallsCount > 0
}
open var editItemNewContentReceivedArguments: (item: EventTimelineItem, newContent: RoomMessageEventContentWithoutRelation)?
open var editItemNewContentReceivedInvocations: [(item: EventTimelineItem, newContent: RoomMessageEventContentWithoutRelation)] = []
open var editItemNewContentReceivedArguments: (item: EventTimelineItem, newContent: EditedContent)?
open var editItemNewContentReceivedInvocations: [(item: EventTimelineItem, newContent: EditedContent)] = []

var editItemNewContentUnderlyingReturnValue: Bool!
open var editItemNewContentReturnValue: Bool! {
Expand All @@ -18713,9 +18637,9 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline {
}
}
}
open var editItemNewContentClosure: ((EventTimelineItem, RoomMessageEventContentWithoutRelation) async throws -> Bool)?
open var editItemNewContentClosure: ((EventTimelineItem, EditedContent) async throws -> Bool)?

open override func edit(item: EventTimelineItem, newContent: RoomMessageEventContentWithoutRelation) async throws -> Bool {
open override func edit(item: EventTimelineItem, newContent: EditedContent) async throws -> Bool {
if let error = editItemNewContentThrowableError {
throw error
}
Expand All @@ -18731,52 +18655,6 @@ open class TimelineSDKMock: MatrixRustSDK.Timeline {
}
}

//MARK: - editPoll

open var editPollQuestionAnswersMaxSelectionsPollKindEditItemThrowableError: Error?
var editPollQuestionAnswersMaxSelectionsPollKindEditItemUnderlyingCallsCount = 0
open var editPollQuestionAnswersMaxSelectionsPollKindEditItemCallsCount: Int {
get {
if Thread.isMainThread {
return editPollQuestionAnswersMaxSelectionsPollKindEditItemUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = editPollQuestionAnswersMaxSelectionsPollKindEditItemUnderlyingCallsCount
}

return returnValue!
}
}
set {
if Thread.isMainThread {
editPollQuestionAnswersMaxSelectionsPollKindEditItemUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
editPollQuestionAnswersMaxSelectionsPollKindEditItemUnderlyingCallsCount = newValue
}
}
}
}
open var editPollQuestionAnswersMaxSelectionsPollKindEditItemCalled: Bool {
return editPollQuestionAnswersMaxSelectionsPollKindEditItemCallsCount > 0
}
open var editPollQuestionAnswersMaxSelectionsPollKindEditItemReceivedArguments: (question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind, editItem: EventTimelineItem)?
open var editPollQuestionAnswersMaxSelectionsPollKindEditItemReceivedInvocations: [(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind, editItem: EventTimelineItem)] = []
open var editPollQuestionAnswersMaxSelectionsPollKindEditItemClosure: ((String, [String], UInt8, PollKind, EventTimelineItem) async throws -> Void)?

open override func editPoll(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind, editItem: EventTimelineItem) async throws {
if let error = editPollQuestionAnswersMaxSelectionsPollKindEditItemThrowableError {
throw error
}
editPollQuestionAnswersMaxSelectionsPollKindEditItemCallsCount += 1
editPollQuestionAnswersMaxSelectionsPollKindEditItemReceivedArguments = (question: question, answers: answers, maxSelections: maxSelections, pollKind: pollKind, editItem: editItem)
DispatchQueue.main.async {
self.editPollQuestionAnswersMaxSelectionsPollKindEditItemReceivedInvocations.append((question: question, answers: answers, maxSelections: maxSelections, pollKind: pollKind, editItem: editItem))
}
try await editPollQuestionAnswersMaxSelectionsPollKindEditItemClosure?(question, answers, maxSelections, pollKind, editItem)
}

//MARK: - endPoll

open var endPollPollStartIdTextThrowableError: Error?
Expand Down
10 changes: 8 additions & 2 deletions ElementX/Sources/Services/Timeline/TimelineProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ final class TimelineProxy: TimelineProxyProtocol {

func edit(_ timelineItem: EventTimelineItem, newContent: RoomMessageEventContentWithoutRelation) async -> Result<Void, TimelineProxyError> {
do {
guard try await timeline.edit(item: timelineItem, newContent: newContent) == true else {
guard try await timeline.edit(item: timelineItem, newContent: .roomMessage(content: newContent)) == true else {
return .failure(.failedEditing)
}

Expand Down Expand Up @@ -460,7 +460,13 @@ final class TimelineProxy: TimelineProxyProtocol {
do {
let originalEvent = try await timeline.getEventTimelineItemByEventId(eventId: eventID)

try await timeline.editPoll(question: question, answers: answers, maxSelections: 1, pollKind: .init(pollKind: pollKind), editItem: originalEvent)
guard try await timeline.edit(item: originalEvent,
newContent: .pollStart(pollData: .init(question: question,
answers: answers,
maxSelections: 1,
pollKind: .init(pollKind: pollKind)))) else {
return .failure(.failedEditing)
}

MXLog.info("Finished editing poll with eventID: \(eventID)")

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ packages:
# Element/Matrix dependencies
MatrixRustSDK:
url: https://github.com/element-hq/matrix-rust-components-swift
exactVersion: 1.0.46
exactVersion: 1.0.47
# path: ../matrix-rust-sdk
Compound:
url: https://github.com/element-hq/compound-ios
Expand Down

0 comments on commit 0d9d8f9

Please sign in to comment.