mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
AuthenticatedSessionViewControllerFactory: Update with Steve's remarks
This commit is contained in:
parent
7de6dcf2fd
commit
2b7e71fda8
1 changed files with 4 additions and 13 deletions
|
@ -41,8 +41,6 @@ final class AuthenticatedSessionViewControllerFactory: NSObject {
|
|||
|
||||
// MARK: - Constants
|
||||
|
||||
static let errorDomain = "AuthenticatedSessionViewControllerFactoryErrorDomain"
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -88,7 +86,7 @@ final class AuthenticatedSessionViewControllerFactory: NSObject {
|
|||
}
|
||||
|
||||
guard let authenticationSession = authenticationSession, let flows = authenticationSession.flows else {
|
||||
onFailure(self.unsupportedFlowError())
|
||||
onFailure(AuthenticatedSessionViewControllerFactoryError.flowNotSupported)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -103,7 +101,7 @@ final class AuthenticatedSessionViewControllerFactory: NSObject {
|
|||
onViewController(authViewController)
|
||||
} else {
|
||||
// Flow not supported yet
|
||||
onFailure(self.unsupportedFlowError())
|
||||
onFailure(AuthenticatedSessionViewControllerFactoryError.flowNotSupported)
|
||||
}
|
||||
|
||||
}, failure: { (error) in
|
||||
|
@ -158,13 +156,6 @@ final class AuthenticatedSessionViewControllerFactory: NSObject {
|
|||
|
||||
// MARK: - Private methods
|
||||
|
||||
private func unsupportedFlowError() -> NSError {
|
||||
return NSError(domain: AuthenticatedSessionViewControllerFactory.errorDomain,
|
||||
code: AuthenticatedSessionViewControllerFactoryErrorCode.flowNotSupported.rawValue,
|
||||
userInfo: [NSLocalizedDescriptionKey: VectorL10n.authenticatedSessionFlowNotSupported])
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Password flow
|
||||
|
||||
private func hasPasswordFlow(inFlows flows: [MXLoginFlow]) -> Bool {
|
||||
|
@ -183,7 +174,7 @@ final class AuthenticatedSessionViewControllerFactory: NSObject {
|
|||
authenticationSession: MXAuthenticationSession,
|
||||
onAuthenticated: @escaping ([String: Any]) -> Void,
|
||||
onCancelled: @escaping () -> Void,
|
||||
onFailure: @escaping (NSError) -> Void) -> UIViewController {
|
||||
onFailure: @escaping (Error) -> Void) -> UIViewController {
|
||||
|
||||
// Use a simple UIAlertController as before
|
||||
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
||||
|
@ -206,7 +197,7 @@ final class AuthenticatedSessionViewControllerFactory: NSObject {
|
|||
}
|
||||
|
||||
guard let authParams = self.createAuthParams(password: password, authenticationSession: authenticationSession) else {
|
||||
onFailure(self.unsupportedFlowError())
|
||||
onFailure(AuthenticatedSessionViewControllerFactoryError.flowNotSupported)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue