forked from shadowfacts/Tusker
Fix context menu presentation animation getting clipped in new status cells
This commit is contained in:
parent
fd6a4ba41c
commit
bcb3c24027
|
@ -357,11 +357,11 @@ extension TimelineViewController: MenuActionProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TimelineViewController: StatusCollectionViewCellDelegate {
|
extension TimelineViewController: StatusCollectionViewCellDelegate {
|
||||||
func statusCellNeedsReconfigure(_ cell: StatusCollectionViewCell, animated: Bool) {
|
func statusCellNeedsReconfigure(_ cell: StatusCollectionViewCell, animated: Bool, completion: (() -> Void)?) {
|
||||||
if let indexPath = collectionView.indexPath(for: cell) {
|
if let indexPath = collectionView.indexPath(for: cell) {
|
||||||
var snapshot = dataSource.snapshot()
|
var snapshot = dataSource.snapshot()
|
||||||
snapshot.reconfigureItems([dataSource.itemIdentifier(for: indexPath)!])
|
snapshot.reconfigureItems([dataSource.itemIdentifier(for: indexPath)!])
|
||||||
dataSource.apply(snapshot, animatingDifferences: animated)
|
dataSource.apply(snapshot, animatingDifferences: animated, completion: completion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import Combine
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
protocol StatusCollectionViewCellDelegate: AnyObject, TuskerNavigationDelegate, MenuActionProvider {
|
protocol StatusCollectionViewCellDelegate: AnyObject, TuskerNavigationDelegate, MenuActionProvider {
|
||||||
func statusCellNeedsReconfigure(_ cell: StatusCollectionViewCell, animated: Bool)
|
func statusCellNeedsReconfigure(_ cell: StatusCollectionViewCell, animated: Bool, completion: (() -> Void)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
|
@ -196,8 +196,13 @@ extension StatusCollectionViewCell {
|
||||||
extension StatusCollectionViewCell {
|
extension StatusCollectionViewCell {
|
||||||
func toggleCollapse() {
|
func toggleCollapse() {
|
||||||
statusState.collapsed!.toggle()
|
statusState.collapsed!.toggle()
|
||||||
|
// mask so that the content appears to expand with the container during the animation
|
||||||
|
// but only while the animation is taking place, otherwise the mask interferes with context menu presentation animation
|
||||||
|
contentContainer.layer.masksToBounds = true
|
||||||
// this delegate call causes the collection view to reconfigure this cell, at which point (and inside of the collection view's animation handling) we'll update the contentContainer
|
// this delegate call causes the collection view to reconfigure this cell, at which point (and inside of the collection view's animation handling) we'll update the contentContainer
|
||||||
delegate?.statusCellNeedsReconfigure(self, animated: true)
|
delegate?.statusCellNeedsReconfigure(self, animated: true) {
|
||||||
|
self.contentContainer.layer.masksToBounds = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func toggleFavorite() {
|
func toggleFavorite() {
|
||||||
|
|
|
@ -60,10 +60,7 @@ class StatusContentContainer: UIView {
|
||||||
zeroHeightConstraint.priority = .defaultLow
|
zeroHeightConstraint.priority = .defaultLow
|
||||||
|
|
||||||
setNeedsUpdateConstraints()
|
setNeedsUpdateConstraints()
|
||||||
|
|
||||||
// mask to bounds so that the during the expand/collapse animation, subviews are clipped
|
|
||||||
layer.masksToBounds = true
|
|
||||||
|
|
||||||
isHiddenObservations = arrangedSubviews.map {
|
isHiddenObservations = arrangedSubviews.map {
|
||||||
$0.observe(\.isHidden) { [unowned self] _, _ in
|
$0.observe(\.isHidden) { [unowned self] _, _ in
|
||||||
self.setNeedsUpdateConstraints()
|
self.setNeedsUpdateConstraints()
|
||||||
|
|
|
@ -474,7 +474,7 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
let oldState = actionsContainer.isHidden
|
let oldState = actionsContainer.isHidden
|
||||||
if oldState != Preferences.shared.hideActionsInTimeline {
|
if oldState != Preferences.shared.hideActionsInTimeline {
|
||||||
updateActionsVisibility()
|
updateActionsVisibility()
|
||||||
delegate?.statusCellNeedsReconfigure(self, animated: true)
|
delegate?.statusCellNeedsReconfigure(self, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue