mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 02:52:45 +02:00
Multi session logut
This commit is contained in:
@@ -22,10 +22,11 @@ class AuthenticatedEndpointRequest: NSObject {
|
||||
|
||||
let path: String
|
||||
let httpMethod: String
|
||||
|
||||
init(path: String, httpMethod: String) {
|
||||
let params: [String: Any]
|
||||
init(path: String, httpMethod: String, params: [String: Any]) {
|
||||
self.path = path
|
||||
self.httpMethod = httpMethod
|
||||
self.params = params
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
@@ -37,6 +38,15 @@ extension AuthenticatedEndpointRequest {
|
||||
/// - Parameter deviceID: The device ID that is to be deleted.
|
||||
static func deleteDevice(_ deviceID: String) -> AuthenticatedEndpointRequest {
|
||||
let path = String(format: "%@/devices/%@", kMXAPIPrefixPathR0, MXTools.encodeURIComponent(deviceID))
|
||||
return AuthenticatedEndpointRequest(path: path, httpMethod: "DELETE")
|
||||
return AuthenticatedEndpointRequest(path: path, httpMethod: "DELETE", params: [:])
|
||||
}
|
||||
}
|
||||
|
||||
extension AuthenticatedEndpointRequest {
|
||||
/// Create an authenticated request on `_matrix/client/r0/delete_devices`.
|
||||
/// - Parameter deviceID: The device ID that is to be deleted.
|
||||
static func deleteDevices(_ deviceIDs: [String]) -> AuthenticatedEndpointRequest {
|
||||
let path = String(format: "%@/delete_devices", kMXAPIPrefixPathR0)
|
||||
return AuthenticatedEndpointRequest(path: path, httpMethod: "POST", params: ["devices": deviceIDs])
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ final class UserInteractiveAuthenticationService: NSObject {
|
||||
success: @escaping (MXAuthenticationSession?) -> Void,
|
||||
failure: @escaping (Error) -> Void) -> MXHTTPOperation {
|
||||
// Get the authentication flow required for this API
|
||||
return self.session.matrixRestClient.authSessionForRequest(withMethod: request.httpMethod, path: request.path, parameters: [:], success: { [weak self] (authenticationSession) in
|
||||
return self.session.matrixRestClient.authSessionForRequest(withMethod: request.httpMethod, path: request.path, parameters: request.params, success: { [weak self] (authenticationSession) in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user