Fix not being able to tap attachments in the timeline
This commit is contained in:
parent
e676075d5b
commit
15a7cd5f65
|
@ -19,6 +19,7 @@ class AttachmentsContainerView: UIView {
|
||||||
var attachments: [Attachment]!
|
var attachments: [Attachment]!
|
||||||
|
|
||||||
let attachmentViews: NSHashTable<AttachmentView> = .weakObjects()
|
let attachmentViews: NSHashTable<AttachmentView> = .weakObjects()
|
||||||
|
let attachmentStacks: NSHashTable<UIStackView> = .weakObjects()
|
||||||
var moreView: UIView?
|
var moreView: UIView?
|
||||||
|
|
||||||
var blurView: UIVisualEffectView?
|
var blurView: UIVisualEffectView?
|
||||||
|
@ -68,6 +69,8 @@ class AttachmentsContainerView: UIView {
|
||||||
|
|
||||||
attachmentViews.allObjects.forEach { $0.removeFromSuperview() }
|
attachmentViews.allObjects.forEach { $0.removeFromSuperview() }
|
||||||
attachmentViews.removeAllObjects()
|
attachmentViews.removeAllObjects()
|
||||||
|
attachmentStacks.allObjects.forEach { $0.removeFromSuperview() }
|
||||||
|
attachmentStacks.removeAllObjects()
|
||||||
moreView?.removeFromSuperview()
|
moreView?.removeFromSuperview()
|
||||||
|
|
||||||
var accessibilityElements = [Any]()
|
var accessibilityElements = [Any]()
|
||||||
|
@ -96,6 +99,7 @@ class AttachmentsContainerView: UIView {
|
||||||
left,
|
left,
|
||||||
right
|
right
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(stack)
|
||||||
fillView(stack)
|
fillView(stack)
|
||||||
sendSubviewToBack(stack)
|
sendSubviewToBack(stack)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -116,13 +120,16 @@ class AttachmentsContainerView: UIView {
|
||||||
bottomRight.layer.cornerRadius = 5
|
bottomRight.layer.cornerRadius = 5
|
||||||
bottomRight.layer.maskedCorners = .layerMaxXMaxYCorner
|
bottomRight.layer.maskedCorners = .layerMaxXMaxYCorner
|
||||||
bottomRight.layer.masksToBounds = true
|
bottomRight.layer.masksToBounds = true
|
||||||
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
let innerStack = createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
||||||
left,
|
|
||||||
createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
|
||||||
topRight,
|
topRight,
|
||||||
bottomRight
|
bottomRight
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(innerStack)
|
||||||
|
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
||||||
|
left,
|
||||||
|
innerStack,
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(outerStack)
|
||||||
fillView(outerStack)
|
fillView(outerStack)
|
||||||
sendSubviewToBack(outerStack)
|
sendSubviewToBack(outerStack)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -145,6 +152,7 @@ class AttachmentsContainerView: UIView {
|
||||||
topLeft,
|
topLeft,
|
||||||
bottomLeft
|
bottomLeft
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(left)
|
||||||
let topRight = createAttachmentView(index: 1, hSize: .half, vSize: .half)
|
let topRight = createAttachmentView(index: 1, hSize: .half, vSize: .half)
|
||||||
topRight.layer.cornerRadius = 5
|
topRight.layer.cornerRadius = 5
|
||||||
topRight.layer.maskedCorners = .layerMaxXMinYCorner
|
topRight.layer.maskedCorners = .layerMaxXMinYCorner
|
||||||
|
@ -153,13 +161,16 @@ class AttachmentsContainerView: UIView {
|
||||||
bottomRight.layer.cornerRadius = 5
|
bottomRight.layer.cornerRadius = 5
|
||||||
bottomRight.layer.maskedCorners = .layerMaxXMaxYCorner
|
bottomRight.layer.maskedCorners = .layerMaxXMaxYCorner
|
||||||
bottomRight.layer.masksToBounds = true
|
bottomRight.layer.masksToBounds = true
|
||||||
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
let right = createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
||||||
left,
|
|
||||||
createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
|
||||||
topRight,
|
topRight,
|
||||||
bottomRight
|
bottomRight
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(right)
|
||||||
|
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
||||||
|
left,
|
||||||
|
right,
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(outerStack)
|
||||||
fillView(outerStack)
|
fillView(outerStack)
|
||||||
sendSubviewToBack(outerStack)
|
sendSubviewToBack(outerStack)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -201,17 +212,21 @@ class AttachmentsContainerView: UIView {
|
||||||
topLeft,
|
topLeft,
|
||||||
bottomLeft
|
bottomLeft
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(left)
|
||||||
let topRight = createAttachmentView(index: 1, hSize: .half, vSize: .half)
|
let topRight = createAttachmentView(index: 1, hSize: .half, vSize: .half)
|
||||||
topRight.layer.cornerRadius = 5
|
topRight.layer.cornerRadius = 5
|
||||||
topRight.layer.maskedCorners = .layerMaxXMinYCorner
|
topRight.layer.maskedCorners = .layerMaxXMinYCorner
|
||||||
topRight.layer.masksToBounds = true
|
topRight.layer.masksToBounds = true
|
||||||
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
let right = createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
||||||
left,
|
|
||||||
createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
|
||||||
topRight,
|
topRight,
|
||||||
moreView
|
moreView
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(right)
|
||||||
|
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
||||||
|
left,
|
||||||
|
right,
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(outerStack)
|
||||||
fillView(outerStack)
|
fillView(outerStack)
|
||||||
sendSubviewToBack(outerStack)
|
sendSubviewToBack(outerStack)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
|
Loading…
Reference in New Issue