2021-03-22 10:48:35 +01:00
|
|
|
//
|
2021-04-01 08:39:15 +02:00
|
|
|
// ComposeRepliedToStatusContentCollectionViewCell.swift
|
2021-03-22 10:48:35 +01:00
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by MainasuK Cirno on 2021-3-11.
|
|
|
|
//
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
statusView.isStatusTextSensitive = false
|
|
|
|
statusView.cleanUpContentWarning()
|
|
|
|
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-14 13:45:09 +02:00
|
|
|
statusView.contentWarningBlurContentImageView.backgroundColor = Asset.Colors.Background.systemBackground.color
|
2021-04-14 09:24:54 +02:00
|
|
|
|
|
|
|
statusView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
contentView.addSubview(statusView)
|
|
|
|
NSLayoutConstraint.activate([
|
|
|
|
statusView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 20),
|
|
|
|
statusView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
|
|
|
contentView.readableContentGuide.trailingAnchor.constraint(equalTo: statusView.trailingAnchor),
|
2021-04-14 10:17:34 +02:00
|
|
|
contentView.bottomAnchor.constraint(equalTo: statusView.bottomAnchor, constant: 10),
|
2021-04-14 09:24:54 +02:00
|
|
|
])
|
2021-03-22 10:48:35 +01:00
|
|
|
|
2021-04-14 09:24:54 +02:00
|
|
|
statusView.actionToolbarContainer.isHidden = true
|
2021-03-22 10:48:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|