forked from organicmaps/organicmaps
[MAPSME-7010] [ios] Fixed authorization controller.
This commit is contained in:
parent
185c7881d6
commit
18b06e42e9
2 changed files with 12 additions and 10 deletions
|
@ -97,13 +97,10 @@ final class BMCViewController: MWMViewController {
|
|||
MWMAuthorizationViewModel.checkAuthentication(with: .bookmarks, onComplete: onComplete)
|
||||
} else {
|
||||
let authVC = AuthorizationViewController(popoverSourceView: anchor,
|
||||
permittedArrowDirections: .any,
|
||||
sourceComponent: .bookmarks,
|
||||
permittedArrowDirections: .any,
|
||||
successHandler: { _ in onComplete(true) },
|
||||
errorHandler: { _ in onComplete(false) },
|
||||
completionHandler: {
|
||||
$0.dismiss(animated: true, completion: nil)
|
||||
})
|
||||
errorHandler: { _ in onComplete(false) })
|
||||
present(authVC, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ final class AuthorizationViewController: MWMViewController {
|
|||
private let sourceComponent: MWMAuthorizationSource
|
||||
private let successHandler: SuccessHandler?
|
||||
private let errorHandler: ErrorHandler?
|
||||
private let completionHandler: CompletionHandler
|
||||
private let completionHandler: CompletionHandler?
|
||||
|
||||
private func addConstraints(v1: UIView, v2: UIView) {
|
||||
[NSLayoutAttribute.top, .bottom, .left, .right].forEach {
|
||||
|
@ -112,7 +112,7 @@ final class AuthorizationViewController: MWMViewController {
|
|||
}
|
||||
|
||||
@objc
|
||||
init(barButtonItem: UIBarButtonItem?, sourceComponent: MWMAuthorizationSource, successHandler: SuccessHandler? = nil, errorHandler: ErrorHandler? = nil, completionHandler: @escaping CompletionHandler) {
|
||||
init(barButtonItem: UIBarButtonItem?, sourceComponent: MWMAuthorizationSource, successHandler: SuccessHandler? = nil, errorHandler: ErrorHandler? = nil, completionHandler: CompletionHandler? = nil) {
|
||||
self.sourceComponent = sourceComponent
|
||||
self.successHandler = successHandler
|
||||
self.errorHandler = errorHandler
|
||||
|
@ -124,7 +124,7 @@ final class AuthorizationViewController: MWMViewController {
|
|||
}
|
||||
|
||||
@objc
|
||||
init(popoverSourceView: UIView? = nil, permittedArrowDirections: UIPopoverArrowDirection = .unknown, sourceComponent: MWMAuthorizationSource, successHandler: SuccessHandler?, errorHandler: ErrorHandler?, completionHandler: @escaping CompletionHandler) {
|
||||
init(popoverSourceView: UIView? = nil, sourceComponent: MWMAuthorizationSource, permittedArrowDirections: UIPopoverArrowDirection = .unknown, successHandler: SuccessHandler? = nil, errorHandler: ErrorHandler? = nil, completionHandler: CompletionHandler? = nil) {
|
||||
self.sourceComponent = sourceComponent
|
||||
self.successHandler = successHandler
|
||||
self.errorHandler = errorHandler
|
||||
|
@ -154,7 +154,12 @@ final class AuthorizationViewController: MWMViewController {
|
|||
@IBAction func onCancel() {
|
||||
Statistics.logEvent(kStatUGCReviewAuthDeclined)
|
||||
errorHandler?(.cancelled)
|
||||
completionHandler(self)
|
||||
onClose()
|
||||
}
|
||||
|
||||
private func onClose() {
|
||||
dismiss(animated: true)
|
||||
completionHandler?(self)
|
||||
}
|
||||
|
||||
private func process(error: Error, type: MWMSocialTokenType) {
|
||||
|
@ -175,7 +180,7 @@ final class AuthorizationViewController: MWMViewController {
|
|||
self.errorHandler?(.passportError)
|
||||
}
|
||||
}
|
||||
completionHandler(self)
|
||||
onClose()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue