diff --git a/Packages/Models/Sources/Models/Card.swift b/Packages/Models/Sources/Models/Card.swift index 78f52df4..016392ab 100644 --- a/Packages/Models/Sources/Models/Card.swift +++ b/Packages/Models/Sources/Models/Card.swift @@ -2,10 +2,10 @@ import Foundation public struct Card: Codable, Identifiable { public var id: String { - url.absoluteString + url } - public let url: URL + public let url: String public let title: String? public let description: String? public let type: String diff --git a/Packages/Status/Sources/Status/Row/StatusCardView.swift b/Packages/Status/Sources/Status/Row/StatusCardView.swift index 471cac35..ab883688 100644 --- a/Packages/Status/Sources/Status/Row/StatusCardView.swift +++ b/Packages/Status/Sources/Status/Row/StatusCardView.swift @@ -14,7 +14,7 @@ public struct StatusCardView: View { } public var body: some View { - if let title = card.title { + if let title = card.title, let url = URL(string: card.url) { VStack(alignment: .leading) { if let imageURL = card.image { LazyImage(url: imageURL) { state in @@ -41,7 +41,7 @@ public struct StatusCardView: View { .foregroundColor(.gray) .lineLimit(3) } - Text(card.url.host() ?? card.url.absoluteString) + Text(url.host() ?? url.absoluteString) .font(.scaledFootnote) .foregroundColor(theme.tintColor) .lineLimit(1) @@ -57,18 +57,18 @@ public struct StatusCardView: View { .stroke(.gray.opacity(0.35), lineWidth: 1) ) .onTapGesture { - openURL(card.url) + openURL(url) } .contextMenu { - ShareLink(item: card.url) { + ShareLink(item: url) { Label("Share this link", systemImage: "square.and.arrow.up") } - Button { openURL(card.url) } label: { + Button { openURL(url) } label: { Label("status.action.view-in-browser", systemImage: "safari") } Divider() Button { - UIPasteboard.general.url = card.url + UIPasteboard.general.url = url } label: { Label("Copy link", systemImage: "doc.on.doc") } diff --git a/Packages/Status/Sources/Status/Row/StatusRowView.swift b/Packages/Status/Sources/Status/Row/StatusRowView.swift index fa43fc30..a2a12519 100644 --- a/Packages/Status/Sources/Status/Row/StatusRowView.swift +++ b/Packages/Status/Sources/Status/Row/StatusRowView.swift @@ -301,7 +301,7 @@ public struct StatusRowView: View { @ViewBuilder private func makeCardView(status: AnyStatus) -> some View { if let card = status.card, - viewModel.embeddedStatus?.url != status.card?.url.absoluteString, + viewModel.embeddedStatus?.url != status.card?.url, status.mediaAttachments.isEmpty, !viewModel.isEmbedLoading, theme.statusDisplayStyle == .large