[ios] remove spacing and separator from the Track recording Place page

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn
2025-06-16 12:48:58 +04:00
committed by Konstantin Pastbin
parent 18be61e789
commit a88798fbf2
3 changed files with 20 additions and 7 deletions

View File

@@ -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 }
}

View File

@@ -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

View File

@@ -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,25 +190,29 @@ 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)
}
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)
if showSeparator {
viewController.view.addSeparator(.top)
viewController.view.addSeparator(.bottom)
}
}
}
private func cleanupLayout() {
layout?.actionBar?.view.removeFromSuperview()