2021-03-22 10:48:35 +01:00
//
2021-04-01 08:39:15 +02:00
// C o m p o s e R e p l i e d T o S t a t u s C o n t e n t C o l l e c t i o n V i e w C e l l . s w i f t
2021-03-22 10:48:35 +01:00
// M a s t o d o n
//
// C r e a t e d b y M a i n a s u K C i r n o o n 2 0 2 1 - 3 - 1 1 .
//
import UIKit
2021-04-14 09:24:54 +02:00
import Combine
2021-03-22 10:48:35 +01:00
2021-04-01 08:39:15 +02:00
final class ComposeRepliedToStatusContentCollectionViewCell : UICollectionViewCell {
2021-03-22 10:48:35 +01:00
2021-04-14 09:24:54 +02:00
var disposeBag = Set < AnyCancellable > ( )
let statusView = StatusView ( )
2021-04-15 06:10:43 +02:00
let framePublisher = PassthroughSubject < CGRect , Never > ( )
2021-04-14 09:24:54 +02:00
override func prepareForReuse ( ) {
super . prepareForReuse ( )
2021-04-16 14:06:36 +02:00
statusView . updateContentWarningDisplay ( isHidden : true , animated : false )
2021-04-14 09:24:54 +02:00
disposeBag . removeAll ( )
}
2021-03-22 10:48:35 +01:00
override init ( frame : CGRect ) {
super . init ( frame : frame )
_init ( )
}
required init ? ( coder : NSCoder ) {
super . init ( coder : coder )
_init ( )
}
2021-04-15 06:10:43 +02:00
override func layoutSubviews ( ) {
super . layoutSubviews ( )
framePublisher . send ( bounds )
}
2021-03-22 10:48:35 +01:00
}
2021-04-01 08:39:15 +02:00
extension ComposeRepliedToStatusContentCollectionViewCell {
2021-03-22 10:48:35 +01:00
private func _init ( ) {
2021-04-14 09:24:54 +02:00
backgroundColor = . clear
2021-04-19 11:50:58 +02:00
statusView . actionToolbarContainer . isHidden = true
2021-04-19 13:15:49 +02:00
statusView . revealContentWarningButton . isHidden = true
2021-04-19 11:50:58 +02:00
2021-04-14 09:24:54 +02:00
statusView . translatesAutoresizingMaskIntoConstraints = false
contentView . addSubview ( statusView )
NSLayoutConstraint . activate ( [
2021-04-19 11:50:58 +02:00
statusView . topAnchor . constraint ( equalTo : contentView . topAnchor , constant : 20 ) . identifier ( " statusView.top to ComposeRepliedToStatusContentCollectionViewCell.contentView.top " ) ,
2021-04-14 09:24:54 +02:00
statusView . leadingAnchor . constraint ( equalTo : contentView . readableContentGuide . leadingAnchor ) ,
contentView . readableContentGuide . trailingAnchor . constraint ( equalTo : statusView . trailingAnchor ) ,
2021-04-19 11:50:58 +02:00
contentView . bottomAnchor . constraint ( equalTo : statusView . bottomAnchor , constant : 10 ) . identifier ( " ComposeRepliedToStatusContentCollectionViewCell.contentView.bottom to statusView.bottom " ) ,
2021-04-14 09:24:54 +02:00
] )
2021-03-22 10:48:35 +01:00
}
}