diff --git a/Localizations/en.lproj/Localizable.strings b/Localizations/en.lproj/Localizable.strings index 183970a..32db735 100644 --- a/Localizations/en.lproj/Localizable.strings +++ b/Localizations/en.lproj/Localizable.strings @@ -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"; diff --git a/ViewModels/Sources/ViewModels/View Models/StatusViewModel.swift b/ViewModels/Sources/ViewModels/View Models/StatusViewModel.swift index 70bf877..55d5118 100644 --- a/ViewModels/Sources/ViewModels/View Models/StatusViewModel.swift +++ b/ViewModels/Sources/ViewModels/View Models/StatusViewModel.swift @@ -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) } diff --git a/Views/UIKit/Content Views/StatusView.swift b/Views/UIKit/Content Views/StatusView.swift index 7f764d4..35e092c 100644 --- a/Views/UIKit/Content Views/StatusView.swift +++ b/Views/UIKit/Content Views/StatusView.swift @@ -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)