Change status/account cell separator insets

This commit is contained in:
Shadowfacts 2024-03-09 18:27:44 -05:00
parent 175001d561
commit c740fb1c1f
5 changed files with 15 additions and 2 deletions

View File

@ -102,6 +102,12 @@ class TrendsViewController: UIViewController, CollectionViewController {
config.topSeparatorVisibility = .hidden config.topSeparatorVisibility = .hidden
config.bottomSeparatorVisibility = .hidden config.bottomSeparatorVisibility = .hidden
} }
if config.topSeparatorInsets != .zero {
config.topSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets
}
if config.bottomSeparatorInsets != .zero {
config.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets
}
return config return config
} }
return .list(using: listConfig, layoutEnvironment: environment) return .list(using: listConfig, layoutEnvironment: environment)

View File

@ -78,6 +78,7 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
} else if indexPath.row == 0 && (section == .pinned || section == .entries) { } else if indexPath.row == 0 && (section == .pinned || section == .entries) {
// TODO: row == 0 isn't technically right, the top post could be filtered out // TODO: row == 0 isn't technically right, the top post could be filtered out
config.topSeparatorInsets = .zero config.topSeparatorInsets = .zero
config.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets
} else if case .status(id: _, collapseState: _, filterState: let filterState, pinned: _) = item, } else if case .status(id: _, collapseState: _, filterState: let filterState, pinned: _) = item,
filterer.isKnownHide(state: filterState) { filterer.isKnownHide(state: filterState) {
config.topSeparatorVisibility = .hidden config.topSeparatorVisibility = .hidden

View File

@ -93,7 +93,7 @@ class SearchResultsViewController: UIViewController, CollectionViewController {
config.trailingSwipeActionsConfigurationProvider = { [unowned self] in config.trailingSwipeActionsConfigurationProvider = { [unowned self] in
(self.collectionView.cellForItem(at: $0) as? TimelineStatusCollectionViewCell)?.trailingSwipeActions() (self.collectionView.cellForItem(at: $0) as? TimelineStatusCollectionViewCell)?.trailingSwipeActions()
} }
if sectionIdentifier == .statuses { if sectionIdentifier == .statuses || sectionIdentifier == .accounts {
config.separatorConfiguration.topSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets config.separatorConfiguration.topSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets
config.separatorConfiguration.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets config.separatorConfiguration.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets
} }

View File

@ -57,6 +57,12 @@ class StatusActionAccountListCollectionViewController: UIViewController, Collect
config.topSeparatorVisibility = .hidden config.topSeparatorVisibility = .hidden
config.bottomSeparatorVisibility = .hidden config.bottomSeparatorVisibility = .hidden
} }
if config.topSeparatorInsets != .zero {
config.topSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets
}
if config.bottomSeparatorInsets != .zero {
config.bottomSeparatorInsets = TimelineStatusCollectionViewCell.separatorInsets
}
return config return config
} }
let layout = UICollectionViewCompositionalLayout { [unowned self] sectionIndex, environment in let layout = UICollectionViewCompositionalLayout { [unowned self] sectionIndex, environment in

View File

@ -15,7 +15,7 @@ private let hashtagIcon = UIImage(systemName: "number")
class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollectionViewCell { 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 contentFont = UIFontMetrics.default.scaledFont(for: .systemFont(ofSize: 16))
static let monospaceFont = UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 16, weight: .regular)) static let monospaceFont = UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 16, weight: .regular))
static let contentParagraphStyle = HTMLConverter.defaultParagraphStyle static let contentParagraphStyle = HTMLConverter.defaultParagraphStyle