Quote Toot rendering fixes

This commit is contained in:
Thomas Ricouard 2023-01-27 13:38:24 +01:00
parent aff318b0ca
commit 7ac8333912
3 changed files with 6 additions and 5 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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)))