fix: content inset may wrong during compose scene modal transition issue

This commit is contained in:
CMK 2021-06-29 17:54:38 +08:00
parent ace2b1cbdf
commit fbb46b55a6
2 changed files with 8 additions and 5 deletions

View File

@ -180,6 +180,10 @@ extension ComposeViewModel: UITableViewDataSource {
case .repliedTo: case .repliedTo:
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: ComposeRepliedToStatusContentTableViewCell.self), for: indexPath) as! ComposeRepliedToStatusContentTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: ComposeRepliedToStatusContentTableViewCell.self), for: indexPath) as! ComposeRepliedToStatusContentTableViewCell
guard case let .reply(statusObjectID) = composeKind else { return cell } guard case let .reply(statusObjectID) = composeKind else { return cell }
cell.framePublisher
.receive(on: DispatchQueue.main)
.assign(to: \.value, on: self.repliedToCellFrame)
.store(in: &cell.disposeBag)
let managedObjectContext = context.managedObjectContext let managedObjectContext = context.managedObjectContext
managedObjectContext.performAndWait { managedObjectContext.performAndWait {
guard let replyTo = managedObjectContext.object(with: statusObjectID) as? Status else { guard let replyTo = managedObjectContext.object(with: statusObjectID) as? Status else {
@ -203,10 +207,6 @@ extension ComposeViewModel: UITableViewDataSource {
} }
// set date // set date
cell.statusView.dateLabel.text = status.createdAt.slowedTimeAgoSinceNow cell.statusView.dateLabel.text = status.createdAt.slowedTimeAgoSinceNow
cell.framePublisher
.assign(to: \.value, on: self.repliedToCellFrame)
.store(in: &cell.disposeBag)
} }
return cell return cell
case .status: case .status:

View File

@ -213,12 +213,15 @@ extension ReplicaStatusView {
titleContainerStackView.alignment = .firstBaseline titleContainerStackView.alignment = .firstBaseline
titleContainerStackView.addArrangedSubview(nameTrialingDotLabel) titleContainerStackView.addArrangedSubview(nameTrialingDotLabel)
titleContainerStackView.addArrangedSubview(dateLabel) titleContainerStackView.addArrangedSubview(dateLabel)
titleContainerStackView.addArrangedSubview(UIView()) // padding let padding = UIView()
titleContainerStackView.addArrangedSubview(padding) // padding
nameLabel.setContentHuggingPriority(.defaultHigh + 1, for: .horizontal) nameLabel.setContentHuggingPriority(.defaultHigh + 1, for: .horizontal)
nameTrialingDotLabel.setContentHuggingPriority(.defaultHigh + 2, for: .horizontal) nameTrialingDotLabel.setContentHuggingPriority(.defaultHigh + 2, for: .horizontal)
nameTrialingDotLabel.setContentCompressionResistancePriority(.required - 2, for: .horizontal) nameTrialingDotLabel.setContentCompressionResistancePriority(.required - 2, for: .horizontal)
dateLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) dateLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
dateLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal) dateLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal)
padding.setContentHuggingPriority(.defaultLow - 1, for: .horizontal)
padding.setContentCompressionResistancePriority(.defaultLow - 1, for: .horizontal)
// subtitle container: [username] // subtitle container: [username]
let subtitleContainerStackView = UIStackView() let subtitleContainerStackView = UIStackView()