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";
requirement = {
kind = exactVersion;
version = 1.0.66;
version = 1.0.67;
};
};
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {

View File

@ -149,8 +149,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : {
"revision" : "902979581ff4f35e54a83cd7c5c340745d6f0d0e",
"version" : "1.0.66"
"revision" : "5f23a9b8e210aa9962b420bcd7065d5f9cf142c9",
"version" : "1.0.67"
}
},
{

View File

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

View File

@ -7039,87 +7039,17 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
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
var ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount = 0
var ignoreDeviceTrustAndResendDevicesItemIDCallsCount: Int {
var ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = 0
var ignoreDeviceTrustAndResendDevicesSendHandleCallsCount: Int {
get {
if Thread.isMainThread {
return ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount
return ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount
returnValue = ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount
}
return returnValue!
@ -7127,29 +7057,29 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
}
set {
if Thread.isMainThread {
ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount = newValue
ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
ignoreDeviceTrustAndResendDevicesItemIDUnderlyingCallsCount = newValue
ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = newValue
}
}
}
}
var ignoreDeviceTrustAndResendDevicesItemIDCalled: Bool {
return ignoreDeviceTrustAndResendDevicesItemIDCallsCount > 0
var ignoreDeviceTrustAndResendDevicesSendHandleCalled: Bool {
return ignoreDeviceTrustAndResendDevicesSendHandleCallsCount > 0
}
var ignoreDeviceTrustAndResendDevicesItemIDReceivedArguments: (devices: [String: [String]], itemID: TimelineItemIdentifier)?
var ignoreDeviceTrustAndResendDevicesItemIDReceivedInvocations: [(devices: [String: [String]], itemID: TimelineItemIdentifier)] = []
var ignoreDeviceTrustAndResendDevicesSendHandleReceivedArguments: (devices: [String: [String]], sendHandle: SendHandleProxy)?
var ignoreDeviceTrustAndResendDevicesSendHandleReceivedInvocations: [(devices: [String: [String]], sendHandle: SendHandleProxy)] = []
var ignoreDeviceTrustAndResendDevicesItemIDUnderlyingReturnValue: Result<Void, RoomProxyError>!
var ignoreDeviceTrustAndResendDevicesItemIDReturnValue: Result<Void, RoomProxyError>! {
var ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingReturnValue: Result<Void, RoomProxyError>!
var ignoreDeviceTrustAndResendDevicesSendHandleReturnValue: Result<Void, RoomProxyError>! {
get {
if Thread.isMainThread {
return ignoreDeviceTrustAndResendDevicesItemIDUnderlyingReturnValue
return ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingReturnValue
} else {
var returnValue: Result<Void, RoomProxyError>? = nil
DispatchQueue.main.sync {
returnValue = ignoreDeviceTrustAndResendDevicesItemIDUnderlyingReturnValue
returnValue = ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingReturnValue
}
return returnValue!
@ -7157,39 +7087,39 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
}
set {
if Thread.isMainThread {
ignoreDeviceTrustAndResendDevicesItemIDUnderlyingReturnValue = newValue
ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingReturnValue = newValue
} else {
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> {
ignoreDeviceTrustAndResendDevicesItemIDCallsCount += 1
ignoreDeviceTrustAndResendDevicesItemIDReceivedArguments = (devices: devices, itemID: itemID)
func ignoreDeviceTrustAndResend(devices: [String: [String]], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError> {
ignoreDeviceTrustAndResendDevicesSendHandleCallsCount += 1
ignoreDeviceTrustAndResendDevicesSendHandleReceivedArguments = (devices: devices, sendHandle: sendHandle)
DispatchQueue.main.async {
self.ignoreDeviceTrustAndResendDevicesItemIDReceivedInvocations.append((devices: devices, itemID: itemID))
self.ignoreDeviceTrustAndResendDevicesSendHandleReceivedInvocations.append((devices: devices, sendHandle: sendHandle))
}
if let ignoreDeviceTrustAndResendDevicesItemIDClosure = ignoreDeviceTrustAndResendDevicesItemIDClosure {
return await ignoreDeviceTrustAndResendDevicesItemIDClosure(devices, itemID)
if let ignoreDeviceTrustAndResendDevicesSendHandleClosure = ignoreDeviceTrustAndResendDevicesSendHandleClosure {
return await ignoreDeviceTrustAndResendDevicesSendHandleClosure(devices, sendHandle)
} else {
return ignoreDeviceTrustAndResendDevicesItemIDReturnValue
return ignoreDeviceTrustAndResendDevicesSendHandleReturnValue
}
}
//MARK: - withdrawVerificationAndResend
var withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount = 0
var withdrawVerificationAndResendUserIDsItemIDCallsCount: Int {
var withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount = 0
var withdrawVerificationAndResendUserIDsSendHandleCallsCount: Int {
get {
if Thread.isMainThread {
return withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount
return withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount
returnValue = withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount
}
return returnValue!
@ -7197,29 +7127,29 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
}
set {
if Thread.isMainThread {
withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount = newValue
withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
withdrawVerificationAndResendUserIDsItemIDUnderlyingCallsCount = newValue
withdrawVerificationAndResendUserIDsSendHandleUnderlyingCallsCount = newValue
}
}
}
}
var withdrawVerificationAndResendUserIDsItemIDCalled: Bool {
return withdrawVerificationAndResendUserIDsItemIDCallsCount > 0
var withdrawVerificationAndResendUserIDsSendHandleCalled: Bool {
return withdrawVerificationAndResendUserIDsSendHandleCallsCount > 0
}
var withdrawVerificationAndResendUserIDsItemIDReceivedArguments: (userIDs: [String], itemID: TimelineItemIdentifier)?
var withdrawVerificationAndResendUserIDsItemIDReceivedInvocations: [(userIDs: [String], itemID: TimelineItemIdentifier)] = []
var withdrawVerificationAndResendUserIDsSendHandleReceivedArguments: (userIDs: [String], sendHandle: SendHandleProxy)?
var withdrawVerificationAndResendUserIDsSendHandleReceivedInvocations: [(userIDs: [String], sendHandle: SendHandleProxy)] = []
var withdrawVerificationAndResendUserIDsItemIDUnderlyingReturnValue: Result<Void, RoomProxyError>!
var withdrawVerificationAndResendUserIDsItemIDReturnValue: Result<Void, RoomProxyError>! {
var withdrawVerificationAndResendUserIDsSendHandleUnderlyingReturnValue: Result<Void, RoomProxyError>!
var withdrawVerificationAndResendUserIDsSendHandleReturnValue: Result<Void, RoomProxyError>! {
get {
if Thread.isMainThread {
return withdrawVerificationAndResendUserIDsItemIDUnderlyingReturnValue
return withdrawVerificationAndResendUserIDsSendHandleUnderlyingReturnValue
} else {
var returnValue: Result<Void, RoomProxyError>? = nil
DispatchQueue.main.sync {
returnValue = withdrawVerificationAndResendUserIDsItemIDUnderlyingReturnValue
returnValue = withdrawVerificationAndResendUserIDsSendHandleUnderlyingReturnValue
}
return returnValue!
@ -7227,26 +7157,26 @@ class JoinedRoomProxyMock: JoinedRoomProxyProtocol {
}
set {
if Thread.isMainThread {
withdrawVerificationAndResendUserIDsItemIDUnderlyingReturnValue = newValue
withdrawVerificationAndResendUserIDsSendHandleUnderlyingReturnValue = newValue
} else {
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> {
withdrawVerificationAndResendUserIDsItemIDCallsCount += 1
withdrawVerificationAndResendUserIDsItemIDReceivedArguments = (userIDs: userIDs, itemID: itemID)
func withdrawVerificationAndResend(userIDs: [String], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError> {
withdrawVerificationAndResendUserIDsSendHandleCallsCount += 1
withdrawVerificationAndResendUserIDsSendHandleReceivedArguments = (userIDs: userIDs, sendHandle: sendHandle)
DispatchQueue.main.async {
self.withdrawVerificationAndResendUserIDsItemIDReceivedInvocations.append((userIDs: userIDs, itemID: itemID))
self.withdrawVerificationAndResendUserIDsSendHandleReceivedInvocations.append((userIDs: userIDs, sendHandle: sendHandle))
}
if let withdrawVerificationAndResendUserIDsItemIDClosure = withdrawVerificationAndResendUserIDsItemIDClosure {
return await withdrawVerificationAndResendUserIDsItemIDClosure(userIDs, itemID)
if let withdrawVerificationAndResendUserIDsSendHandleClosure = withdrawVerificationAndResendUserIDsSendHandleClosure {
return await withdrawVerificationAndResendUserIDsSendHandleClosure(userIDs, sendHandle)
} else {
return withdrawVerificationAndResendUserIDsItemIDReturnValue
return withdrawVerificationAndResendUserIDsSendHandleReturnValue
}
}
//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
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
var disableAutomaticTokenRefreshUnderlyingCallsCount = 0
@ -4869,17 +4986,17 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder {
}
}
//MARK: - enableCrossProcessRefreshLock
//MARK: - enableOidcRefreshLock
var enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount = 0
open var enableCrossProcessRefreshLockProcessIdSessionDelegateCallsCount: Int {
var enableOidcRefreshLockUnderlyingCallsCount = 0
open var enableOidcRefreshLockCallsCount: Int {
get {
if Thread.isMainThread {
return enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount
return enableOidcRefreshLockUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount
returnValue = enableOidcRefreshLockUnderlyingCallsCount
}
return returnValue!
@ -4887,29 +5004,27 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder {
}
set {
if Thread.isMainThread {
enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount = newValue
enableOidcRefreshLockUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingCallsCount = newValue
enableOidcRefreshLockUnderlyingCallsCount = newValue
}
}
}
}
open var enableCrossProcessRefreshLockProcessIdSessionDelegateCalled: Bool {
return enableCrossProcessRefreshLockProcessIdSessionDelegateCallsCount > 0
open var enableOidcRefreshLockCalled: Bool {
return enableOidcRefreshLockCallsCount > 0
}
open var enableCrossProcessRefreshLockProcessIdSessionDelegateReceivedArguments: (processId: String, sessionDelegate: ClientSessionDelegate)?
open var enableCrossProcessRefreshLockProcessIdSessionDelegateReceivedInvocations: [(processId: String, sessionDelegate: ClientSessionDelegate)] = []
var enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingReturnValue: ClientBuilder!
open var enableCrossProcessRefreshLockProcessIdSessionDelegateReturnValue: ClientBuilder! {
var enableOidcRefreshLockUnderlyingReturnValue: ClientBuilder!
open var enableOidcRefreshLockReturnValue: ClientBuilder! {
get {
if Thread.isMainThread {
return enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingReturnValue
return enableOidcRefreshLockUnderlyingReturnValue
} else {
var returnValue: ClientBuilder? = nil
DispatchQueue.main.sync {
returnValue = enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingReturnValue
returnValue = enableOidcRefreshLockUnderlyingReturnValue
}
return returnValue!
@ -4917,26 +5032,22 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder {
}
set {
if Thread.isMainThread {
enableCrossProcessRefreshLockProcessIdSessionDelegateUnderlyingReturnValue = newValue
enableOidcRefreshLockUnderlyingReturnValue = newValue
} else {
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 {
enableCrossProcessRefreshLockProcessIdSessionDelegateCallsCount += 1
enableCrossProcessRefreshLockProcessIdSessionDelegateReceivedArguments = (processId: processId, sessionDelegate: sessionDelegate)
DispatchQueue.main.async {
self.enableCrossProcessRefreshLockProcessIdSessionDelegateReceivedInvocations.append((processId: processId, sessionDelegate: sessionDelegate))
}
if let enableCrossProcessRefreshLockProcessIdSessionDelegateClosure = enableCrossProcessRefreshLockProcessIdSessionDelegateClosure {
return enableCrossProcessRefreshLockProcessIdSessionDelegateClosure(processId, sessionDelegate)
open override func enableOidcRefreshLock() -> ClientBuilder {
enableOidcRefreshLockCallsCount += 1
if let enableOidcRefreshLockClosure = enableOidcRefreshLockClosure {
return enableOidcRefreshLockClosure()
} 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
var getShieldsStrictUnderlyingCallsCount = 0
@ -11164,16 +11340,16 @@ open class RoomSDKMock: MatrixRustSDK.Room {
//MARK: - ignoreDeviceTrustAndResend
open var ignoreDeviceTrustAndResendDevicesTransactionIdThrowableError: Error?
var ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount = 0
open var ignoreDeviceTrustAndResendDevicesTransactionIdCallsCount: Int {
open var ignoreDeviceTrustAndResendDevicesSendHandleThrowableError: Error?
var ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = 0
open var ignoreDeviceTrustAndResendDevicesSendHandleCallsCount: Int {
get {
if Thread.isMainThread {
return ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount
return ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount
returnValue = ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount
}
return returnValue!
@ -11181,31 +11357,31 @@ open class RoomSDKMock: MatrixRustSDK.Room {
}
set {
if Thread.isMainThread {
ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount = newValue
ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
ignoreDeviceTrustAndResendDevicesTransactionIdUnderlyingCallsCount = newValue
ignoreDeviceTrustAndResendDevicesSendHandleUnderlyingCallsCount = newValue
}
}
}
}
open var ignoreDeviceTrustAndResendDevicesTransactionIdCalled: Bool {
return ignoreDeviceTrustAndResendDevicesTransactionIdCallsCount > 0
open var ignoreDeviceTrustAndResendDevicesSendHandleCalled: Bool {
return ignoreDeviceTrustAndResendDevicesSendHandleCallsCount > 0
}
open var ignoreDeviceTrustAndResendDevicesTransactionIdReceivedArguments: (devices: [String: [String]], transactionId: String)?
open var ignoreDeviceTrustAndResendDevicesTransactionIdReceivedInvocations: [(devices: [String: [String]], transactionId: String)] = []
open var ignoreDeviceTrustAndResendDevicesTransactionIdClosure: (([String: [String]], String) async throws -> Void)?
open var ignoreDeviceTrustAndResendDevicesSendHandleReceivedArguments: (devices: [String: [String]], sendHandle: SendHandle)?
open var ignoreDeviceTrustAndResendDevicesSendHandleReceivedInvocations: [(devices: [String: [String]], sendHandle: SendHandle)] = []
open var ignoreDeviceTrustAndResendDevicesSendHandleClosure: (([String: [String]], SendHandle) async throws -> Void)?
open override func ignoreDeviceTrustAndResend(devices: [String: [String]], transactionId: String) async throws {
if let error = ignoreDeviceTrustAndResendDevicesTransactionIdThrowableError {
open override func ignoreDeviceTrustAndResend(devices: [String: [String]], sendHandle: SendHandle) async throws {
if let error = ignoreDeviceTrustAndResendDevicesSendHandleThrowableError {
throw error
}
ignoreDeviceTrustAndResendDevicesTransactionIdCallsCount += 1
ignoreDeviceTrustAndResendDevicesTransactionIdReceivedArguments = (devices: devices, transactionId: transactionId)
ignoreDeviceTrustAndResendDevicesSendHandleCallsCount += 1
ignoreDeviceTrustAndResendDevicesSendHandleReceivedArguments = (devices: devices, sendHandle: sendHandle)
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
@ -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
open var typingNoticeIsTypingThrowableError: Error?
@ -14268,16 +14398,16 @@ open class RoomSDKMock: MatrixRustSDK.Room {
//MARK: - withdrawVerificationAndResend
open var withdrawVerificationAndResendUserIdsTransactionIdThrowableError: Error?
var withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount = 0
open var withdrawVerificationAndResendUserIdsTransactionIdCallsCount: Int {
open var withdrawVerificationAndResendUserIdsSendHandleThrowableError: Error?
var withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount = 0
open var withdrawVerificationAndResendUserIdsSendHandleCallsCount: Int {
get {
if Thread.isMainThread {
return withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount
return withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount
returnValue = withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount
}
return returnValue!
@ -14285,31 +14415,31 @@ open class RoomSDKMock: MatrixRustSDK.Room {
}
set {
if Thread.isMainThread {
withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount = newValue
withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
withdrawVerificationAndResendUserIdsTransactionIdUnderlyingCallsCount = newValue
withdrawVerificationAndResendUserIdsSendHandleUnderlyingCallsCount = newValue
}
}
}
}
open var withdrawVerificationAndResendUserIdsTransactionIdCalled: Bool {
return withdrawVerificationAndResendUserIdsTransactionIdCallsCount > 0
open var withdrawVerificationAndResendUserIdsSendHandleCalled: Bool {
return withdrawVerificationAndResendUserIdsSendHandleCallsCount > 0
}
open var withdrawVerificationAndResendUserIdsTransactionIdReceivedArguments: (userIds: [String], transactionId: String)?
open var withdrawVerificationAndResendUserIdsTransactionIdReceivedInvocations: [(userIds: [String], transactionId: String)] = []
open var withdrawVerificationAndResendUserIdsTransactionIdClosure: (([String], String) async throws -> Void)?
open var withdrawVerificationAndResendUserIdsSendHandleReceivedArguments: (userIds: [String], sendHandle: SendHandle)?
open var withdrawVerificationAndResendUserIdsSendHandleReceivedInvocations: [(userIds: [String], sendHandle: SendHandle)] = []
open var withdrawVerificationAndResendUserIdsSendHandleClosure: (([String], SendHandle) async throws -> Void)?
open override func withdrawVerificationAndResend(userIds: [String], transactionId: String) async throws {
if let error = withdrawVerificationAndResendUserIdsTransactionIdThrowableError {
open override func withdrawVerificationAndResend(userIds: [String], sendHandle: SendHandle) async throws {
if let error = withdrawVerificationAndResendUserIdsSendHandleThrowableError {
throw error
}
withdrawVerificationAndResendUserIdsTransactionIdCallsCount += 1
withdrawVerificationAndResendUserIdsTransactionIdReceivedArguments = (userIds: userIds, transactionId: transactionId)
withdrawVerificationAndResendUserIdsSendHandleCallsCount += 1
withdrawVerificationAndResendUserIdsSendHandleReceivedArguments = (userIds: userIds, sendHandle: sendHandle)
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 {
@ -16927,6 +17057,46 @@ open class SendHandleSDKMock: MatrixRustSDK.SendHandle {
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 {
init() {
@ -17986,15 +18156,15 @@ open class SyncServiceBuilderSDKMock: MatrixRustSDK.SyncServiceBuilder {
//MARK: - withCrossProcessLock
var withCrossProcessLockAppIdentifierUnderlyingCallsCount = 0
open var withCrossProcessLockAppIdentifierCallsCount: Int {
var withCrossProcessLockUnderlyingCallsCount = 0
open var withCrossProcessLockCallsCount: Int {
get {
if Thread.isMainThread {
return withCrossProcessLockAppIdentifierUnderlyingCallsCount
return withCrossProcessLockUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = withCrossProcessLockAppIdentifierUnderlyingCallsCount
returnValue = withCrossProcessLockUnderlyingCallsCount
}
return returnValue!
@ -18002,29 +18172,27 @@ open class SyncServiceBuilderSDKMock: MatrixRustSDK.SyncServiceBuilder {
}
set {
if Thread.isMainThread {
withCrossProcessLockAppIdentifierUnderlyingCallsCount = newValue
withCrossProcessLockUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
withCrossProcessLockAppIdentifierUnderlyingCallsCount = newValue
withCrossProcessLockUnderlyingCallsCount = newValue
}
}
}
}
open var withCrossProcessLockAppIdentifierCalled: Bool {
return withCrossProcessLockAppIdentifierCallsCount > 0
open var withCrossProcessLockCalled: Bool {
return withCrossProcessLockCallsCount > 0
}
open var withCrossProcessLockAppIdentifierReceivedAppIdentifier: String?
open var withCrossProcessLockAppIdentifierReceivedInvocations: [String?] = []
var withCrossProcessLockAppIdentifierUnderlyingReturnValue: SyncServiceBuilder!
open var withCrossProcessLockAppIdentifierReturnValue: SyncServiceBuilder! {
var withCrossProcessLockUnderlyingReturnValue: SyncServiceBuilder!
open var withCrossProcessLockReturnValue: SyncServiceBuilder! {
get {
if Thread.isMainThread {
return withCrossProcessLockAppIdentifierUnderlyingReturnValue
return withCrossProcessLockUnderlyingReturnValue
} else {
var returnValue: SyncServiceBuilder? = nil
DispatchQueue.main.sync {
returnValue = withCrossProcessLockAppIdentifierUnderlyingReturnValue
returnValue = withCrossProcessLockUnderlyingReturnValue
}
return returnValue!
@ -18032,26 +18200,22 @@ open class SyncServiceBuilderSDKMock: MatrixRustSDK.SyncServiceBuilder {
}
set {
if Thread.isMainThread {
withCrossProcessLockAppIdentifierUnderlyingReturnValue = newValue
withCrossProcessLockUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
withCrossProcessLockAppIdentifierUnderlyingReturnValue = newValue
withCrossProcessLockUnderlyingReturnValue = newValue
}
}
}
}
open var withCrossProcessLockAppIdentifierClosure: ((String?) -> SyncServiceBuilder)?
open var withCrossProcessLockClosure: (() -> SyncServiceBuilder)?
open override func withCrossProcessLock(appIdentifier: String?) -> SyncServiceBuilder {
withCrossProcessLockAppIdentifierCallsCount += 1
withCrossProcessLockAppIdentifierReceivedAppIdentifier = appIdentifier
DispatchQueue.main.async {
self.withCrossProcessLockAppIdentifierReceivedInvocations.append(appIdentifier)
}
if let withCrossProcessLockAppIdentifierClosure = withCrossProcessLockAppIdentifierClosure {
return withCrossProcessLockAppIdentifierClosure(appIdentifier)
open override func withCrossProcessLock() -> SyncServiceBuilder {
withCrossProcessLockCallsCount += 1
if let withCrossProcessLockClosure = withCrossProcessLockClosure {
return withCrossProcessLockClosure()
} else {
return withCrossProcessLockAppIdentifierReturnValue
return withCrossProcessLockReturnValue
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@ enum TimelineViewModelAction {
case tappedOnSenderDetails(userID: String)
case displayMessageForwarding(forwardingItem: MessageForwardingItem)
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 hasScrolled(direction: ScrollDirection)
case viewInRoomTimeline(eventID: String)

View File

@ -562,7 +562,14 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
if case .sendingFailed(.unknown) = eventTimelineItem.properties.deliveryStatus {
displayAlert(.sendingFailed)
} 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 {
displayAlert(.encryptionAuthenticity(authenticityMessage))
}

View File

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

View File

@ -315,47 +315,22 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
}
}
func resend(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)
}
func ignoreDeviceTrustAndResend(devices: [String: [String]], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError> {
do {
try await room.tryResend(transactionId: transactionID)
try await room.ignoreDeviceTrustAndResend(devices: devices, sendHandle: sendHandle.underlyingHandle)
return .success(())
} 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))
}
}
func ignoreDeviceTrustAndResend(devices: [String: [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)
}
func withdrawVerificationAndResend(userIDs: [String], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError> {
do {
try await room.ignoreDeviceTrustAndResend(devices: devices, transactionId: transactionID)
try await room.withdrawVerificationAndResend(userIds: userIDs, sendHandle: sendHandle.underlyingHandle)
return .success(())
} catch {
MXLog.error("Failed trusting devices \(devices) and resending \(transactionID) 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)")
MXLog.error("Failed withdrawing verification of \(userIDs) and resending \(sendHandle.itemID) with error: \(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
@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], itemID: TimelineItemIdentifier) async -> Result<Void, RoomProxyError>
func withdrawVerificationAndResend(userIDs: [String], sendHandle: SendHandleProxy) async -> Result<Void, RoomProxyError>
// MARK: - Room Flags

View File

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

View File

@ -9,42 +9,46 @@ import Foundation
import MatrixRustSDK
struct RoomMessageEventStringBuilder {
enum Prefix {
case senderName
case messageType
case none
enum Destination {
/// Strings show on the room list as the last message
/// The sender will be prefixed in bold
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 prefix: Prefix
let destination: Destination
func buildAttributedString(for messageType: MessageType, senderDisplayName: String) -> AttributedString {
let message: AttributedString
switch messageType {
// Message types that don't need a prefix.
case .emote(content: let content):
if let attributedMessage = attributedMessageFrom(formattedBody: content.formatted) {
return AttributedString(L10n.commonEmote(senderDisplayName, String(attributedMessage.characters)))
} else {
return AttributedString(L10n.commonEmote(senderDisplayName, content.body))
}
// Message types that should be prefixed with the sender's name.
case .audio(content: let content):
let isVoiceMessage = content.voice != nil
var content = AttributedString(isVoiceMessage ? L10n.commonVoiceMessage : L10n.commonAudio)
if prefix == .messageType {
if destination == .pinnedEvent {
content.bold()
}
message = 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):
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):
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:
var content = AttributedString(L10n.commonSharedLocation)
if prefix == .messageType {
if destination == .pinnedEvent {
content.bold()
}
message = content
@ -64,13 +68,25 @@ struct RoomMessageEventStringBuilder {
message = AttributedString(body)
}
if prefix == .senderName {
if destination == .roomList {
return prefix(message, with: senderDisplayName)
} else {
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 {
let attributedEventSummary = AttributedString(eventSummary.string.trimmingCharacters(in: .whitespacesAndNewlines))

View File

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

View File

@ -308,6 +308,21 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
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 {
await activeTimeline.retryDecryption(for: sessionID)
}

View File

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

View File

@ -135,6 +135,8 @@ class EventTimelineItemProxy {
lazy var shieldState = item.lazyProvider.getShields(strict: false)
lazy var sendHandle = item.lazyProvider.getSendHandle()
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 {
var dateTimestamp: Date? {
guard let timestamp else {

View File

@ -50,7 +50,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
return nil
}
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 {
return nil
}
@ -511,7 +511,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
duration: messageContent.audio?.duration ?? 0,
waveform: waveform,
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 {
@ -537,7 +537,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
height: height,
aspectRatio: aspectRatio,
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 {
@ -564,7 +564,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
height: height,
aspectRatio: aspectRatio,
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 {
@ -585,7 +585,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
formattedCaptionHTMLString: htmlCaption,
source: MediaSourceProxy(source: messageContent.source, mimeType: messageContent.info?.mimetype),
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 {

View File

@ -33,7 +33,7 @@ import UserNotifications
// database, logging, etc. are only ever setup once per *process*
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)
private let keychainController = KeychainController(service: .sessions,
accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier)

View File

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

View File

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

View File

@ -61,7 +61,7 @@ packages:
# Element/Matrix dependencies
MatrixRustSDK:
url: https://github.com/element-hq/matrix-rust-components-swift
exactVersion: 1.0.66
exactVersion: 1.0.67
# path: ../matrix-rust-sdk
Compound:
url: https://github.com/element-hq/compound-ios