From 4ac1866920048ad25a94d882c6331eb291938d47 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Mon, 28 Jan 2019 17:14:21 +0300 Subject: [PATCH] [ios][ugc] show toast when review is submitted. --- .../UGC/UGCAddReview/UGCAddReviewController.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.swift index a33e1199ff..5873df81f8 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Content/UGC/UGCAddReview/UGCAddReviewController.swift @@ -65,13 +65,24 @@ final class UGCAddReviewController: MWMTableViewController { model.text = text onSave(model) guard let nc = navigationController else { return } + let onSuccess = { Toast.toast(withText: L("ugc_thanks_message_auth")).show() } + let onError = { Toast.toast(withText: L("ugc_thanks_message_not_auth")).show() } + let onComplete = { () -> Void in nc.popToRootViewController(animated: true) } + if MWMAuthorizationViewModel.isAuthenticated() || MWMPlatform.networkConnectionType() == .none { + if MWMAuthorizationViewModel.isAuthenticated() { + onSuccess() + } else { + onError() + } nc.popViewController(animated: true) } else { Statistics.logEvent(kStatUGCReviewAuthShown, withParameters: [kStatFrom: kStatAfterSave]) let authVC = AuthorizationViewController(barButtonItem: navigationItem.rightBarButtonItem!, sourceComponent: .UGC, - completionHandler: { _ in nc.popToRootViewController(animated: true) }) + successHandler: {_ in onSuccess()}, + errorHandler: {_ in onError()}, + completionHandler: {_ in onComplete()}) present(authVC, animated: true, completion: nil) } }