mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-15 21:10:59 +00:00
Thread indicator
This commit is contained in:
parent
0a2034171c
commit
c024863e65
3 changed files with 19 additions and 0 deletions
|
@ -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";
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue