From abf0568398feace60613d98f1646406532864c6f Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 31 Mar 2024 15:55:35 -0400 Subject: [PATCH] Improve gallery presentation/dismissal animation layering --- Tusker/Views/Attachments/AttachmentsContainerView.swift | 1 - Tusker/Views/Profile Header/ProfileHeaderView.swift | 6 +++++- .../Status/ConversationMainStatusCollectionViewCell.swift | 2 ++ Tusker/Views/Status/TimelineStatusCollectionViewCell.swift | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Tusker/Views/Attachments/AttachmentsContainerView.swift b/Tusker/Views/Attachments/AttachmentsContainerView.swift index f75b7937..666ccd4d 100644 --- a/Tusker/Views/Attachments/AttachmentsContainerView.swift +++ b/Tusker/Views/Attachments/AttachmentsContainerView.swift @@ -57,7 +57,6 @@ class AttachmentsContainerView: UIView { private func commonInit() { self.isUserInteractionEnabled = true self.layer.cornerRadius = 5 - self.layer.masksToBounds = true createBlurView() createHideButton() diff --git a/Tusker/Views/Profile Header/ProfileHeaderView.swift b/Tusker/Views/Profile Header/ProfileHeaderView.swift index 38a1ac24..3628a020 100644 --- a/Tusker/Views/Profile Header/ProfileHeaderView.swift +++ b/Tusker/Views/Profile Header/ProfileHeaderView.swift @@ -66,8 +66,9 @@ class ProfileHeaderView: UIView { backgroundColor = .appBackground avatarContainerView.backgroundColor = .appBackground - avatarContainerView.layer.masksToBounds = true avatarContainerView.layer.cornerCurve = .continuous + // Set zPositions so the gallery presentation/dismissal animation looks correct. + avatarContainerView.layer.zPosition = 2 avatarImageView.layer.masksToBounds = true avatarImageView.layer.cornerCurve = .continuous avatarImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(avatarPressed))) @@ -75,6 +76,7 @@ class ProfileHeaderView: UIView { headerImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(headerPressed))) headerImageView.isUserInteractionEnabled = true + headerImageView.layer.zPosition = 1 var config = UIButton.Configuration.plain() config.image = UIImage(systemName: "ellipsis") @@ -83,9 +85,11 @@ class ProfileHeaderView: UIView { moreButton.addInteraction(UIPointerInteraction(delegate: self)) moreButton.showsMenuAsPrimaryAction = true moreButton.isContextMenuInteractionEnabled = true + moreButton.layer.zPosition = 2 followButton.setNeedsUpdateConfiguration() followButton.addInteraction(UIPointerInteraction(delegate: self)) + followButton.layer.zPosition = 2 displayNameLabel.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: .systemFont(ofSize: 24, weight: .semibold)) displayNameLabel.adjustsFontForContentSizeCategory = true diff --git a/Tusker/Views/Status/ConversationMainStatusCollectionViewCell.swift b/Tusker/Views/Status/ConversationMainStatusCollectionViewCell.swift index 5955b6c0..8e67d528 100644 --- a/Tusker/Views/Status/ConversationMainStatusCollectionViewCell.swift +++ b/Tusker/Views/Status/ConversationMainStatusCollectionViewCell.swift @@ -131,6 +131,8 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status pollView, ] as! [any StatusContentView], useTopSpacer: true).configure { $0.setContentHuggingPriority(.defaultLow, for: .vertical) + // So that during gallery presentation/dismissal animations, the attachment view appears over everything else. + $0.layer.zPosition = 1 } let contentTextView = StatusContentTextView().configure { diff --git a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift index 76426f5f..e2d32b85 100644 --- a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift @@ -84,6 +84,8 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti metaIndicatorsView.trailingAnchor.constraint(equalTo: avatarImageView.trailingAnchor), metaIndicatorsTopConstraint, ]) + // So that during gallery presentation/dismissal animations, the attachment view appears over everything else. + $0.layer.zPosition = 1 } private static let avatarImageViewSize: CGFloat = 50