From 7ac83339120fc94ed25adb054d99a37add605e6b Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Fri, 27 Jan 2023 13:38:24 +0100 Subject: [PATCH] Quote Toot rendering fixes --- .../Status/Sources/Status/Row/StatusMediaPreviewView.swift | 1 + Packages/Status/Sources/Status/Row/StatusRowView.swift | 3 ++- .../Status/Sources/Status/Row/StatusRowViewModel.swift | 7 +++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift b/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift index a62f127f..0e19ca98 100644 --- a/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift +++ b/Packages/Status/Sources/Status/Row/StatusMediaPreviewView.swift @@ -183,6 +183,7 @@ public struct StatusMediaPreviewView: View { case .gifv, .video, .audio: if let url = attachment.url { VideoPlayerView(viewModel: .init(url: url)) + .frame(maxWidth: isNotifications ? imageMaxHeight : nil) .frame(height: imageMaxHeight) } case .none: diff --git a/Packages/Status/Sources/Status/Row/StatusRowView.swift b/Packages/Status/Sources/Status/Row/StatusRowView.swift index 5992974c..7d1ebb65 100644 --- a/Packages/Status/Sources/Status/Row/StatusRowView.swift +++ b/Packages/Status/Sources/Status/Row/StatusRowView.swift @@ -368,7 +368,7 @@ public struct StatusRowView: View { @ViewBuilder private func makeCardView(status: AnyStatus) -> some View { if let card = status.card, - viewModel.embeddedStatus?.url != status.card?.url, + status.content.statusesURLs.isEmpty, status.mediaAttachments.isEmpty, !viewModel.isEmbedLoading, theme.statusDisplayStyle == .large @@ -384,6 +384,7 @@ public struct StatusRowView: View { let embed = viewModel.embeddedStatus { StatusEmbeddedView(status: embed) + .fixedSize(horizontal: false, vertical: true) } else if viewModel.isEmbedLoading, !viewModel.isCompact { StatusEmbeddedView(status: .placeholder()) .redacted(reason: .placeholder) diff --git a/Packages/Status/Sources/Status/Row/StatusRowViewModel.swift b/Packages/Status/Sources/Status/Row/StatusRowViewModel.swift index 91aaecd2..4251f9e0 100644 --- a/Packages/Status/Sources/Status/Row/StatusRowViewModel.swift +++ b/Packages/Status/Sources/Status/Row/StatusRowViewModel.swift @@ -20,7 +20,7 @@ public class StatusRowViewModel: ObservableObject { @Published var repliesCount: Int @Published var embeddedStatus: Status? @Published var displaySpoiler: Bool = false - @Published var isEmbedLoading: Bool = true + @Published var isEmbedLoading: Bool = false @Published var isFiltered: Bool = false @Published var translation: String? @@ -73,6 +73,7 @@ public class StatusRowViewModel: ObservableObject { func loadEmbeddedStatus() async { guard let client, + embeddedStatus == nil, !status.content.statusesURLs.isEmpty, let url = status.content.statusesURLs.first, client.hasConnection(with: url) @@ -81,9 +82,7 @@ public class StatusRowViewModel: ObservableObject { return } do { - withAnimation { - isEmbedLoading = true - } + isEmbedLoading = true var embed: Status? if url.absoluteString.contains(client.server), let id = Int(url.lastPathComponent) { embed = try await client.get(endpoint: Statuses.status(id: String(id)))