Skip to content

Commit

Permalink
Bump the RustSDK to v25.2.25, address breaking changes from matrix-or…
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Feb 25, 2025
1 parent 6ded867 commit 37f353b
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 83 deletions.
2 changes: 1 addition & 1 deletion ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : {
"revision" : "422d7bef3ffd3edcb3e30afb410ee523f5659adc",
"version" : "25.2.17"
"revision" : "d5556ad7857c79f53804fbae17cc5232bc2ac493",
"version" : "25.2.25"
}
},
{
Expand Down
10 changes: 2 additions & 8 deletions ElementX/Sources/Application/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
}
}
Expand Down
1 change: 0 additions & 1 deletion ElementX/Sources/Mocks/ClientProxyMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
35 changes: 3 additions & 32 deletions ElementX/Sources/Mocks/Generated/GeneratedMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
35 changes: 3 additions & 32 deletions ElementX/Sources/Mocks/Generated/SDKGeneratedMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions ElementX/Sources/Services/Client/ClientProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Services/Client/ClientProxyProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {

func deactivateAccount(password: String?, eraseData: Bool) async -> Result<Void, ClientProxyError>

func logout() async -> URL?
func logout() async

func setPusher(with configuration: PusherConfiguration) async throws

Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 37f353b

Please sign in to comment.