From c740fb1c1f43bb7c24aa77f72bd346d6fb6fd26b Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 9 Mar 2024 18:27:44 -0500 Subject: [PATCH] Change status/account cell separator insets --- Tusker/Screens/Explore/TrendsViewController.swift | 6 ++++++ Tusker/Screens/Profile/ProfileStatusesViewController.swift | 1 + Tusker/Screens/Search/SearchResultsViewController.swift | 2 +- .../StatusActionAccountListCollectionViewController.swift | 6 ++++++ Tusker/Views/Status/TimelineStatusCollectionViewCell.swift | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Tusker/Screens/Explore/TrendsViewController.swift b/Tusker/Screens/Explore/TrendsViewController.swift index 765eccef..d275cff7 100644 --- a/Tusker/Screens/Explore/TrendsViewController.swift +++ b/Tusker/Screens/Explore/TrendsViewController.swift @@ -102,6 +102,12 @@ class TrendsViewController: UIViewController, CollectionViewController { config.topSeparatorVisibility = .hidden config.bottomSeparatorVisibility = .hidden } + if config.topSeparatorInsets != .zero { + config.topSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets + } + if config.bottomSeparatorInsets != .zero { + config.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets + } return config } return .list(using: listConfig, layoutEnvironment: environment) diff --git a/Tusker/Screens/Profile/ProfileStatusesViewController.swift b/Tusker/Screens/Profile/ProfileStatusesViewController.swift index 2241c035..d687a649 100644 --- a/Tusker/Screens/Profile/ProfileStatusesViewController.swift +++ b/Tusker/Screens/Profile/ProfileStatusesViewController.swift @@ -78,6 +78,7 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie } else if indexPath.row == 0 && (section == .pinned || section == .entries) { // TODO: row == 0 isn't technically right, the top post could be filtered out config.topSeparatorInsets = .zero + config.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets } else if case .status(id: _, collapseState: _, filterState: let filterState, pinned: _) = item, filterer.isKnownHide(state: filterState) { config.topSeparatorVisibility = .hidden diff --git a/Tusker/Screens/Search/SearchResultsViewController.swift b/Tusker/Screens/Search/SearchResultsViewController.swift index 6d339d1b..89d9fa05 100644 --- a/Tusker/Screens/Search/SearchResultsViewController.swift +++ b/Tusker/Screens/Search/SearchResultsViewController.swift @@ -93,7 +93,7 @@ class SearchResultsViewController: UIViewController, CollectionViewController { config.trailingSwipeActionsConfigurationProvider = { [unowned self] in (self.collectionView.cellForItem(at: $0) as? TimelineStatusCollectionViewCell)?.trailingSwipeActions() } - if sectionIdentifier == .statuses { + if sectionIdentifier == .statuses || sectionIdentifier == .accounts { config.separatorConfiguration.topSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets config.separatorConfiguration.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets } diff --git a/Tusker/Screens/Status Action Account List/StatusActionAccountListCollectionViewController.swift b/Tusker/Screens/Status Action Account List/StatusActionAccountListCollectionViewController.swift index 55c32056..ed6af405 100644 --- a/Tusker/Screens/Status Action Account List/StatusActionAccountListCollectionViewController.swift +++ b/Tusker/Screens/Status Action Account List/StatusActionAccountListCollectionViewController.swift @@ -57,6 +57,12 @@ class StatusActionAccountListCollectionViewController: UIViewController, Collect config.topSeparatorVisibility = .hidden config.bottomSeparatorVisibility = .hidden } + if config.topSeparatorInsets != .zero { + config.topSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets + } + if config.bottomSeparatorInsets != .zero { + config.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets + } return config } let layout = UICollectionViewCompositionalLayout { [unowned self] sectionIndex, environment in diff --git a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift index f2c13679..76426f5f 100644 --- a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift @@ -15,7 +15,7 @@ private let hashtagIcon = UIImage(systemName: "number") class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollectionViewCell { - static let separatorInsets = NSDirectionalEdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 0) + static let separatorInsets = NSDirectionalEdgeInsets(top: 0, leading: 16 + 50 + 8, bottom: 0, trailing: 0) static let contentFont = UIFontMetrics.default.scaledFont(for: .systemFont(ofSize: 16)) static let monospaceFont = UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 16, weight: .regular)) static let contentParagraphStyle = HTMLConverter.defaultParagraphStyle