Bump the RustSDK to v1.0.67 (#3512)

* Bump the RustSDK to v1.0.67

* PR comments

---------

Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
Stefan Ceriu 2024-11-13 20:03:30 +02:00 committed by GitHub
parent 03cb50e6e3
commit 79473ef2e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 499 additions and 359 deletions

View File

@ -8109,7 +8109,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.66; version = 1.0.67;
}; };
}; };
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {

View File

@ -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" : "902979581ff4f35e54a83cd7c5c340745d6f0d0e", "revision" : "5f23a9b8e210aa9962b420bcd7065d5f9cf142c9",
"version" : "1.0.66" "version" : "1.0.67"
} }
}, },
{ {

View File

@ -556,8 +556,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case (.roomMemberDetails, .dismissUserProfile, .roomDetails): case (.roomMemberDetails, .dismissUserProfile, .roomDetails):
break break
case (.room, .presentResolveSendFailure(let failure, let itemID), .resolveSendFailure): case (.room, .presentResolveSendFailure(let failure, let sendHandle), .resolveSendFailure):
presentResolveSendFailure(failure: failure, itemID: itemID) presentResolveSendFailure(failure: failure, sendHandle: sendHandle)
case (.resolveSendFailure, .dismissResolveSendFailure, .room): case (.resolveSendFailure, .dismissResolveSendFailure, .room):
break break
@ -691,8 +691,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
actionsSubject.send(.presentCallScreen(roomProxy: roomProxy)) actionsSubject.send(.presentCallScreen(roomProxy: roomProxy))
case .presentPinnedEventsTimeline: case .presentPinnedEventsTimeline:
stateMachine.tryEvent(.presentPinnedEventsTimeline) stateMachine.tryEvent(.presentPinnedEventsTimeline)
case .presentResolveSendFailure(failure: let failure, itemID: let itemID): case .presentResolveSendFailure(failure: let failure, sendHandle: let sendHandle):
stateMachine.tryEvent(.presentResolveSendFailure(failure: failure, itemID: itemID)) stateMachine.tryEvent(.presentResolveSendFailure(failure: failure, sendHandle: sendHandle))
} }
} }
.store(in: &cancellables) .store(in: &cancellables)
@ -1438,9 +1438,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
coordinator.start() coordinator.start()
} }
private func presentResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, itemID: TimelineItemIdentifier) { private func presentResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, sendHandle: SendHandleProxy) {
let coordinator = ResolveVerifiedUserSendFailureScreenCoordinator(parameters: .init(failure: failure, let coordinator = ResolveVerifiedUserSendFailureScreenCoordinator(parameters: .init(failure: failure,
itemID: itemID, sendHandle: sendHandle,
roomProxy: roomProxy, roomProxy: roomProxy,
userIndicatorController: userIndicatorController)) userIndicatorController: userIndicatorController))
coordinator.actionsPublisher.sink { [weak self] action in coordinator.actionsPublisher.sink { [weak self] action in
@ -1607,7 +1607,7 @@ private extension RoomFlowCoordinator {
case presentPinnedEventsTimeline case presentPinnedEventsTimeline
case dismissPinnedEventsTimeline case dismissPinnedEventsTimeline
case presentResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, itemID: TimelineItemIdentifier) case presentResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, sendHandle: SendHandleProxy)
case dismissResolveSendFailure case dismissResolveSendFailure
// Child room flow events // Child room flow events

View File

@ -7039,87 +7039,17 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
return sendTypingNotificationIsTypingReturnValue return sendTypingNotificationIsTypingReturnValue
} }
} }
//MARK: - resend
var resendItemIDUnderlyingCallsCount = 0
var resendItemIDCallsCount: Int {
get {
if Thread.isMainThread {
return resendItemIDUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = resendItemIDUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
resendItemIDUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
resendItemIDUnderlyingCallsCount = newValue
}
}
}
}
var resendItemIDCalled: Bool {
return resendItemIDCallsCount > 0
}
var resendItemIDReceivedItemID: TimelineItemIdentifier?
var resendItemIDReceivedInvocations: [TimelineItemIdentifier] = []
var resendItemIDUnderlyingReturnValue: Result<Void, RoomProxyError>!
var resendItemIDReturnValue: Result<Void, RoomProxyError>! {
get {
if Thread.isMainThread {
return resendItemIDUnderlyingReturnValue
} else {
var returnValue: Result<Void, RoomProxyError>? = nil
DispatchQueue.main.sync {
returnValue = resendItemIDUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
resendItemIDUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
resendItemIDUnderlyingReturnValue = newValue
}
}
}
}
var resendItemIDClosure: ((TimelineItemIdentifier) async -> Result<Void, RoomProxyError>)?
func resend(itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError> {
resendItemIDCallsCount += 1
resendItemIDReceivedItemID = itemID
DispatchQueue.main.async {
self.resendItemIDReceivedInvocations.append(itemID)
}
if let resendItemIDClosure = resendItemIDClosure {
return await resendItemIDClosure(itemID)
} else {
return resendItemIDReturnValue
}
}
//MARK: - ignoreDeviceTrustAndResend //MARK: - ignoreDeviceTrustAndResend
var ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount = 0 var ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = 0
var ignoreDeviceTrustAndResendDevicesItemIDCallsCount: Int { var ignoreDeviceTrustAndResendDevicesSendHandleCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount return ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount returnValue = ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -7127,29 +7057,29 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount = newValue ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount = newValue ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = newValue
} }
} }
} }
} }
var ignoreDeviceTrustAndResendDevicesItemIDCalled: Bool { var ignoreDeviceTrustAndResendDevicesSendHandleCalled: Bool {
return ignoreDeviceTrustAndResendDevicesItemIDCallsCount > 0 return ignoreDeviceTrustAndResendDevicesSendHandleCallsCount > 0
} }
var ignoreDeviceTrustAndResendDevicesItemIDReceivedArguments: (devices: [String: [String]], itemID: TimelineItemIdentifier)? var ignoreDeviceTrustAndResendDevicesSendHandleReceivedArguments: (devices: [String: [String]], sendHandle: SendHandleProxy)?
var ignoreDeviceTrustAndResendDevicesItemIDReceivedInvocations: [(devices: [String: [String]], itemID: TimelineItemIdentifier)] = [] var ignoreDeviceTrustAndResendDevicesSendHandleReceivedInvocations: [(devices: [String: [String]], sendHandle: SendHandleProxy)] = []
var ignoreDeviceTrustAndResendDevicesItemIDUnderlyingReturnValue: Result<Void, RoomProxyError>! var ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingReturnValue: Result<Void, RoomProxyError>!
var ignoreDeviceTrustAndResendDevicesItemIDReturnValue: Result<Void, RoomProxyError>! { var ignoreDeviceTrustAndResendDevicesSendHandleReturnValue: Result<Void, RoomProxyError>! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return ignoreDeviceTrustAndResendDevicesItemIDUnderlyingReturnValue return ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingReturnValue
} else { } else {
var returnValue: Result<Void, RoomProxyError>? = nil var returnValue: Result<Void, RoomProxyError>? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = ignoreDeviceTrustAndResendDevicesItemIDUnderlyingReturnValue returnValue = ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingReturnValue
} }
return returnValue! return returnValue!
@ -7157,39 +7087,39 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
ignoreDeviceTrustAndResendDevicesItemIDUnderlyingReturnValue = newValue ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
ignoreDeviceTrustAndResendDevicesItemIDUnderlyingReturnValue = newValue ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingReturnValue = newValue
} }
} }
} }
} }
var ignoreDeviceTrustAndResendDevicesItemIDClosure: (([String: [String]], TimelineItemIdentifier) async -> Result<Void, RoomProxyError>)? var ignoreDeviceTrustAndResendDevicesSendHandleClosure: (([String: [String]], SendHandleProxy) async -> Result<Void, RoomProxyError>)?
func ignoreDeviceTrustAndResend(devices: [String: [String]], itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError> { func ignoreDeviceTrustAndResend(devices: [String: [String]], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError> {
ignoreDeviceTrustAndResendDevicesItemIDCallsCount += 1 ignoreDeviceTrustAndResendDevicesSendHandleCallsCount += 1
ignoreDeviceTrustAndResendDevicesItemIDReceivedArguments = (devices: devices, itemID: itemID) ignoreDeviceTrustAndResendDevicesSendHandleReceivedArguments = (devices: devices, sendHandle: sendHandle)
DispatchQueue.main.async { DispatchQueue.main.async {
self.ignoreDeviceTrustAndResendDevicesItemIDReceivedInvocations.append((devices: devices, itemID: itemID)) self.ignoreDeviceTrustAndResendDevicesSendHandleReceivedInvocations.append((devices: devices, sendHandle: sendHandle))
} }
if let ignoreDeviceTrustAndResendDevicesItemIDClosure = ignoreDeviceTrustAndResendDevicesItemIDClosure { if let ignoreDeviceTrustAndResendDevicesSendHandleClosure = ignoreDeviceTrustAndResendDevicesSendHandleClosure {
return await ignoreDeviceTrustAndResendDevicesItemIDClosure(devices, itemID) return await ignoreDeviceTrustAndResendDevicesSendHandleClosure(devices, sendHandle)
} else { } else {
return ignoreDeviceTrustAndResendDevicesItemIDReturnValue return ignoreDeviceTrustAndResendDevicesSendHandleReturnValue
} }
} }
//MARK: - withdrawVerificationAndResend //MARK: - withdrawVerificationAndResend
var withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount = 0 var withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount = 0
var withdrawVerificationAndResendUserIDsItemIDCallsCount: Int { var withdrawVerificationAndResendUserIDsSendHandleCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount return withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount returnValue = withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -7197,29 +7127,29 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount = newValue withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount = newValue withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount = newValue
} }
} }
} }
} }
var withdrawVerificationAndResendUserIDsItemIDCalled: Bool { var withdrawVerificationAndResendUserIDsSendHandleCalled: Bool {
return withdrawVerificationAndResendUserIDsItemIDCallsCount > 0 return withdrawVerificationAndResendUserIDsSendHandleCallsCount > 0
} }
var withdrawVerificationAndResendUserIDsItemIDReceivedArguments: (userIDs: [String], itemID: TimelineItemIdentifier)? var withdrawVerificationAndResendUserIDsSendHandleReceivedArguments: (userIDs: [String], sendHandle: SendHandleProxy)?
var withdrawVerificationAndResendUserIDsItemIDReceivedInvocations: [(userIDs: [String], itemID: TimelineItemIdentifier)] = [] var withdrawVerificationAndResendUserIDsSendHandleReceivedInvocations: [(userIDs: [String], sendHandle: SendHandleProxy)] = []
var withdrawVerificationAndResendUserIDsItemIDUnderlyingReturnValue: Result<Void, RoomProxyError>! var withdrawVerificationAndResendUserIDsSendHandleUnderlyingReturnValue: Result<Void, RoomProxyError>!
var withdrawVerificationAndResendUserIDsItemIDReturnValue: Result<Void, RoomProxyError>! { var withdrawVerificationAndResendUserIDsSendHandleReturnValue: Result<Void, RoomProxyError>! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return withdrawVerificationAndResendUserIDsItemIDUnderlyingReturnValue return withdrawVerificationAndResendUserIDsSendHandleUnderlyingReturnValue
} else { } else {
var returnValue: Result<Void, RoomProxyError>? = nil var returnValue: Result<Void, RoomProxyError>? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = withdrawVerificationAndResendUserIDsItemIDUnderlyingReturnValue returnValue = withdrawVerificationAndResendUserIDsSendHandleUnderlyingReturnValue
} }
return returnValue! return returnValue!
@ -7227,26 +7157,26 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
withdrawVerificationAndResendUserIDsItemIDUnderlyingReturnValue = newValue withdrawVerificationAndResendUserIDsSendHandleUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
withdrawVerificationAndResendUserIDsItemIDUnderlyingReturnValue = newValue withdrawVerificationAndResendUserIDsSendHandleUnderlyingReturnValue = newValue
} }
} }
} }
} }
var withdrawVerificationAndResendUserIDsItemIDClosure: (([String], TimelineItemIdentifier) async -> Result<Void, RoomProxyError>)? var withdrawVerificationAndResendUserIDsSendHandleClosure: (([String], SendHandleProxy) async -> Result<Void, RoomProxyError>)?
func withdrawVerificationAndResend(userIDs: [String], itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError> { func withdrawVerificationAndResend(userIDs: [String], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError> {
withdrawVerificationAndResendUserIDsItemIDCallsCount += 1 withdrawVerificationAndResendUserIDsSendHandleCallsCount += 1
withdrawVerificationAndResendUserIDsItemIDReceivedArguments = (userIDs: userIDs, itemID: itemID) withdrawVerificationAndResendUserIDsSendHandleReceivedArguments = (userIDs: userIDs, sendHandle: sendHandle)
DispatchQueue.main.async { DispatchQueue.main.async {
self.withdrawVerificationAndResendUserIDsItemIDReceivedInvocations.append((userIDs: userIDs, itemID: itemID)) self.withdrawVerificationAndResendUserIDsSendHandleReceivedInvocations.append((userIDs: userIDs, sendHandle: sendHandle))
} }
if let withdrawVerificationAndResendUserIDsItemIDClosure = withdrawVerificationAndResendUserIDsItemIDClosure { if let withdrawVerificationAndResendUserIDsSendHandleClosure = withdrawVerificationAndResendUserIDsSendHandleClosure {
return await withdrawVerificationAndResendUserIDsItemIDClosure(userIDs, itemID) return await withdrawVerificationAndResendUserIDsSendHandleClosure(userIDs, sendHandle)
} else { } else {
return withdrawVerificationAndResendUserIDsItemIDReturnValue return withdrawVerificationAndResendUserIDsSendHandleReturnValue
} }
} }
//MARK: - flagAsUnread //MARK: - flagAsUnread

View File

@ -625,6 +625,52 @@ open class ClientSDKMock: MatrixRustSDK.Client {
} }
} }
//MARK: - createRoomAlias
open var createRoomAliasRoomAliasRoomIdThrowableError: Error?
var createRoomAliasRoomAliasRoomIdUnderlyingCallsCount = 0
open var createRoomAliasRoomAliasRoomIdCallsCount: Int {
get {
if Thread.isMainThread {
return createRoomAliasRoomAliasRoomIdUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = createRoomAliasRoomAliasRoomIdUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
createRoomAliasRoomAliasRoomIdUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
createRoomAliasRoomAliasRoomIdUnderlyingCallsCount = newValue
}
}
}
}
open var createRoomAliasRoomAliasRoomIdCalled: Bool {
return createRoomAliasRoomAliasRoomIdCallsCount > 0
}
open var createRoomAliasRoomAliasRoomIdReceivedArguments: (roomAlias: String, roomId: String)?
open var createRoomAliasRoomAliasRoomIdReceivedInvocations: [(roomAlias: String, roomId: String)] = []
open var createRoomAliasRoomAliasRoomIdClosure: ((String, String) async throws -> Void)?
open override func createRoomAlias(roomAlias: String, roomId: String) async throws {
if let error = createRoomAliasRoomAliasRoomIdThrowableError {
throw error
}
createRoomAliasRoomAliasRoomIdCallsCount += 1
createRoomAliasRoomAliasRoomIdReceivedArguments = (roomAlias: roomAlias, roomId: roomId)
DispatchQueue.main.async {
self.createRoomAliasRoomAliasRoomIdReceivedInvocations.append((roomAlias: roomAlias, roomId: roomId))
}
try await createRoomAliasRoomAliasRoomIdClosure?(roomAlias, roomId)
}
//MARK: - customLoginWithJwt //MARK: - customLoginWithJwt
open var customLoginWithJwtJwtInitialDeviceNameDeviceIdThrowableError: Error? open var customLoginWithJwtJwtInitialDeviceNameDeviceIdThrowableError: Error?
@ -4674,6 +4720,77 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder {
} }
} }
//MARK: - crossProcessStoreLocksHolderName
var crossProcessStoreLocksHolderNameHolderNameUnderlyingCallsCount = 0
open var crossProcessStoreLocksHolderNameHolderNameCallsCount: Int {
get {
if Thread.isMainThread {
return crossProcessStoreLocksHolderNameHolderNameUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = crossProcessStoreLocksHolderNameHolderNameUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
crossProcessStoreLocksHolderNameHolderNameUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
crossProcessStoreLocksHolderNameHolderNameUnderlyingCallsCount = newValue
}
}
}
}
open var crossProcessStoreLocksHolderNameHolderNameCalled: Bool {
return crossProcessStoreLocksHolderNameHolderNameCallsCount > 0
}
open var crossProcessStoreLocksHolderNameHolderNameReceivedHolderName: String?
open var crossProcessStoreLocksHolderNameHolderNameReceivedInvocations: [String] = []
var crossProcessStoreLocksHolderNameHolderNameUnderlyingReturnValue: ClientBuilder!
open var crossProcessStoreLocksHolderNameHolderNameReturnValue: ClientBuilder! {
get {
if Thread.isMainThread {
return crossProcessStoreLocksHolderNameHolderNameUnderlyingReturnValue
} else {
var returnValue: ClientBuilder? = nil
DispatchQueue.main.sync {
returnValue = crossProcessStoreLocksHolderNameHolderNameUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
crossProcessStoreLocksHolderNameHolderNameUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
crossProcessStoreLocksHolderNameHolderNameUnderlyingReturnValue = newValue
}
}
}
}
open var crossProcessStoreLocksHolderNameHolderNameClosure: ((String) -> ClientBuilder)?
open override func crossProcessStoreLocksHolderName(holderName: String) -> ClientBuilder {
crossProcessStoreLocksHolderNameHolderNameCallsCount += 1
crossProcessStoreLocksHolderNameHolderNameReceivedHolderName = holderName
DispatchQueue.main.async {
self.crossProcessStoreLocksHolderNameHolderNameReceivedInvocations.append(holderName)
}
if let crossProcessStoreLocksHolderNameHolderNameClosure = crossProcessStoreLocksHolderNameHolderNameClosure {
return crossProcessStoreLocksHolderNameHolderNameClosure(holderName)
} else {
return crossProcessStoreLocksHolderNameHolderNameReturnValue
}
}
//MARK: - disableAutomaticTokenRefresh //MARK: - disableAutomaticTokenRefresh
var disableAutomaticTokenRefreshUnderlyingCallsCount = 0 var disableAutomaticTokenRefreshUnderlyingCallsCount = 0
@ -4869,17 +4986,17 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder {
} }
} }
//MARK: - enableCrossProcessRefreshLock //MARK: - enableOidcRefreshLock
var enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount = 0 var enableOidcRefreshLockUnderlyingCallsCount = 0
open var enableCrossProcessRefreshLockProcessIdSessionDelegateCallsCount: Int { open var enableOidcRefreshLockCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount return enableOidcRefreshLockUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount returnValue = enableOidcRefreshLockUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -4887,29 +5004,27 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount = newValue enableOidcRefreshLockUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount = newValue enableOidcRefreshLockUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var enableCrossProcessRefreshLockProcessIdSessionDelegateCalled: Bool { open var enableOidcRefreshLockCalled: Bool {
return enableCrossProcessRefreshLockProcessIdSessionDelegateCallsCount > 0 return enableOidcRefreshLockCallsCount > 0
} }
open var enableCrossProcessRefreshLockProcessIdSessionDelegateReceivedArguments: (processId: String, sessionDelegate: ClientSessionDelegate)?
open var enableCrossProcessRefreshLockProcessIdSessionDelegateReceivedInvocations: [(processId: String, sessionDelegate: ClientSessionDelegate)] = []
var enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingReturnValue: ClientBuilder! var enableOidcRefreshLockUnderlyingReturnValue: ClientBuilder!
open var enableCrossProcessRefreshLockProcessIdSessionDelegateReturnValue: ClientBuilder! { open var enableOidcRefreshLockReturnValue: ClientBuilder! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingReturnValue return enableOidcRefreshLockUnderlyingReturnValue
} else { } else {
var returnValue: ClientBuilder? = nil var returnValue: ClientBuilder? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingReturnValue returnValue = enableOidcRefreshLockUnderlyingReturnValue
} }
return returnValue! return returnValue!
@ -4917,26 +5032,22 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingReturnValue = newValue enableOidcRefreshLockUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingReturnValue = newValue enableOidcRefreshLockUnderlyingReturnValue = newValue
} }
} }
} }
} }
open var enableCrossProcessRefreshLockProcessIdSessionDelegateClosure: ((String, ClientSessionDelegate) -> ClientBuilder)? open var enableOidcRefreshLockClosure: (() -> ClientBuilder)?
open override func enableCrossProcessRefreshLock(processId: String, sessionDelegate: ClientSessionDelegate) -> ClientBuilder { open override func enableOidcRefreshLock() -> ClientBuilder {
enableCrossProcessRefreshLockProcessIdSessionDelegateCallsCount += 1 enableOidcRefreshLockCallsCount += 1
enableCrossProcessRefreshLockProcessIdSessionDelegateReceivedArguments = (processId: processId, sessionDelegate: sessionDelegate) if let enableOidcRefreshLockClosure = enableOidcRefreshLockClosure {
DispatchQueue.main.async { return enableOidcRefreshLockClosure()
self.enableCrossProcessRefreshLockProcessIdSessionDelegateReceivedInvocations.append((processId: processId, sessionDelegate: sessionDelegate))
}
if let enableCrossProcessRefreshLockProcessIdSessionDelegateClosure = enableCrossProcessRefreshLockProcessIdSessionDelegateClosure {
return enableCrossProcessRefreshLockProcessIdSessionDelegateClosure(processId, sessionDelegate)
} else { } else {
return enableCrossProcessRefreshLockProcessIdSessionDelegateReturnValue return enableOidcRefreshLockReturnValue
} }
} }
@ -7832,6 +7943,71 @@ open class LazyTimelineItemProviderSDKMock: MatrixRustSDK.LazyTimelineItemProvid
} }
} }
//MARK: - getSendHandle
var getSendHandleUnderlyingCallsCount = 0
open var getSendHandleCallsCount: Int {
get {
if Thread.isMainThread {
return getSendHandleUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = getSendHandleUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
getSendHandleUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
getSendHandleUnderlyingCallsCount = newValue
}
}
}
}
open var getSendHandleCalled: Bool {
return getSendHandleCallsCount > 0
}
var getSendHandleUnderlyingReturnValue: SendHandle?
open var getSendHandleReturnValue: SendHandle? {
get {
if Thread.isMainThread {
return getSendHandleUnderlyingReturnValue
} else {
var returnValue: SendHandle?? = nil
DispatchQueue.main.sync {
returnValue = getSendHandleUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
getSendHandleUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
getSendHandleUnderlyingReturnValue = newValue
}
}
}
}
open var getSendHandleClosure: (() -> SendHandle?)?
open override func getSendHandle() -> SendHandle? {
getSendHandleCallsCount += 1
if let getSendHandleClosure = getSendHandleClosure {
return getSendHandleClosure()
} else {
return getSendHandleReturnValue
}
}
//MARK: - getShields //MARK: - getShields
var getShieldsStrictUnderlyingCallsCount = 0 var getShieldsStrictUnderlyingCallsCount = 0
@ -11164,16 +11340,16 @@ open class RoomSDKMock: MatrixRustSDK.Room {
//MARK: - ignoreDeviceTrustAndResend //MARK: - ignoreDeviceTrustAndResend
open var ignoreDeviceTrustAndResendDevicesTransactionIdThrowableError: Error? open var ignoreDeviceTrustAndResendDevicesSendHandleThrowableError: Error?
var ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount = 0 var ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = 0
open var ignoreDeviceTrustAndResendDevicesTransactionIdCallsCount: Int { open var ignoreDeviceTrustAndResendDevicesSendHandleCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount return ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount returnValue = ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -11181,31 +11357,31 @@ open class RoomSDKMock: MatrixRustSDK.Room {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount = newValue ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount = newValue ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var ignoreDeviceTrustAndResendDevicesTransactionIdCalled: Bool { open var ignoreDeviceTrustAndResendDevicesSendHandleCalled: Bool {
return ignoreDeviceTrustAndResendDevicesTransactionIdCallsCount > 0 return ignoreDeviceTrustAndResendDevicesSendHandleCallsCount > 0
} }
open var ignoreDeviceTrustAndResendDevicesTransactionIdReceivedArguments: (devices: [String: [String]], transactionId: String)? open var ignoreDeviceTrustAndResendDevicesSendHandleReceivedArguments: (devices: [String: [String]], sendHandle: SendHandle)?
open var ignoreDeviceTrustAndResendDevicesTransactionIdReceivedInvocations: [(devices: [String: [String]], transactionId: String)] = [] open var ignoreDeviceTrustAndResendDevicesSendHandleReceivedInvocations: [(devices: [String: [String]], sendHandle: SendHandle)] = []
open var ignoreDeviceTrustAndResendDevicesTransactionIdClosure: (([String: [String]], String) async throws -> Void)? open var ignoreDeviceTrustAndResendDevicesSendHandleClosure: (([String: [String]], SendHandle) async throws -> Void)?
open override func ignoreDeviceTrustAndResend(devices: [String: [String]], transactionId: String) async throws { open override func ignoreDeviceTrustAndResend(devices: [String: [String]], sendHandle: SendHandle) async throws {
if let error = ignoreDeviceTrustAndResendDevicesTransactionIdThrowableError { if let error = ignoreDeviceTrustAndResendDevicesSendHandleThrowableError {
throw error throw error
} }
ignoreDeviceTrustAndResendDevicesTransactionIdCallsCount += 1 ignoreDeviceTrustAndResendDevicesSendHandleCallsCount += 1
ignoreDeviceTrustAndResendDevicesTransactionIdReceivedArguments = (devices: devices, transactionId: transactionId) ignoreDeviceTrustAndResendDevicesSendHandleReceivedArguments = (devices: devices, sendHandle: sendHandle)
DispatchQueue.main.async { DispatchQueue.main.async {
self.ignoreDeviceTrustAndResendDevicesTransactionIdReceivedInvocations.append((devices: devices, transactionId: transactionId)) self.ignoreDeviceTrustAndResendDevicesSendHandleReceivedInvocations.append((devices: devices, sendHandle: sendHandle))
} }
try await ignoreDeviceTrustAndResendDevicesTransactionIdClosure?(devices, transactionId) try await ignoreDeviceTrustAndResendDevicesSendHandleClosure?(devices, sendHandle)
} }
//MARK: - ignoreUser //MARK: - ignoreUser
@ -14036,52 +14212,6 @@ open class RoomSDKMock: MatrixRustSDK.Room {
} }
} }
//MARK: - tryResend
open var tryResendTransactionIdThrowableError: Error?
var tryResendTransactionIdUnderlyingCallsCount = 0
open var tryResendTransactionIdCallsCount: Int {
get {
if Thread.isMainThread {
return tryResendTransactionIdUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = tryResendTransactionIdUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
tryResendTransactionIdUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
tryResendTransactionIdUnderlyingCallsCount = newValue
}
}
}
}
open var tryResendTransactionIdCalled: Bool {
return tryResendTransactionIdCallsCount > 0
}
open var tryResendTransactionIdReceivedTransactionId: String?
open var tryResendTransactionIdReceivedInvocations: [String] = []
open var tryResendTransactionIdClosure: ((String) async throws -> Void)?
open override func tryResend(transactionId: String) async throws {
if let error = tryResendTransactionIdThrowableError {
throw error
}
tryResendTransactionIdCallsCount += 1
tryResendTransactionIdReceivedTransactionId = transactionId
DispatchQueue.main.async {
self.tryResendTransactionIdReceivedInvocations.append(transactionId)
}
try await tryResendTransactionIdClosure?(transactionId)
}
//MARK: - typingNotice //MARK: - typingNotice
open var typingNoticeIsTypingThrowableError: Error? open var typingNoticeIsTypingThrowableError: Error?
@ -14268,16 +14398,16 @@ open class RoomSDKMock: MatrixRustSDK.Room {
//MARK: - withdrawVerificationAndResend //MARK: - withdrawVerificationAndResend
open var withdrawVerificationAndResendUserIdsTransactionIdThrowableError: Error? open var withdrawVerificationAndResendUserIdsSendHandleThrowableError: Error?
var withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount = 0 var withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount = 0
open var withdrawVerificationAndResendUserIdsTransactionIdCallsCount: Int { open var withdrawVerificationAndResendUserIdsSendHandleCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount return withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount returnValue = withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -14285,31 +14415,31 @@ open class RoomSDKMock: MatrixRustSDK.Room {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount = newValue withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount = newValue withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var withdrawVerificationAndResendUserIdsTransactionIdCalled: Bool { open var withdrawVerificationAndResendUserIdsSendHandleCalled: Bool {
return withdrawVerificationAndResendUserIdsTransactionIdCallsCount > 0 return withdrawVerificationAndResendUserIdsSendHandleCallsCount > 0
} }
open var withdrawVerificationAndResendUserIdsTransactionIdReceivedArguments: (userIds: [String], transactionId: String)? open var withdrawVerificationAndResendUserIdsSendHandleReceivedArguments: (userIds: [String], sendHandle: SendHandle)?
open var withdrawVerificationAndResendUserIdsTransactionIdReceivedInvocations: [(userIds: [String], transactionId: String)] = [] open var withdrawVerificationAndResendUserIdsSendHandleReceivedInvocations: [(userIds: [String], sendHandle: SendHandle)] = []
open var withdrawVerificationAndResendUserIdsTransactionIdClosure: (([String], String) async throws -> Void)? open var withdrawVerificationAndResendUserIdsSendHandleClosure: (([String], SendHandle) async throws -> Void)?
open override func withdrawVerificationAndResend(userIds: [String], transactionId: String) async throws { open override func withdrawVerificationAndResend(userIds: [String], sendHandle: SendHandle) async throws {
if let error = withdrawVerificationAndResendUserIdsTransactionIdThrowableError { if let error = withdrawVerificationAndResendUserIdsSendHandleThrowableError {
throw error throw error
} }
withdrawVerificationAndResendUserIdsTransactionIdCallsCount += 1 withdrawVerificationAndResendUserIdsSendHandleCallsCount += 1
withdrawVerificationAndResendUserIdsTransactionIdReceivedArguments = (userIds: userIds, transactionId: transactionId) withdrawVerificationAndResendUserIdsSendHandleReceivedArguments = (userIds: userIds, sendHandle: sendHandle)
DispatchQueue.main.async { DispatchQueue.main.async {
self.withdrawVerificationAndResendUserIdsTransactionIdReceivedInvocations.append((userIds: userIds, transactionId: transactionId)) self.withdrawVerificationAndResendUserIdsSendHandleReceivedInvocations.append((userIds: userIds, sendHandle: sendHandle))
} }
try await withdrawVerificationAndResendUserIdsTransactionIdClosure?(userIds, transactionId) try await withdrawVerificationAndResendUserIdsSendHandleClosure?(userIds, sendHandle)
} }
} }
open class RoomDirectorySearchSDKMock: MatrixRustSDK.RoomDirectorySearch { open class RoomDirectorySearchSDKMock: MatrixRustSDK.RoomDirectorySearch {
@ -16927,6 +17057,46 @@ open class SendHandleSDKMock: MatrixRustSDK.SendHandle {
return abortReturnValue return abortReturnValue
} }
} }
//MARK: - tryResend
open var tryResendThrowableError: Error?
var tryResendUnderlyingCallsCount = 0
open var tryResendCallsCount: Int {
get {
if Thread.isMainThread {
return tryResendUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = tryResendUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
tryResendUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
tryResendUnderlyingCallsCount = newValue
}
}
}
}
open var tryResendCalled: Bool {
return tryResendCallsCount > 0
}
open var tryResendClosure: (() async throws -> Void)?
open override func tryResend() async throws {
if let error = tryResendThrowableError {
throw error
}
tryResendCallsCount += 1
try await tryResendClosure?()
}
} }
open class SessionVerificationControllerSDKMock: MatrixRustSDK.SessionVerificationController { open class SessionVerificationControllerSDKMock: MatrixRustSDK.SessionVerificationController {
init() { init() {
@ -17986,15 +18156,15 @@ open class SyncServiceBuilderSDKMock: MatrixRustSDK.SyncServiceBuilder {
//MARK: - withCrossProcessLock //MARK: - withCrossProcessLock
var withCrossProcessLockAppIdentifierUnderlyingCallsCount = 0 var withCrossProcessLockUnderlyingCallsCount = 0
open var withCrossProcessLockAppIdentifierCallsCount: Int { open var withCrossProcessLockCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return withCrossProcessLockAppIdentifierUnderlyingCallsCount return withCrossProcessLockUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = withCrossProcessLockAppIdentifierUnderlyingCallsCount returnValue = withCrossProcessLockUnderlyingCallsCount
} }
return returnValue! return returnValue!
@ -18002,29 +18172,27 @@ open class SyncServiceBuilderSDKMock: MatrixRustSDK.SyncServiceBuilder {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
withCrossProcessLockAppIdentifierUnderlyingCallsCount = newValue withCrossProcessLockUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
withCrossProcessLockAppIdentifierUnderlyingCallsCount = newValue withCrossProcessLockUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var withCrossProcessLockAppIdentifierCalled: Bool { open var withCrossProcessLockCalled: Bool {
return withCrossProcessLockAppIdentifierCallsCount > 0 return withCrossProcessLockCallsCount > 0
} }
open var withCrossProcessLockAppIdentifierReceivedAppIdentifier: String?
open var withCrossProcessLockAppIdentifierReceivedInvocations: [String?] = []
var withCrossProcessLockAppIdentifierUnderlyingReturnValue: SyncServiceBuilder! var withCrossProcessLockUnderlyingReturnValue: SyncServiceBuilder!
open var withCrossProcessLockAppIdentifierReturnValue: SyncServiceBuilder! { open var withCrossProcessLockReturnValue: SyncServiceBuilder! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return withCrossProcessLockAppIdentifierUnderlyingReturnValue return withCrossProcessLockUnderlyingReturnValue
} else { } else {
var returnValue: SyncServiceBuilder? = nil var returnValue: SyncServiceBuilder? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = withCrossProcessLockAppIdentifierUnderlyingReturnValue returnValue = withCrossProcessLockUnderlyingReturnValue
} }
return returnValue! return returnValue!
@ -18032,26 +18200,22 @@ open class SyncServiceBuilderSDKMock: MatrixRustSDK.SyncServiceBuilder {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
withCrossProcessLockAppIdentifierUnderlyingReturnValue = newValue withCrossProcessLockUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
withCrossProcessLockAppIdentifierUnderlyingReturnValue = newValue withCrossProcessLockUnderlyingReturnValue = newValue
} }
} }
} }
} }
open var withCrossProcessLockAppIdentifierClosure: ((String?) -> SyncServiceBuilder)? open var withCrossProcessLockClosure: (() -> SyncServiceBuilder)?
open override func withCrossProcessLock(appIdentifier: String?) -> SyncServiceBuilder { open override func withCrossProcessLock() -> SyncServiceBuilder {
withCrossProcessLockAppIdentifierCallsCount += 1 withCrossProcessLockCallsCount += 1
withCrossProcessLockAppIdentifierReceivedAppIdentifier = appIdentifier if let withCrossProcessLockClosure = withCrossProcessLockClosure {
DispatchQueue.main.async { return withCrossProcessLockClosure()
self.withCrossProcessLockAppIdentifierReceivedInvocations.append(appIdentifier)
}
if let withCrossProcessLockAppIdentifierClosure = withCrossProcessLockAppIdentifierClosure {
return withCrossProcessLockAppIdentifierClosure(appIdentifier)
} else { } else {
return withCrossProcessLockAppIdentifierReturnValue return withCrossProcessLockReturnValue
} }
} }

View File

@ -83,9 +83,8 @@ extension JoinedRoomProxyMock {
return .success(member) return .success(member)
} }
resendItemIDReturnValue = .success(()) ignoreDeviceTrustAndResendDevicesSendHandleReturnValue = .success(())
ignoreDeviceTrustAndResendDevicesItemIDReturnValue = .success(()) withdrawVerificationAndResendUserIDsSendHandleReturnValue = .success(())
withdrawVerificationAndResendUserIDsItemIDReturnValue = .success(())
flagAsUnreadReturnValue = .success(()) flagAsUnreadReturnValue = .success(())
markAsReadReceiptTypeReturnValue = .success(()) markAsReadReceiptTypeReturnValue = .success(())

View File

@ -17,7 +17,9 @@ extension ClientBuilder {
appHooks: AppHooks, appHooks: AppHooks,
enableOnlySignedDeviceIsolationMode: Bool) -> ClientBuilder { enableOnlySignedDeviceIsolationMode: Bool) -> ClientBuilder {
var builder = ClientBuilder() var builder = ClientBuilder()
.enableCrossProcessRefreshLock(processId: InfoPlistReader.main.bundleIdentifier, sessionDelegate: sessionDelegate) .crossProcessStoreLocksHolderName(holderName: InfoPlistReader.main.bundleIdentifier)
.enableOidcRefreshLock()
.setSessionDelegate(sessionDelegate: sessionDelegate)
.userAgent(userAgent: UserAgentBuilder.makeASCIIUserAgent()) .userAgent(userAgent: UserAgentBuilder.makeASCIIUserAgent())
.requestConfig(config: .init(retryLimit: 0, timeout: 30000, maxConcurrentRequests: nil, retryTimeout: nil)) .requestConfig(config: .init(retryLimit: 0, timeout: 30000, maxConcurrentRequests: nil, retryTimeout: nil))

View File

@ -19,7 +19,7 @@ import SwiftUI
struct ResolveVerifiedUserSendFailureScreenCoordinatorParameters { struct ResolveVerifiedUserSendFailureScreenCoordinatorParameters {
let failure: TimelineItemSendFailure.VerifiedUser let failure: TimelineItemSendFailure.VerifiedUser
let itemID: TimelineItemIdentifier let sendHandle: SendHandleProxy
let roomProxy: JoinedRoomProxyProtocol let roomProxy: JoinedRoomProxyProtocol
let userIndicatorController: UserIndicatorControllerProtocol let userIndicatorController: UserIndicatorControllerProtocol
} }
@ -43,7 +43,7 @@ final class ResolveVerifiedUserSendFailureScreenCoordinator: CoordinatorProtocol
self.parameters = parameters self.parameters = parameters
viewModel = ResolveVerifiedUserSendFailureScreenViewModel(failure: parameters.failure, viewModel = ResolveVerifiedUserSendFailureScreenViewModel(failure: parameters.failure,
itemID: parameters.itemID, sendHandle: parameters.sendHandle,
roomProxy: parameters.roomProxy, roomProxy: parameters.roomProxy,
userIndicatorController: parameters.userIndicatorController) userIndicatorController: parameters.userIndicatorController)
} }

View File

@ -22,7 +22,7 @@ typealias ResolveVerifiedUserSendFailureScreenViewModelType = StateStoreViewMode
class ResolveVerifiedUserSendFailureScreenViewModel: ResolveVerifiedUserSendFailureScreenViewModelType, ResolveVerifiedUserSendFailureScreenViewModelProtocol { class ResolveVerifiedUserSendFailureScreenViewModel: ResolveVerifiedUserSendFailureScreenViewModelType, ResolveVerifiedUserSendFailureScreenViewModelProtocol {
private let iterator: VerifiedUserSendFailureIterator private let iterator: VerifiedUserSendFailureIterator
private let failure: TimelineItemSendFailure.VerifiedUser private let failure: TimelineItemSendFailure.VerifiedUser
private let itemID: TimelineItemIdentifier private let sendHandle: SendHandleProxy
private let roomProxy: JoinedRoomProxyProtocol private let roomProxy: JoinedRoomProxyProtocol
private var members: [String: RoomMemberProxyProtocol] private var members: [String: RoomMemberProxyProtocol]
@ -34,7 +34,7 @@ class ResolveVerifiedUserSendFailureScreenViewModel: ResolveVerifiedUserSendFail
} }
init(failure: TimelineItemSendFailure.VerifiedUser, init(failure: TimelineItemSendFailure.VerifiedUser,
itemID: TimelineItemIdentifier, sendHandle: SendHandleProxy,
roomProxy: JoinedRoomProxyProtocol, roomProxy: JoinedRoomProxyProtocol,
userIndicatorController: UserIndicatorControllerProtocol) { userIndicatorController: UserIndicatorControllerProtocol) {
iterator = switch failure { iterator = switch failure {
@ -43,7 +43,7 @@ class ResolveVerifiedUserSendFailureScreenViewModel: ResolveVerifiedUserSendFail
} }
self.failure = failure self.failure = failure
self.itemID = itemID self.sendHandle = sendHandle
self.roomProxy = roomProxy self.roomProxy = roomProxy
self.userIndicatorController = userIndicatorController self.userIndicatorController = userIndicatorController
@ -77,9 +77,9 @@ class ResolveVerifiedUserSendFailureScreenViewModel: ResolveVerifiedUserSendFail
private func resolveAndResend() async { private func resolveAndResend() async {
let result = switch failure { let result = switch failure {
case .hasUnsignedDevice(let devices): case .hasUnsignedDevice(let devices):
await roomProxy.ignoreDeviceTrustAndResend(devices: devices, itemID: itemID) await roomProxy.ignoreDeviceTrustAndResend(devices: devices, sendHandle: sendHandle)
case .changedIdentity(let users): case .changedIdentity(let users):
await roomProxy.withdrawVerificationAndResend(userIDs: users, itemID: itemID) await roomProxy.withdrawVerificationAndResend(userIDs: users, sendHandle: sendHandle)
} }
if case let .failure(error) = result { if case let .failure(error) = result {
@ -98,7 +98,7 @@ class ResolveVerifiedUserSendFailureScreenViewModel: ResolveVerifiedUserSendFail
} }
private func resend() async { private func resend() async {
switch await roomProxy.resend(itemID: itemID) { switch await sendHandle.resend() {
case .success: case .success:
actionsSubject.send(.dismiss) actionsSubject.send(.dismiss)
case .failure(let error): case .failure(let error):

View File

@ -94,7 +94,7 @@ struct ResolveVerifiedUserSendFailureScreen_Previews: PreviewProvider, TestableP
static func makeViewModel(failure: TimelineItemSendFailure.VerifiedUser) -> ResolveVerifiedUserSendFailureScreenViewModel { static func makeViewModel(failure: TimelineItemSendFailure.VerifiedUser) -> ResolveVerifiedUserSendFailureScreenViewModel {
ResolveVerifiedUserSendFailureScreenViewModel(failure: failure, ResolveVerifiedUserSendFailureScreenViewModel(failure: failure,
itemID: .randomEvent, sendHandle: .mock,
roomProxy: JoinedRoomProxyMock(.init()), roomProxy: JoinedRoomProxyMock(.init()),
userIndicatorController: UserIndicatorControllerMock()) userIndicatorController: UserIndicatorControllerMock())
} }
@ -102,7 +102,7 @@ struct ResolveVerifiedUserSendFailureScreen_Previews: PreviewProvider, TestableP
struct ResolveVerifiedUserSendFailureScreenSheet_Previews: PreviewProvider { struct ResolveVerifiedUserSendFailureScreenSheet_Previews: PreviewProvider {
static let viewModel = ResolveVerifiedUserSendFailureScreenViewModel(failure: .changedIdentity(users: ["@alice:matrix.org"]), static let viewModel = ResolveVerifiedUserSendFailureScreenViewModel(failure: .changedIdentity(users: ["@alice:matrix.org"]),
itemID: .randomEvent, sendHandle: .mock,
roomProxy: JoinedRoomProxyMock(.init()), roomProxy: JoinedRoomProxyMock(.init()),
userIndicatorController: UserIndicatorControllerMock()) userIndicatorController: UserIndicatorControllerMock())

View File

@ -40,7 +40,7 @@ enum RoomScreenCoordinatorAction {
case presentMessageForwarding(forwardingItem: MessageForwardingItem) case presentMessageForwarding(forwardingItem: MessageForwardingItem)
case presentCallScreen case presentCallScreen
case presentPinnedEventsTimeline case presentPinnedEventsTimeline
case presentResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, itemID: TimelineItemIdentifier) case presentResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, sendHandle: SendHandleProxy)
} }
final class RoomScreenCoordinator: CoordinatorProtocol { final class RoomScreenCoordinator: CoordinatorProtocol {
@ -132,8 +132,8 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
actionsSubject.send(.presentMessageForwarding(forwardingItem: forwardingItem)) actionsSubject.send(.presentMessageForwarding(forwardingItem: forwardingItem))
case .displayLocation(let body, let geoURI, let description): case .displayLocation(let body, let geoURI, let description):
actionsSubject.send(.presentLocationViewer(body: body, geoURI: geoURI, description: description)) actionsSubject.send(.presentLocationViewer(body: body, geoURI: geoURI, description: description))
case .displayResolveSendFailure(let failure, let itemID): case .displayResolveSendFailure(let failure, let sendHandle):
actionsSubject.send(.presentResolveSendFailure(failure: failure, itemID: itemID)) actionsSubject.send(.presentResolveSendFailure(failure: failure, sendHandle: sendHandle))
case .composer(let action): case .composer(let action):
composerViewModel.process(timelineAction: action) composerViewModel.process(timelineAction: action)
case .hasScrolled(direction: let direction): case .hasScrolled(direction: let direction):

View File

@ -22,7 +22,7 @@ enum TimelineViewModelAction {
case tappedOnSenderDetails(userID: String) case tappedOnSenderDetails(userID: String)
case displayMessageForwarding(forwardingItem: MessageForwardingItem) case displayMessageForwarding(forwardingItem: MessageForwardingItem)
case displayLocation(body: String, geoURI: GeoURI, description: String?) case displayLocation(body: String, geoURI: GeoURI, description: String?)
case displayResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, itemID: TimelineItemIdentifier) case displayResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, sendHandle: SendHandleProxy)
case composer(action: TimelineComposerAction) case composer(action: TimelineComposerAction)
case hasScrolled(direction: ScrollDirection) case hasScrolled(direction: ScrollDirection)
case viewInRoomTimeline(eventID: String) case viewInRoomTimeline(eventID: String)

View File

@ -562,7 +562,14 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
if case .sendingFailed(.unknown) = eventTimelineItem.properties.deliveryStatus { if case .sendingFailed(.unknown) = eventTimelineItem.properties.deliveryStatus {
displayAlert(.sendingFailed) displayAlert(.sendingFailed)
} else if case let .sendingFailed(.verifiedUser(failure)) = eventTimelineItem.properties.deliveryStatus { } else if case let .sendingFailed(.verifiedUser(failure)) = eventTimelineItem.properties.deliveryStatus {
actionsSubject.send(.displayResolveSendFailure(failure: failure, itemID: itemID)) guard let sendHandle = timelineController.sendHandle(for: itemID) else {
MXLog.error("Cannot find send handle for \(itemID).")
return
}
actionsSubject.send(.displayResolveSendFailure(failure: failure,
sendHandle: sendHandle))
} else if let authenticityMessage = eventTimelineItem.properties.encryptionAuthenticity?.message { } else if let authenticityMessage = eventTimelineItem.properties.encryptionAuthenticity?.message {
displayAlert(.encryptionAuthenticity(authenticityMessage)) displayAlert(.encryptionAuthenticity(authenticityMessage))
} }

View File

@ -811,13 +811,14 @@ class ClientProxy: ClientProxyProtocol {
do { do {
let syncService = try await client let syncService = try await client
.syncService() .syncService()
.withCrossProcessLock(appIdentifier: "MainApp") .withCrossProcessLock()
.withUtdHook(delegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject)) .withUtdHook(delegate: ClientDecryptionErrorDelegate(actionsSubject: actionsSubject))
.finish() .finish()
let roomListService = syncService.roomListService() let roomListService = syncService.roomListService()
let roomMessageEventStringBuilder = RoomMessageEventStringBuilder(attributedStringBuilder: AttributedStringBuilder(cacheKey: "roomList", let roomMessageEventStringBuilder = RoomMessageEventStringBuilder(attributedStringBuilder: AttributedStringBuilder(cacheKey: "roomList",
mentionBuilder: PlainMentionBuilder()), prefix: .senderName) mentionBuilder: PlainMentionBuilder()), destination: .roomList)
let eventStringBuilder = RoomEventStringBuilder(stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID, shouldDisambiguateDisplayNames: false), let eventStringBuilder = RoomEventStringBuilder(stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID, shouldDisambiguateDisplayNames: false),
messageEventStringBuilder: roomMessageEventStringBuilder, messageEventStringBuilder: roomMessageEventStringBuilder,
shouldDisambiguateDisplayNames: false, shouldDisambiguateDisplayNames: false,

View File

@ -315,47 +315,22 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
} }
} }
func resend(itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError> { func ignoreDeviceTrustAndResend(devices: [String: [String]], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError> {
guard let transactionID = itemID.transactionID else {
MXLog.error("Attempting to resend an item that has no transaction ID: \(itemID)")
return .failure(.missingTransactionID)
}
do { do {
try await room.tryResend(transactionId: transactionID) try await room.ignoreDeviceTrustAndResend(devices: devices, sendHandle: sendHandle.underlyingHandle)
return .success(()) return .success(())
} catch { } catch {
MXLog.error("Failed resending \(transactionID) with error: \(error)") MXLog.error("Failed trusting devices \(devices) and resending \(sendHandle.itemID) with error: \(error)")
return .failure(.sdkError(error)) return .failure(.sdkError(error))
} }
} }
func ignoreDeviceTrustAndResend(devices: [String: [String]], itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError> { func withdrawVerificationAndResend(userIDs: [String], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError> {
guard let transactionID = itemID.transactionID else {
MXLog.error("Attempting to resend an item that has no transaction ID: \(itemID)")
return .failure(.missingTransactionID)
}
do { do {
try await room.ignoreDeviceTrustAndResend(devices: devices, transactionId: transactionID) try await room.withdrawVerificationAndResend(userIds: userIDs, sendHandle: sendHandle.underlyingHandle)
return .success(()) return .success(())
} catch { } catch {
MXLog.error("Failed trusting devices \(devices) and resending \(transactionID) with error: \(error)") MXLog.error("Failed withdrawing verification of \(userIDs) and resending \(sendHandle.itemID) with error: \(error)")
return .failure(.sdkError(error))
}
}
func withdrawVerificationAndResend(userIDs: [String], itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError> {
guard let transactionID = itemID.transactionID else {
MXLog.error("Attempting to resend an item that has no transaction ID: \(itemID)")
return .failure(.missingTransactionID)
}
do {
try await room.withdrawVerificationAndResend(userIds: userIDs, transactionId: transactionID)
return .success(())
} catch {
MXLog.error("Failed withdrawing verification of \(userIDs) and resending \(transactionID) with error: \(error)")
return .failure(.sdkError(error)) return .failure(.sdkError(error))
} }
} }

View File

@ -97,11 +97,9 @@ protocol JoinedRoomProxyProtocol: RoomProxyProtocol {
/// https://spec.matrix.org/v1.9/client-server-api/#typing-notifications /// https://spec.matrix.org/v1.9/client-server-api/#typing-notifications
@discardableResult func sendTypingNotification(isTyping: Bool) async -> Result<Void, RoomProxyError> @discardableResult func sendTypingNotification(isTyping: Bool) async -> Result<Void, RoomProxyError>
func resend(itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError> func ignoreDeviceTrustAndResend(devices: [String: [String]], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError>
func ignoreDeviceTrustAndResend(devices: [String: [String]], itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError> func withdrawVerificationAndResend(userIDs: [String], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError>
func withdrawVerificationAndResend(userIDs: [String], itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError>
// MARK: - Room Flags // MARK: - Room Flags

View File

@ -35,7 +35,7 @@ struct RoomEventStringBuilder {
case .redactedMessage: case .redactedMessage:
return prefix(L10n.commonMessageRemoved, with: displayName) return prefix(L10n.commonMessageRemoved, with: displayName)
case .sticker: case .sticker:
if messageEventStringBuilder.prefix == .messageType { if messageEventStringBuilder.destination == .pinnedEvent {
var string = AttributedString(L10n.commonSticker) var string = AttributedString(L10n.commonSticker)
string.bold() string.bold()
return string return string
@ -49,7 +49,7 @@ struct RoomEventStringBuilder {
return stateEventStringBuilder return stateEventStringBuilder
.buildString(for: state, sender: sender, isOutgoing: isOutgoing) .buildString(for: state, sender: sender, isOutgoing: isOutgoing)
.map(AttributedString.init) .map(AttributedString.init)
case .roomMembership(let userID, let displayName, let change): case .roomMembership(let userID, let displayName, let change, _):
return stateEventStringBuilder return stateEventStringBuilder
.buildString(for: change, memberUserID: userID, memberDisplayName: displayName, sender: sender, isOutgoing: isOutgoing) .buildString(for: change, memberUserID: userID, memberDisplayName: displayName, sender: sender, isOutgoing: isOutgoing)
.map(AttributedString.init) .map(AttributedString.init)
@ -63,7 +63,7 @@ struct RoomEventStringBuilder {
memberIsYou: isOutgoing) memberIsYou: isOutgoing)
.map(AttributedString.init) .map(AttributedString.init)
case .poll(let question, _, _, _, _, _, _): case .poll(let question, _, _, _, _, _, _):
if messageEventStringBuilder.prefix == .messageType { if messageEventStringBuilder.destination == .pinnedEvent {
let questionPlaceholder = "{question}" let questionPlaceholder = "{question}"
var finalString = AttributedString(L10n.commonPollSummary(questionPlaceholder)) var finalString = AttributedString(L10n.commonPollSummary(questionPlaceholder))
finalString.bold() finalString.bold()
@ -96,7 +96,7 @@ struct RoomEventStringBuilder {
RoomEventStringBuilder(stateEventStringBuilder: .init(userID: userID, RoomEventStringBuilder(stateEventStringBuilder: .init(userID: userID,
shouldDisambiguateDisplayNames: false), shouldDisambiguateDisplayNames: false),
messageEventStringBuilder: .init(attributedStringBuilder: AttributedStringBuilder(cacheKey: "pinnedEvents", mentionBuilder: PlainMentionBuilder()), messageEventStringBuilder: .init(attributedStringBuilder: AttributedStringBuilder(cacheKey: "pinnedEvents", mentionBuilder: PlainMentionBuilder()),
prefix: .messageType), destination: .pinnedEvent),
shouldDisambiguateDisplayNames: false, shouldDisambiguateDisplayNames: false,
shouldPrefixSenderName: false) shouldPrefixSenderName: false)
} }

View File

@ -9,42 +9,46 @@ import Foundation
import MatrixRustSDK import MatrixRustSDK
struct RoomMessageEventStringBuilder { struct RoomMessageEventStringBuilder {
enum Prefix { enum Destination {
case senderName /// Strings show on the room list as the last message
case messageType /// The sender will be prefixed in bold
case none case roomList
/// Events pinned to the banner on the top of the timeline
/// The message type will be prefixed in bold
case pinnedEvent
/// Shown in push notifications
/// No prefix
case notification
} }
let attributedStringBuilder: AttributedStringBuilderProtocol let attributedStringBuilder: AttributedStringBuilderProtocol
let prefix: Prefix let destination: Destination
func buildAttributedString(for messageType: MessageType, senderDisplayName: String) -> AttributedString { func buildAttributedString(for messageType: MessageType, senderDisplayName: String) -> AttributedString {
let message: AttributedString let message: AttributedString
switch messageType { switch messageType {
// Message types that don't need a prefix.
case .emote(content: let content): case .emote(content: let content):
if let attributedMessage = attributedMessageFrom(formattedBody: content.formatted) { if let attributedMessage = attributedMessageFrom(formattedBody: content.formatted) {
return AttributedString(L10n.commonEmote(senderDisplayName, String(attributedMessage.characters))) return AttributedString(L10n.commonEmote(senderDisplayName, String(attributedMessage.characters)))
} else { } else {
return AttributedString(L10n.commonEmote(senderDisplayName, content.body)) return AttributedString(L10n.commonEmote(senderDisplayName, content.body))
} }
// Message types that should be prefixed with the sender's name.
case .audio(content: let content): case .audio(content: let content):
let isVoiceMessage = content.voice != nil let isVoiceMessage = content.voice != nil
var content = AttributedString(isVoiceMessage ? L10n.commonVoiceMessage : L10n.commonAudio) var content = AttributedString(isVoiceMessage ? L10n.commonVoiceMessage : L10n.commonAudio)
if prefix == .messageType { if destination == .pinnedEvent {
content.bold() content.bold()
} }
message = content message = content
case .image(let content): case .image(let content):
message = prefix == .messageType ? prefix(AttributedString(content.body), with: L10n.commonImage) : AttributedString("\(L10n.commonImage) - \(content.body)") message = buildMessage(for: destination, caption: content.caption, type: L10n.commonImage)
case .video(let content): case .video(let content):
message = prefix == .messageType ? prefix(AttributedString(content.body), with: L10n.commonVideo) : AttributedString("\(L10n.commonVideo) - \(content.body)") message = buildMessage(for: destination, caption: content.caption, type: L10n.commonVideo)
case .file(let content): case .file(let content):
message = prefix == .messageType ? prefix(AttributedString(content.body), with: L10n.commonFile) : AttributedString("\(L10n.commonFile) - \(content.body)") message = buildMessage(for: destination, caption: content.caption, type: L10n.commonFile)
case .location: case .location:
var content = AttributedString(L10n.commonSharedLocation) var content = AttributedString(L10n.commonSharedLocation)
if prefix == .messageType { if destination == .pinnedEvent {
content.bold() content.bold()
} }
message = content message = content
@ -64,13 +68,25 @@ struct RoomMessageEventStringBuilder {
message = AttributedString(body) message = AttributedString(body)
} }
if prefix == .senderName { if destination == .roomList {
return prefix(message, with: senderDisplayName) return prefix(message, with: senderDisplayName)
} else { } else {
return message return message
} }
} }
private func buildMessage(for destination: Destination, caption: String?, type: String) -> AttributedString {
guard let caption else {
return AttributedString(type)
}
if destination == .pinnedEvent {
return prefix(AttributedString(caption), with: type)
} else {
return AttributedString("\(type) - \(caption)")
}
}
private func prefix(_ eventSummary: AttributedString, with textToBold: String) -> AttributedString { private func prefix(_ eventSummary: AttributedString, with textToBold: String) -> AttributedString {
let attributedEventSummary = AttributedString(eventSummary.string.trimmingCharacters(in: .whitespacesAndNewlines)) let attributedEventSummary = AttributedString(eventSummary.string.trimmingCharacters(in: .whitespacesAndNewlines))

View File

@ -104,6 +104,10 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
func debugInfo(for itemID: TimelineItemIdentifier) -> TimelineItemDebugInfo { func debugInfo(for itemID: TimelineItemIdentifier) -> TimelineItemDebugInfo {
.init(model: "Mock debug description", originalJSON: nil, latestEditJSON: nil) .init(model: "Mock debug description", originalJSON: nil, latestEditJSON: nil)
} }
func sendHandle(for itemID: TimelineItemIdentifier) -> SendHandleProxy? {
nil
}
func retryDecryption(for sessionID: String) async { } func retryDecryption(for sessionID: String) async { }

View File

@ -308,6 +308,21 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
return .init(model: "Unknown item", originalJSON: nil, latestEditJSON: nil) return .init(model: "Unknown item", originalJSON: nil, latestEditJSON: nil)
} }
func sendHandle(for itemID: TimelineItemIdentifier) -> SendHandleProxy? {
for timelineItemProxy in activeTimelineProvider.itemProxies {
switch timelineItemProxy {
case .event(let item):
if item.id == itemID {
return item.sendHandle.map { .init(itemID: itemID, underlyingHandle: $0) }
}
default:
continue
}
}
return nil
}
func retryDecryption(for sessionID: String) async { func retryDecryption(for sessionID: String) async {
await activeTimeline.retryDecryption(for: sessionID) await activeTimeline.retryDecryption(for: sessionID)
} }

View File

@ -68,6 +68,8 @@ protocol RoomTimelineControllerProtocol {
func debugInfo(for itemID: TimelineItemIdentifier) -> TimelineItemDebugInfo func debugInfo(for itemID: TimelineItemIdentifier) -> TimelineItemDebugInfo
func sendHandle(for itemID: TimelineItemIdentifier) -> SendHandleProxy?
func retryDecryption(for sessionID: String) async func retryDecryption(for sessionID: String) async
func eventTimestamp(for itemID: TimelineItemIdentifier) -> Date? func eventTimestamp(for itemID: TimelineItemIdentifier) -> Date?

View File

@ -135,6 +135,8 @@ class EventTimelineItemProxy {
lazy var shieldState = item.lazyProvider.getShields(strict: false) lazy var shieldState = item.lazyProvider.getShields(strict: false)
lazy var sendHandle = item.lazyProvider.getSendHandle()
lazy var readReceipts = item.readReceipts lazy var readReceipts = item.readReceipts
} }
@ -179,6 +181,40 @@ struct TimelineItemDebugInfo: Identifiable, CustomStringConvertible {
} }
} }
struct SendHandleProxy: Hashable {
enum Error: Swift.Error {
case sdkError(Swift.Error)
}
let itemID: TimelineItemIdentifier
let underlyingHandle: SendHandle
func resend() async -> Result<Void, Error> {
do {
try await underlyingHandle.tryResend()
return .success(())
} catch {
return .failure(.sdkError(error))
}
}
// MARK: - Hashable
static func == (lhs: SendHandleProxy, rhs: SendHandleProxy) -> Bool {
lhs.itemID == rhs.itemID
}
func hash(into hasher: inout Hasher) {
hasher.combine(itemID)
}
static var mock: SendHandleProxy {
.init(itemID: .event(uniqueID: .init(id: UUID().uuidString),
eventOrTransactionID: .eventId(eventId: UUID().uuidString)),
underlyingHandle: .init(noPointer: .init()))
}
}
extension Receipt { extension Receipt {
var dateTimestamp: Date? { var dateTimestamp: Date? {
guard let timestamp else { guard let timestamp else {

View File

@ -50,7 +50,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
return nil return nil
} }
return buildStateTimelineItem(for: eventItemProxy, state: content, isOutgoing: isOutgoing) return buildStateTimelineItem(for: eventItemProxy, state: content, isOutgoing: isOutgoing)
case .roomMembership(userId: let userID, let displayName, change: let change): case .roomMembership(userId: let userID, let displayName, change: let change, _):
if isDM, change == .joined, userID == self.userID { if isDM, change == .joined, userID == self.userID {
return nil return nil
} }
@ -511,7 +511,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
duration: messageContent.audio?.duration ?? 0, duration: messageContent.audio?.duration ?? 0,
waveform: waveform, waveform: waveform,
source: MediaSourceProxy(source: messageContent.source, mimeType: messageContent.info?.mimetype), source: MediaSourceProxy(source: messageContent.source, mimeType: messageContent.info?.mimetype),
contentType: UTType(mimeType: messageContent.info?.mimetype, fallbackFilename: messageContent.body)) contentType: UTType(mimeType: messageContent.info?.mimetype, fallbackFilename: messageContent.filename))
} }
private func buildImageTimelineItemContent(_ messageContent: ImageMessageContent) -> ImageRoomTimelineItemContent { private func buildImageTimelineItemContent(_ messageContent: ImageMessageContent) -> ImageRoomTimelineItemContent {
@ -537,7 +537,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
height: height, height: height,
aspectRatio: aspectRatio, aspectRatio: aspectRatio,
blurhash: messageContent.info?.blurhash, blurhash: messageContent.info?.blurhash,
contentType: UTType(mimeType: messageContent.info?.mimetype, fallbackFilename: messageContent.body)) contentType: UTType(mimeType: messageContent.info?.mimetype, fallbackFilename: messageContent.filename))
} }
private func buildVideoTimelineItemContent(_ messageContent: VideoMessageContent) -> VideoRoomTimelineItemContent { private func buildVideoTimelineItemContent(_ messageContent: VideoMessageContent) -> VideoRoomTimelineItemContent {
@ -564,7 +564,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
height: height, height: height,
aspectRatio: aspectRatio, aspectRatio: aspectRatio,
blurhash: messageContent.info?.blurhash, blurhash: messageContent.info?.blurhash,
contentType: UTType(mimeType: messageContent.info?.mimetype, fallbackFilename: messageContent.body)) contentType: UTType(mimeType: messageContent.info?.mimetype, fallbackFilename: messageContent.filename))
} }
private func buildLocationTimelineItemContent(_ locationContent: LocationContent) -> LocationRoomTimelineItemContent { private func buildLocationTimelineItemContent(_ locationContent: LocationContent) -> LocationRoomTimelineItemContent {
@ -585,7 +585,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
formattedCaptionHTMLString: htmlCaption, formattedCaptionHTMLString: htmlCaption,
source: MediaSourceProxy(source: messageContent.source, mimeType: messageContent.info?.mimetype), source: MediaSourceProxy(source: messageContent.source, mimeType: messageContent.info?.mimetype),
thumbnailSource: thumbnailSource, thumbnailSource: thumbnailSource,
contentType: UTType(mimeType: messageContent.info?.mimetype, fallbackFilename: messageContent.body)) contentType: UTType(mimeType: messageContent.info?.mimetype, fallbackFilename: messageContent.filename))
} }
private func buildNoticeTimelineItemContent(_ messageContent: NoticeMessageContent) -> NoticeRoomTimelineItemContent { private func buildNoticeTimelineItemContent(_ messageContent: NoticeMessageContent) -> NoticeRoomTimelineItemContent {

View File

@ -33,7 +33,7 @@ import UserNotifications
// database, logging, etc. are only ever setup once per *process* // database, logging, etc. are only ever setup once per *process*
private let settings: CommonSettingsProtocol = AppSettings() private let settings: CommonSettingsProtocol = AppSettings()
private let notificationContentBuilder = NotificationContentBuilder(messageEventStringBuilder: RoomMessageEventStringBuilder(attributedStringBuilder: AttributedStringBuilder(mentionBuilder: PlainMentionBuilder()), prefix: .none), private let notificationContentBuilder = NotificationContentBuilder(messageEventStringBuilder: RoomMessageEventStringBuilder(attributedStringBuilder: AttributedStringBuilder(mentionBuilder: PlainMentionBuilder()), destination: .notification),
settings: settings) settings: settings)
private let keychainController = KeychainController(service: .sessions, private let keychainController = KeychainController(service: .sessions,
accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier) accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier)

View File

@ -228,28 +228,19 @@ class LoggingTests: XCTestCase {
let rustEmoteMessage = EmoteMessageContent(body: emoteString, let rustEmoteMessage = EmoteMessageContent(body: emoteString,
formatted: FormattedBody(format: .html, body: "<b>\(emoteString)</b>")) formatted: FormattedBody(format: .html, body: "<b>\(emoteString)</b>"))
let rustImageMessage = ImageMessageContent(body: "ImageString", let rustImageMessage = ImageMessageContent(filename: "ImageString",
formatted: nil,
rawFilename: "ImageString",
filename: "ImageString",
caption: "ImageString", caption: "ImageString",
formattedCaption: nil, formattedCaption: nil,
source: MediaSource(noPointer: .init()), source: MediaSource(noPointer: .init()),
info: nil) info: nil)
let rustVideoMessage = VideoMessageContent(body: "VideoString", let rustVideoMessage = VideoMessageContent(filename: "VideoString",
formatted: nil,
rawFilename: "VideoString",
filename: "VideoString",
caption: "VideoString", caption: "VideoString",
formattedCaption: nil, formattedCaption: nil,
source: MediaSource(noPointer: .init()), source: MediaSource(noPointer: .init()),
info: nil) info: nil)
let rustFileMessage = FileMessageContent(body: "FileString", let rustFileMessage = FileMessageContent(filename: "FileString",
formatted: nil,
rawFilename: "FileString",
filename: "FileString",
caption: "FileString", caption: "FileString",
formattedCaption: nil, formattedCaption: nil,
source: MediaSource(noPointer: .init()), source: MediaSource(noPointer: .init()),
@ -280,13 +271,13 @@ class LoggingTests: XCTestCase {
XCTAssertFalse(content.contains(emoteString)) XCTAssertFalse(content.contains(emoteString))
XCTAssertTrue(content.contains(String(describing: ImageMessageContent.self))) XCTAssertTrue(content.contains(String(describing: ImageMessageContent.self)))
XCTAssertFalse(content.contains(rustImageMessage.body)) XCTAssertFalse(content.contains(rustImageMessage.filename))
XCTAssertTrue(content.contains(String(describing: VideoMessageContent.self))) XCTAssertTrue(content.contains(String(describing: VideoMessageContent.self)))
XCTAssertFalse(content.contains(rustVideoMessage.body)) XCTAssertFalse(content.contains(rustVideoMessage.filename))
XCTAssertTrue(content.contains(String(describing: FileMessageContent.self))) XCTAssertTrue(content.contains(String(describing: FileMessageContent.self)))
XCTAssertFalse(content.contains(rustFileMessage.body)) XCTAssertFalse(content.contains(rustFileMessage.filename))
} }
func testLogFileSorting() async throws { func testLogFileSorting() async throws {

View File

@ -61,7 +61,7 @@ class ResolveVerifiedUserSendFailureScreenViewModelTests: XCTestCase {
private func makeViewModel(with failure: TimelineItemSendFailure.VerifiedUser) -> ResolveVerifiedUserSendFailureScreenViewModel { private func makeViewModel(with failure: TimelineItemSendFailure.VerifiedUser) -> ResolveVerifiedUserSendFailureScreenViewModel {
ResolveVerifiedUserSendFailureScreenViewModel(failure: failure, ResolveVerifiedUserSendFailureScreenViewModel(failure: failure,
itemID: .randomEvent, sendHandle: .mock,
roomProxy: roomProxy, roomProxy: roomProxy,
userIndicatorController: UserIndicatorControllerMock()) userIndicatorController: UserIndicatorControllerMock())
} }

View File

@ -61,7 +61,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.66 exactVersion: 1.0.67
# 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