Compare commits
5 Commits
b4693252be
...
375ad25919
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 375ad25919 | |
Shadowfacts | abf0568398 | |
Shadowfacts | 2386f545e2 | |
Shadowfacts | 908c4ee085 | |
Shadowfacts | 23e5e87915 |
|
@ -25,6 +25,7 @@ class GalleryDismissInteraction: NSObject {
|
||||||
super.init()
|
super.init()
|
||||||
let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(panRecognized))
|
let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(panRecognized))
|
||||||
panRecognizer.delegate = self
|
panRecognizer.delegate = self
|
||||||
|
panRecognizer.allowedScrollTypesMask = .continuous
|
||||||
viewController.view.addGestureRecognizer(panRecognizer)
|
viewController.view.addGestureRecognizer(panRecognizer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,7 @@ class GalleryItemViewController: UIViewController {
|
||||||
shareButton.pointerStyleProvider = { button, effect, shape in
|
shareButton.pointerStyleProvider = { button, effect, shape in
|
||||||
return UIPointerStyle(effect: .highlight(effect.preview), shape: .roundedRect(button.frame))
|
return UIPointerStyle(effect: .highlight(effect.preview), shape: .roundedRect(button.frame))
|
||||||
}
|
}
|
||||||
|
shareButton.preferredBehavioralStyle = .pad
|
||||||
shareButton.translatesAutoresizingMaskIntoConstraints = false
|
shareButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
updateShareButton()
|
updateShareButton()
|
||||||
topControlsView.addSubview(shareButton)
|
topControlsView.addSubview(shareButton)
|
||||||
|
@ -118,6 +119,7 @@ class GalleryItemViewController: UIViewController {
|
||||||
closeButton.pointerStyleProvider = { button, effect, shape in
|
closeButton.pointerStyleProvider = { button, effect, shape in
|
||||||
return UIPointerStyle(effect: .highlight(effect.preview), shape: .roundedRect(button.frame))
|
return UIPointerStyle(effect: .highlight(effect.preview), shape: .roundedRect(button.frame))
|
||||||
}
|
}
|
||||||
|
closeButton.preferredBehavioralStyle = .pad
|
||||||
closeButton.translatesAutoresizingMaskIntoConstraints = false
|
closeButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
topControlsView.addSubview(closeButton)
|
topControlsView.addSubview(closeButton)
|
||||||
|
|
||||||
|
@ -152,10 +154,15 @@ class GalleryItemViewController: UIViewController {
|
||||||
updateCaptionTextView()
|
updateCaptionTextView()
|
||||||
bottomControlsView.addArrangedSubview(captionTextView)
|
bottomControlsView.addArrangedSubview(captionTextView)
|
||||||
|
|
||||||
closeButtonTrailingConstraint = topControlsView.trailingAnchor.constraint(equalTo: closeButton.trailingAnchor)
|
#if targetEnvironment(macCatalyst)
|
||||||
|
closeButtonTopConstraint = closeButton.topAnchor.constraint(equalTo: topControlsView.safeAreaLayoutGuide.topAnchor)
|
||||||
|
shareButtonTopConstraint = shareButton.topAnchor.constraint(equalTo: topControlsView.safeAreaLayoutGuide.topAnchor)
|
||||||
|
#else
|
||||||
closeButtonTopConstraint = closeButton.topAnchor.constraint(equalTo: topControlsView.topAnchor)
|
closeButtonTopConstraint = closeButton.topAnchor.constraint(equalTo: topControlsView.topAnchor)
|
||||||
shareButtonLeadingConstraint = shareButton.leadingAnchor.constraint(equalTo: topControlsView.leadingAnchor)
|
|
||||||
shareButtonTopConstraint = shareButton.topAnchor.constraint(equalTo: topControlsView.topAnchor)
|
shareButtonTopConstraint = shareButton.topAnchor.constraint(equalTo: topControlsView.topAnchor)
|
||||||
|
#endif
|
||||||
|
closeButtonTrailingConstraint = topControlsView.trailingAnchor.constraint(equalTo: closeButton.trailingAnchor)
|
||||||
|
shareButtonLeadingConstraint = shareButton.leadingAnchor.constraint(equalTo: topControlsView.leadingAnchor)
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||||
|
@ -191,6 +198,8 @@ class GalleryItemViewController: UIViewController {
|
||||||
doubleTap = UITapGestureRecognizer(target: self, action: #selector(viewDoublePressed))
|
doubleTap = UITapGestureRecognizer(target: self, action: #selector(viewDoublePressed))
|
||||||
doubleTap.delegate = self
|
doubleTap.delegate = self
|
||||||
doubleTap.numberOfTapsRequired = 2
|
doubleTap.numberOfTapsRequired = 2
|
||||||
|
// This is needed to prevent a delay between tapping a button on and the action firing on Catalyst and Designed for iPad
|
||||||
|
doubleTap.delaysTouchesEnded = false
|
||||||
// this requirement is needed to make sure the double tap is ever recognized
|
// this requirement is needed to make sure the double tap is ever recognized
|
||||||
singleTap.require(toFail: doubleTap)
|
singleTap.require(toFail: doubleTap)
|
||||||
view.addGestureRecognizer(singleTap)
|
view.addGestureRecognizer(singleTap)
|
||||||
|
|
|
@ -86,8 +86,8 @@ class GalleryPresentationAnimationController: NSObject, UIViewControllerAnimated
|
||||||
itemViewController.setControlsVisible(false, animated: false)
|
itemViewController.setControlsVisible(false, animated: false)
|
||||||
|
|
||||||
let duration = self.transitionDuration(using: transitionContext)
|
let duration = self.transitionDuration(using: transitionContext)
|
||||||
// rougly equivalent to duration: 0.4, bounce: 0.3
|
// rougly equivalent to duration: 0.35, bounce: 0.3
|
||||||
let spring = UISpringTimingParameters(mass: 1, stiffness: 247, damping: 22, initialVelocity: .zero)
|
let spring = UISpringTimingParameters(mass: 1, stiffness: 322, damping: 25, initialVelocity: .zero)
|
||||||
let animator = UIViewPropertyAnimator(duration: duration, timingParameters: spring)
|
let animator = UIViewPropertyAnimator(duration: duration, timingParameters: spring)
|
||||||
|
|
||||||
animator.addAnimations {
|
animator.addAnimations {
|
||||||
|
|
|
@ -57,7 +57,6 @@ class AttachmentsContainerView: UIView {
|
||||||
private func commonInit() {
|
private func commonInit() {
|
||||||
self.isUserInteractionEnabled = true
|
self.isUserInteractionEnabled = true
|
||||||
self.layer.cornerRadius = 5
|
self.layer.cornerRadius = 5
|
||||||
self.layer.masksToBounds = true
|
|
||||||
|
|
||||||
createBlurView()
|
createBlurView()
|
||||||
createHideButton()
|
createHideButton()
|
||||||
|
|
|
@ -66,8 +66,9 @@ class ProfileHeaderView: UIView {
|
||||||
backgroundColor = .appBackground
|
backgroundColor = .appBackground
|
||||||
|
|
||||||
avatarContainerView.backgroundColor = .appBackground
|
avatarContainerView.backgroundColor = .appBackground
|
||||||
avatarContainerView.layer.masksToBounds = true
|
|
||||||
avatarContainerView.layer.cornerCurve = .continuous
|
avatarContainerView.layer.cornerCurve = .continuous
|
||||||
|
// Set zPositions so the gallery presentation/dismissal animation looks correct.
|
||||||
|
avatarContainerView.layer.zPosition = 2
|
||||||
avatarImageView.layer.masksToBounds = true
|
avatarImageView.layer.masksToBounds = true
|
||||||
avatarImageView.layer.cornerCurve = .continuous
|
avatarImageView.layer.cornerCurve = .continuous
|
||||||
avatarImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(avatarPressed)))
|
avatarImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(avatarPressed)))
|
||||||
|
@ -75,6 +76,7 @@ class ProfileHeaderView: UIView {
|
||||||
|
|
||||||
headerImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(headerPressed)))
|
headerImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(headerPressed)))
|
||||||
headerImageView.isUserInteractionEnabled = true
|
headerImageView.isUserInteractionEnabled = true
|
||||||
|
headerImageView.layer.zPosition = 1
|
||||||
|
|
||||||
var config = UIButton.Configuration.plain()
|
var config = UIButton.Configuration.plain()
|
||||||
config.image = UIImage(systemName: "ellipsis")
|
config.image = UIImage(systemName: "ellipsis")
|
||||||
|
@ -83,9 +85,11 @@ class ProfileHeaderView: UIView {
|
||||||
moreButton.addInteraction(UIPointerInteraction(delegate: self))
|
moreButton.addInteraction(UIPointerInteraction(delegate: self))
|
||||||
moreButton.showsMenuAsPrimaryAction = true
|
moreButton.showsMenuAsPrimaryAction = true
|
||||||
moreButton.isContextMenuInteractionEnabled = true
|
moreButton.isContextMenuInteractionEnabled = true
|
||||||
|
moreButton.layer.zPosition = 2
|
||||||
|
|
||||||
followButton.setNeedsUpdateConfiguration()
|
followButton.setNeedsUpdateConfiguration()
|
||||||
followButton.addInteraction(UIPointerInteraction(delegate: self))
|
followButton.addInteraction(UIPointerInteraction(delegate: self))
|
||||||
|
followButton.layer.zPosition = 2
|
||||||
|
|
||||||
displayNameLabel.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: .systemFont(ofSize: 24, weight: .semibold))
|
displayNameLabel.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: .systemFont(ofSize: 24, weight: .semibold))
|
||||||
displayNameLabel.adjustsFontForContentSizeCategory = true
|
displayNameLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
|
|
@ -131,6 +131,8 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
|
||||||
pollView,
|
pollView,
|
||||||
] as! [any StatusContentView], useTopSpacer: true).configure {
|
] as! [any StatusContentView], useTopSpacer: true).configure {
|
||||||
$0.setContentHuggingPriority(.defaultLow, for: .vertical)
|
$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 {
|
let contentTextView = StatusContentTextView().configure {
|
||||||
|
|
|
@ -84,6 +84,8 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
metaIndicatorsView.trailingAnchor.constraint(equalTo: avatarImageView.trailingAnchor),
|
metaIndicatorsView.trailingAnchor.constraint(equalTo: avatarImageView.trailingAnchor),
|
||||||
metaIndicatorsTopConstraint,
|
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
|
private static let avatarImageViewSize: CGFloat = 50
|
||||||
|
|
Loading…
Reference in New Issue