From 37f353bc3122ee3e3a7c01638941536c923cf843 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 25 Feb 2025 11:06:15 +0200 Subject: [PATCH] Bump the RustSDK to v25.2.25, address breaking changes from matrix-org/matrix-rust-sdk/pull/4674 --- ElementX.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 +-- .../Sources/Application/AppCoordinator.swift | 10 ++---- ElementX/Sources/Mocks/ClientProxyMock.swift | 1 - .../Mocks/Generated/GeneratedMocks.swift | 35 ++----------------- .../Mocks/Generated/SDKGeneratedMocks.swift | 35 ++----------------- .../Sources/Services/Client/ClientProxy.swift | 5 ++- .../Services/Client/ClientProxyProtocol.swift | 2 +- Package.resolved | 4 +-- project.yml | 2 +- 10 files changed, 17 insertions(+), 83 deletions(-) diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index 70b1c6ef7e..53de32ca8b 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -8536,7 +8536,7 @@ repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; requirement = { kind = exactVersion; - version = 25.02.17; + version = 25.02.25; }; }; 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a7c8c426f6..142fd63b46 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -149,8 +149,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/matrix-rust-components-swift", "state" : { - "revision" : "422d7bef3ffd3edcb3e30afb410ee523f5659adc", - "version" : "25.2.17" + "revision" : "d5556ad7857c79f53804fbae17cc5232bc2ac493", + "version" : "25.2.25" } }, { diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index 1336e63fd2..fb0be58112 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -591,7 +591,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg Task { // First log out from the server - let accountLogoutURL = await userSession.clientProxy.logout() + await userSession.clientProxy.logout() // Regardless of the result, clear user data userSessionStore.logout(userSession: userSession) @@ -604,13 +604,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg ServiceLocator.shared.analytics.resetConsentState() stateMachine.processEvent(.completedSigningOut) - - // Handle OIDC's RP-Initiated Logout if needed. Don't fallback to an ASWebAuthenticationSession - // as it looks weird to show an alert to the user asking them to sign in to their provider. - if let accountLogoutURL, UIApplication.shared.canOpenURL(accountLogoutURL) { - await UIApplication.shared.open(accountLogoutURL) - } - + hideLoadingIndicator() } } diff --git a/ElementX/Sources/Mocks/ClientProxyMock.swift b/ElementX/Sources/Mocks/ClientProxyMock.swift index 6525c2131d..b57060f6e7 100644 --- a/ElementX/Sources/Mocks/ClientProxyMock.swift +++ b/ElementX/Sources/Mocks/ClientProxyMock.swift @@ -63,7 +63,6 @@ extension ClientProxyMock { setUserAvatarMediaReturnValue = .failure(.sdkError(ClientProxyMockError.generic)) removeUserAvatarReturnValue = .failure(.sdkError(ClientProxyMockError.generic)) isAliasAvailableReturnValue = .success(true) - logoutReturnValue = nil searchUsersSearchTermLimitReturnValue = .success(.init(results: [], limited: false)) profileForReturnValue = .success(.init(userID: "@a:b.com", displayName: "Some user")) ignoreUserReturnValue = .success(()) diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 0c57901e6f..969e54dfce 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -3658,40 +3658,11 @@ class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable { var logoutCalled: Bool { return logoutCallsCount > 0 } + var logoutClosure: (() async -> Void)? - var logoutUnderlyingReturnValue: URL? - var logoutReturnValue: URL? { - get { - if Thread.isMainThread { - return logoutUnderlyingReturnValue - } else { - var returnValue: URL?? = nil - DispatchQueue.main.sync { - returnValue = logoutUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - logoutUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - logoutUnderlyingReturnValue = newValue - } - } - } - } - var logoutClosure: (() async -> URL?)? - - func logout() async -> URL? { + func logout() async { logoutCallsCount += 1 - if let logoutClosure = logoutClosure { - return await logoutClosure() - } else { - return logoutReturnValue - } + await logoutClosure?() } //MARK: - setPusher diff --git a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift index 836b351b72..d8cf502a17 100644 --- a/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift @@ -2526,43 +2526,14 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable { open var logoutCalled: Bool { return logoutCallsCount > 0 } + open var logoutClosure: (() async throws -> Void)? - var logoutUnderlyingReturnValue: String? - open var logoutReturnValue: String? { - get { - if Thread.isMainThread { - return logoutUnderlyingReturnValue - } else { - var returnValue: String?? = nil - DispatchQueue.main.sync { - returnValue = logoutUnderlyingReturnValue - } - - return returnValue! - } - } - set { - if Thread.isMainThread { - logoutUnderlyingReturnValue = newValue - } else { - DispatchQueue.main.sync { - logoutUnderlyingReturnValue = newValue - } - } - } - } - open var logoutClosure: (() async throws -> String?)? - - open override func logout() async throws -> String? { + open override func logout() async throws { if let error = logoutThrowableError { throw error } logoutCallsCount += 1 - if let logoutClosure = logoutClosure { - return try await logoutClosure() - } else { - return logoutReturnValue - } + try await logoutClosure?() } //MARK: - notificationClient diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index 10fced0d8c..5a3de15fea 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -584,12 +584,11 @@ class ClientProxy: ClientProxyProtocol { } } - func logout() async -> URL? { + func logout() async { do { - return try await client.logout().flatMap(URL.init(string:)) + try await client.logout() } catch { MXLog.error("Failed logging out with error: \(error)") - return nil } } diff --git a/ElementX/Sources/Services/Client/ClientProxyProtocol.swift b/ElementX/Sources/Services/Client/ClientProxyProtocol.swift index f659f5f3c6..f5f28776ce 100644 --- a/ElementX/Sources/Services/Client/ClientProxyProtocol.swift +++ b/ElementX/Sources/Services/Client/ClientProxyProtocol.swift @@ -154,7 +154,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol { func deactivateAccount(password: String?, eraseData: Bool) async -> Result - func logout() async -> URL? + func logout() async func setPusher(with configuration: PusherConfiguration) async throws diff --git a/Package.resolved b/Package.resolved index 84a94fb1d3..4226759bac 100644 --- a/Package.resolved +++ b/Package.resolved @@ -22,8 +22,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/jpsim/Yams", "state" : { - "revision" : "2688707e563b44d7d87c29ba6c5ca04ce86ae58b", - "version" : "5.3.0" + "revision" : "b4b8042411dc7bbb696300a34a4bf3ba1b7ad19b", + "version" : "5.3.1" } } ], diff --git a/project.yml b/project.yml index b80e109547..932c4c680f 100644 --- a/project.yml +++ b/project.yml @@ -61,7 +61,7 @@ packages: # Element/Matrix dependencies MatrixRustSDK: url: https://github.com/element-hq/matrix-rust-components-swift - exactVersion: 25.02.17 + exactVersion: 25.02.25 # path: ../matrix-rust-sdk Compound: url: https://github.com/element-hq/compound-ios