From 44f366083c2f1011884219f10dfc70bca627935f Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 1 Mar 2023 09:05:22 -0500 Subject: [PATCH] Improve the UX around post translation (#933) --- .../DataSourceProvider+StatusTableViewCellDelegate.swift | 9 +++++++-- .../Sources/MastodonUI/View/Content/StatusView.swift | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift b/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift index 0b4cc3e8f..833389638 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift @@ -483,9 +483,14 @@ extension StatusTableViewCellDelegate where Self: DataSourceProvider & AuthConte return } - if let cell = cell as? StatusTableViewCell { + if case .translateStatus = action { DispatchQueue.main.async { - cell.statusView.viewModel.isCurrentlyTranslating = true + if let cell = cell as? StatusTableViewCell { + cell.statusView.viewModel.isCurrentlyTranslating = true + } else if let cell = cell as? StatusThreadRootTableViewCell { + cell.statusView.viewModel.isCurrentlyTranslating = true + } + cell.invalidateIntrinsicContentSize() } } diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift index 402f1ca42..a2b0e9158 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift @@ -463,12 +463,14 @@ extension StatusView.Style { // status content statusView.contentContainer.addArrangedSubview(statusView.contentMetaText.textView) - statusView.contentContainer.addArrangedSubview(statusView.statusCardControl) // translated info statusView.containerStackView.addArrangedSubview(statusView.isTranslatingLoadingView) statusView.containerStackView.addArrangedSubview(statusView.translatedInfoView) + // link preview card + statusView.contentContainer.addArrangedSubview(statusView.statusCardControl) + statusView.spoilerOverlayView.translatesAutoresizingMaskIntoConstraints = false statusView.containerStackView.addSubview(statusView.spoilerOverlayView) statusView.contentContainer.pinTo(to: statusView.spoilerOverlayView)