From a88798fbf2562e9cc6139103acabd9a9e6db506d Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Mon, 16 Jun 2025 12:48:58 +0400 Subject: [PATCH] [ios] remove spacing and separator from the Track recording Place page Signed-off-by: Kiryl Kaveryn --- .../Layouts/IPlacePageLayout.swift | 5 +++++ .../PlacePageTrackRecordingLayout.swift | 2 ++ .../PlacePage/PlacePageViewController.swift | 20 ++++++++++++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/IPlacePageLayout.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/IPlacePageLayout.swift index ca8cc8945..d9f22c472 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/IPlacePageLayout.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/IPlacePageLayout.swift @@ -28,6 +28,11 @@ protocol IPlacePageLayout: AnyObject { var bodyViewControllers: [UIViewController] { get } var actionBar: ActionBarViewController? { get } var navigationBar: UIViewController? { get } + var sectionSpacing: CGFloat { get } func calculateSteps(inScrollView scrollView: UIScrollView, compact: Bool) -> [PlacePageState] } + +extension IPlacePageLayout { + var sectionSpacing: CGFloat { return 24.0 } +} diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/PlacePageTrackRecordingLayout.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/PlacePageTrackRecordingLayout.swift index 5dba5ce43..bbb458426 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/PlacePageTrackRecordingLayout.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/PlacePageTrackRecordingLayout.swift @@ -53,6 +53,8 @@ final class PlacePageTrackRecordingLayout: IPlacePageLayout { return vc }() + var sectionSpacing: CGFloat { 0.0 } + init(interactor: PlacePageInteractor, storyboard: UIStoryboard, data: PlacePageData) { self.interactor = interactor self.storyboard = storyboard diff --git a/iphone/Maps/UI/PlacePage/PlacePageViewController.swift b/iphone/Maps/UI/PlacePage/PlacePageViewController.swift index baa78ccfe..ec2e2eab5 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageViewController.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageViewController.swift @@ -176,8 +176,10 @@ final class PlacePageScrollView: UIScrollView { private func setupLayout(_ layout: IPlacePageLayout) { setLayout(layout) - fillHeader(with: layout.headerViewControllers) - fillBody(with: layout.bodyViewControllers) + let showSeparator = layout.sectionSpacing > 0 + stackView.spacing = layout.sectionSpacing + fillHeader(with: layout.headerViewControllers, showSeparator: showSeparator) + fillBody(with: layout.bodyViewControllers, showSeparator: showSeparator) beginDragging = false if let actionBar = layout.actionBar { @@ -188,23 +190,27 @@ final class PlacePageScrollView: UIScrollView { } } - private func fillHeader(with viewControllers: [UIViewController]) { + private func fillHeader(with viewControllers: [UIViewController], showSeparator: Bool = true) { viewControllers.forEach { [self] viewController in if !stackView.arrangedSubviews.contains(headerStackView) { stackView.addArrangedSubview(headerStackView) } headerStackView.addArrangedSubview(viewController.view) } - headerStackView.addSeparator(.bottom) + if showSeparator { + headerStackView.addSeparator(.bottom) + } } - private func fillBody(with viewControllers: [UIViewController]) { + private func fillBody(with viewControllers: [UIViewController], showSeparator: Bool = true) { viewControllers.forEach { [self] viewController in addChild(viewController) stackView.addArrangedSubview(viewController.view) viewController.didMove(toParent: self) - viewController.view.addSeparator(.top) - viewController.view.addSeparator(.bottom) + if showSeparator { + viewController.view.addSeparator(.top) + viewController.view.addSeparator(.bottom) + } } }