Thread indicator

This commit is contained in:
Justin Mazzocchi 2021-04-04 11:56:22 -07:00
parent 0a2034171c
commit c024863e65
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
3 changed files with 19 additions and 0 deletions

View file

@ -324,6 +324,7 @@
"status.show-more-all-button.accessibilty-label" = "Show more for all";
"status.show-less" = "Show Less";
"status.show-less-all-button.accessibilty-label" = "Show less for all";
"status.show-thread" = "Show thread";
"status.spoiler-text-placeholder" = "Write your warning here";
"status.unbookmark" = "Unbookmark";
"status.unmute" = "Unmute conversation";

View file

@ -77,6 +77,10 @@ public extension StatusViewModel {
sensitive || identityContext.identity.preferences.readingExpandMedia == .hideAll
}
var isReplyOutOfContext: Bool {
!configuration.isContextParent && statusService.status.displayStatus.inReplyToId != nil
}
var id: Status.Id { statusService.status.displayStatus.id }
var accountName: String { "@".appending(statusService.status.displayStatus.account.acct) }

View file

@ -19,6 +19,7 @@ final class StatusView: UIView {
let nameButton = UIButton()
let timeLabel = UILabel()
let bodyView = StatusBodyView()
let showThreadIndicator = UIButton(type: .system)
let contextParentTimeLabel = UILabel()
let visibilityImageView = UIImageView()
let applicationButton = UIButton(type: .system)
@ -109,6 +110,10 @@ extension StatusView {
configuration: configuration)
+ .compactSpacing
if !configuration.isContextParent && status.inReplyToId != nil {
height += UIFont.preferredFont(forTextStyle: .callout).lineHeight + .compactSpacing
}
return height
}
@ -254,6 +259,13 @@ private extension StatusView {
mainStackView.addArrangedSubview(bodyView)
mainStackView.addArrangedSubview(showThreadIndicator)
showThreadIndicator.isHidden = true
showThreadIndicator.setTitle(NSLocalizedString("status.show-thread", comment: ""), for: .normal)
showThreadIndicator.titleLabel?.adjustsFontForContentSizeCategory = true
showThreadIndicator.titleLabel?.font = .preferredFont(forTextStyle: .callout)
showThreadIndicator.isUserInteractionEnabled = false
contextParentTimeLabel.font = .preferredFont(forTextStyle: .footnote)
contextParentTimeLabel.adjustsFontForContentSizeCategory = true
contextParentTimeLabel.textColor = .secondaryLabel
@ -561,6 +573,8 @@ private extension StatusView {
bodyView.viewModel = viewModel
showThreadIndicator.isHidden = !viewModel.isReplyOutOfContext
contextParentTimeLabel.text = viewModel.contextParentTime
contextParentTimeLabel.accessibilityLabel = viewModel.accessibilityContextParentTime
visibilityImageView.image = UIImage(systemName: viewModel.visibility.systemImageName)