diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm index 28ce4fe03..ec7aad922 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/TrafficButton/MWMTrafficButtonViewController.mm @@ -89,11 +89,9 @@ NSArray *imagesWithName(NSString *name) { auto const fitInAvailableArea = CGRectGetMaxY(self.view.frame) < CGRectGetMaxY(availableArea) + kTopOffset; auto const shouldHide = self.hidden || !fitInAvailableArea; auto const leftOffset = shouldHide ? -self.view.width : availableArea.origin.x + kViewControlsOffsetToBounds; - [self.view.superview animateConstraintsWithAnimations:^{ - self.topOffset.constant = availableArea.origin.y + kTopOffset; - self.leftOffset.constant = leftOffset; - self.view.alpha = shouldHide ? 0 : 1; - }]; + self.topOffset.constant = availableArea.origin.y + kTopOffset; + self.leftOffset.constant = leftOffset; + self.view.alpha = shouldHide ? 0 : 1; }); } diff --git a/iphone/Maps/Model/Settings Types/LeftButtonType.swift b/iphone/Maps/Model/Settings Types/LeftButtonType.swift index b34837acd..4f90c5feb 100644 --- a/iphone/Maps/Model/Settings Types/LeftButtonType.swift +++ b/iphone/Maps/Model/Settings Types/LeftButtonType.swift @@ -39,7 +39,7 @@ extension Settings { case .addPlace: return UIImage(systemName: "plus", withConfiguration: configuration)! case .recordTrack: - return UIImage.MainButtons.LeftButton.recordTrack.withConfiguration(configuration) + return UIImage(systemName: "record.circle", withConfiguration: configuration)! case .settings: return UIImage(systemName: "gearshape.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 22, weight: .semibold))! case .help: diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarButton.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarButton.swift index cad9aef3b..18fb21e61 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarButton.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarButton.swift @@ -24,9 +24,6 @@ class BottomTabBarButtonRenderer { if let coloring = style.coloring { control.coloring = coloring } - if let imageName = style.mwmImage { - control.imageName = imageName - } if let backgroundColor = style.backgroundColor { control.backgroundColor = backgroundColor } diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift index c980a55d8..36d001298 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarInteractor.swift @@ -1,7 +1,6 @@ protocol BottomTabBarInteractorProtocol: AnyObject { func openSearch() func openLeftButton() - func openFaq() func openBookmarks() func openMenu() } @@ -55,10 +54,6 @@ extension BottomTabBarInteractor: BottomTabBarInteractorProtocol { } } - func openFaq() { - mapViewController?.openAbout() - } - func openBookmarks() { mapViewController?.bookmarksCoordinator.open() } diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarPresenter.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarPresenter.swift index d51a40d78..0785b144b 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarPresenter.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarPresenter.swift @@ -1,7 +1,7 @@ protocol BottomTabBarPresenterProtocol: AnyObject { func configure() + func onLeftButtonPressed() func onSearchButtonPressed() - func onLeftButtonPressed(withBadge: Bool) func onBookmarksButtonPressed() func onMenuButtonPressed() } @@ -17,15 +17,15 @@ class BottomTabBarPresenter: NSObject { extension BottomTabBarPresenter: BottomTabBarPresenterProtocol { func configure() { } + + func onLeftButtonPressed() { + interactor.openLeftButton() + } func onSearchButtonPressed() { interactor.openSearch() } - func onLeftButtonPressed(withBadge: Bool) { - withBadge ? interactor.openFaq() : interactor.openLeftButton() - } - func onBookmarksButtonPressed() { interactor.openBookmarks() } diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift index cae58191b..0c586f5e2 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.swift @@ -1,19 +1,16 @@ -private let kUDDidShowFirstTimeRoutingEducationalHint = "kUDDidShowFirstTimeRoutingEducationalHint" - class BottomTabBarViewController: UIViewController { var presenter: BottomTabBarPresenterProtocol! - - @IBOutlet var searchButton: MWMButton! - @IBOutlet var searchConstraintWithLeftButton: NSLayoutConstraint! - @IBOutlet var searchConstraintWithoutLeftButton: NSLayoutConstraint! - @IBOutlet var leftButton: MWMButton! - @IBOutlet var bookmarksButton: MWMButton! - @IBOutlet var bookmarksConstraintWithLeftButton: NSLayoutConstraint! - @IBOutlet var bookmarksConstraintWithoutLeftButton: NSLayoutConstraint! - @IBOutlet var moreButton: MWMButton! - @IBOutlet var downloadBadge: UIView! - @IBOutlet var leftButtonBadge: UIView! + + @IBOutlet var leftButton: MWMButton? + @IBOutlet var searchButton: MWMButton? + @IBOutlet var searchConstraintWithLeftButton: NSLayoutConstraint? + @IBOutlet var searchConstraintWithoutLeftButton: NSLayoutConstraint? + @IBOutlet var bookmarksButton: MWMButton? + @IBOutlet var bookmarksConstraintWithLeftButton: NSLayoutConstraint? + @IBOutlet var bookmarksConstraintWithoutLeftButton: NSLayoutConstraint? + @IBOutlet var moreButton: MWMButton? + @IBOutlet var downloadBadge: UIView? private var avaliableArea = CGRect.zero @objc var isHidden: Bool = false { @@ -47,7 +44,7 @@ class BottomTabBarViewController: UIViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - leftButton.imageView?.contentMode = .scaleAspectFit + leftButton?.imageView?.contentMode = .scaleAspectFit updateBadge() } @@ -65,12 +62,7 @@ class BottomTabBarViewController: UIViewController { } @IBAction func onLeftButtonPressed(_ sender: Any) { - if !leftButtonBadge.isHidden { - presenter.onLeftButtonPressed(withBadge: true) - setLeftButtonBadgeShown() - } else { - presenter.onLeftButtonPressed(withBadge: false) - } + presenter.onLeftButtonPressed() } @IBAction func onBookmarksButtonPressed(_ sender: Any) { @@ -113,41 +105,27 @@ class BottomTabBarViewController: UIViewController { private func updateLeftButton() { let leftButtonType = Settings.leftButtonType if leftButtonType == .hidden { - leftButton.isHidden = true - leftButtonBadge.isHidden = true + leftButton?.isHidden = true if let searchConstraintWithLeftButton, let searchConstraintWithoutLeftButton, let bookmarksConstraintWithLeftButton, let bookmarksConstraintWithoutLeftButton { - NSLayoutConstraint.deactivate([searchConstraintWithLeftButton, bookmarksConstraintWithLeftButton]) NSLayoutConstraint.activate([searchConstraintWithoutLeftButton, bookmarksConstraintWithoutLeftButton]) + NSLayoutConstraint.deactivate([searchConstraintWithLeftButton, bookmarksConstraintWithLeftButton]) } } else { - leftButton.isHidden = false - leftButtonBadge.isHidden = !needsToShowleftButtonBadge() + leftButton?.isHidden = false - leftButton.setTitle(nil, for: .normal) - leftButton.setImage(leftButtonType.image, for: .normal) - leftButton.accessibilityLabel = leftButtonType.description; + leftButton?.setTitle(nil, for: .normal) + leftButton?.setImage(leftButtonType.image, for: .normal) + leftButton?.accessibilityLabel = leftButtonType.description; if let searchConstraintWithLeftButton, let searchConstraintWithoutLeftButton, let bookmarksConstraintWithLeftButton, let bookmarksConstraintWithoutLeftButton { - NSLayoutConstraint.deactivate([searchConstraintWithoutLeftButton, bookmarksConstraintWithoutLeftButton]) NSLayoutConstraint.activate([searchConstraintWithLeftButton, bookmarksConstraintWithLeftButton]) + NSLayoutConstraint.deactivate([searchConstraintWithoutLeftButton, bookmarksConstraintWithoutLeftButton]) } } } private func updateBadge() { - downloadBadge.isHidden = isApplicationBadgeHidden - leftButtonBadge.isHidden = !needsToShowleftButtonBadge() || Settings.leftButtonType == .hidden - } -} - -// MARK: - Help badge -private extension BottomTabBarViewController { - private func needsToShowleftButtonBadge() -> Bool { - !UserDefaults.standard.bool(forKey: kUDDidShowFirstTimeRoutingEducationalHint) - } - - private func setLeftButtonBadgeShown() { - UserDefaults.standard.set(true, forKey: kUDDidShowFirstTimeRoutingEducationalHint) + downloadBadge?.isHidden = isApplicationBadgeHidden } } diff --git a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.xib b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.xib index 4794d09f2..2a76e2c30 100644 --- a/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.xib +++ b/iphone/Maps/UI/BottomMenu/TabBar/BottomTabBarViewController.xib @@ -1,9 +1,9 @@ - + - + @@ -15,7 +15,6 @@ - @@ -39,7 +38,7 @@ - + @@ -94,37 +93,21 @@ - - - - - - - - - - - - - - - - + - - + @@ -157,9 +140,9 @@ - +