diff --git a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m index 806e10cff..fa44c7050 100644 --- a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m +++ b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m @@ -655,6 +655,20 @@ enum { } - (void)removeDevice +{ + NSURL *logoutURL = [self.mainSession.homeserverWellknown.authentication getMasLogoutDeviceURLFromDeviceID:device.deviceId]; + if (logoutURL) + { + [UIApplication.sharedApplication openURL:logoutURL options:@{} completionHandler:nil]; + [self withdrawViewControllerAnimated:YES completion:nil]; + } + else + { + [self removeDeviceThroughAPI]; + } +} + +-(void) removeDeviceThroughAPI { [self startActivityIndicator]; self.view.userInteractionEnabled = NO; diff --git a/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift b/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift index 79fd9e573..a3fc8e212 100644 --- a/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift +++ b/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift @@ -123,7 +123,11 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable { if sessionInfo.isCurrent { self.showLogoutConfirmationForCurrentSession() } else { - self.showLogoutConfirmation(for: [sessionInfo]) + if let logoutURL = self.parameters.session.homeserverWellknown.authentication?.getMasLogoutDeviceURL(fromDeviceID: sessionInfo.id) { + self.openMasLogoutURL(logoutURL) + } else { + self.showLogoutConfirmation(for: [sessionInfo]) + } } case let .showSessionStateInfo(sessionInfo): self.showInfoSheet(parameters: .init(userSessionInfo: sessionInfo, parentSize: self.toPresentable().view.bounds.size)) @@ -182,6 +186,11 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable { return UserOtherSessionsCoordinator(parameters: parameters) } + private func openMasLogoutURL(_ url: URL) { + UIApplication.shared.open(url) + popToSessionsOverview() + } + /// Shows a confirmation dialog to the user to sign out of a session. private func showLogoutConfirmation(for sessionInfos: [UserSessionInfo]) { // Use a UIAlertController as we don't have confirmationDialog in SwiftUI on iOS 14. diff --git a/changelog.d/7646.bugfix b/changelog.d/7646.bugfix new file mode 100644 index 000000000..aaae87297 --- /dev/null +++ b/changelog.d/7646.bugfix @@ -0,0 +1 @@ +You can now log out from other sessions using MAS on supported OIDC home servers. \ No newline at end of file