mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-27 12:59:17 +01:00
Support instance with malformed statuses URL
This commit is contained in:
parent
1b9d4e0247
commit
d737b429b4
@ -43,7 +43,7 @@ public protocol AnyStatus {
|
|||||||
var pinned: Bool? { get }
|
var pinned: Bool? { get }
|
||||||
var bookmarked: Bool? { get }
|
var bookmarked: Bool? { get }
|
||||||
var emojis: [Emoji] { get }
|
var emojis: [Emoji] { get }
|
||||||
var url: URL? { get }
|
var url: String? { get }
|
||||||
var application: Application? { get }
|
var application: Application? { get }
|
||||||
var inReplyToAccountId: String? { get }
|
var inReplyToAccountId: String? { get }
|
||||||
var visibility: Visibility { get }
|
var visibility: Visibility { get }
|
||||||
@ -76,7 +76,7 @@ public struct Status: AnyStatus, Codable, Identifiable {
|
|||||||
public let pinned: Bool?
|
public let pinned: Bool?
|
||||||
public let bookmarked: Bool?
|
public let bookmarked: Bool?
|
||||||
public let emojis: [Emoji]
|
public let emojis: [Emoji]
|
||||||
public let url: URL?
|
public let url: String?
|
||||||
public let application: Application?
|
public let application: Application?
|
||||||
public let inReplyToAccountId: String?
|
public let inReplyToAccountId: String?
|
||||||
public let visibility: Visibility
|
public let visibility: Visibility
|
||||||
@ -141,7 +141,7 @@ public struct ReblogStatus: AnyStatus, Codable, Identifiable {
|
|||||||
public let pinned: Bool?
|
public let pinned: Bool?
|
||||||
public let bookmarked: Bool?
|
public let bookmarked: Bool?
|
||||||
public let emojis: [Emoji]
|
public let emojis: [Emoji]
|
||||||
public let url: URL?
|
public let url: String?
|
||||||
public var application: Application?
|
public var application: Application?
|
||||||
public let inReplyToAccountId: String?
|
public let inReplyToAccountId: String?
|
||||||
public let visibility: Visibility
|
public let visibility: Visibility
|
||||||
|
@ -69,7 +69,7 @@ public class StatusEditorViewModel: ObservableObject {
|
|||||||
private var currentSuggestionRange: NSRange?
|
private var currentSuggestionRange: NSRange?
|
||||||
|
|
||||||
private var embeddedStatusURL: URL? {
|
private var embeddedStatusURL: URL? {
|
||||||
return embeddedStatus?.reblog?.url ?? embeddedStatus?.url
|
return URL(string: embeddedStatus?.reblog?.url ?? embeddedStatus?.url ?? "")
|
||||||
}
|
}
|
||||||
|
|
||||||
private var uploadTask: Task<Void, Never>?
|
private var uploadTask: Task<Void, Never>?
|
||||||
|
@ -63,7 +63,7 @@ struct StatusRowContextMenu: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let url = viewModel.status.reblog?.url ?? viewModel.status.url {
|
if let url = URL(string: viewModel.status.reblog?.url ?? viewModel.status.url ?? "") {
|
||||||
Button { openURL(url) } label: {
|
Button { openURL(url) } label: {
|
||||||
Label("View in Browser", systemImage: "safari")
|
Label("View in Browser", systemImage: "safari")
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ public struct StatusRowView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let card = status.card,
|
if let card = status.card,
|
||||||
viewModel.embeddedStatus?.url != status.card?.url,
|
viewModel.embeddedStatus?.url != status.card?.url.absoluteString,
|
||||||
status.mediaAttachments.isEmpty,
|
status.mediaAttachments.isEmpty,
|
||||||
!viewModel.isEmbedLoading,
|
!viewModel.isEmbedLoading,
|
||||||
theme.statusDisplayStyle == .large
|
theme.statusDisplayStyle == .large
|
||||||
|
@ -61,7 +61,7 @@ public class StatusRowViewModel: ObservableObject {
|
|||||||
|
|
||||||
func navigateToDetail(routerPath: RouterPath) {
|
func navigateToDetail(routerPath: RouterPath) {
|
||||||
guard !isFocused else { return }
|
guard !isFocused else { return }
|
||||||
if isRemote, let url = status.reblog?.url ?? status.url {
|
if isRemote, let url = URL(string: status.reblog?.url ?? status.url ?? "") {
|
||||||
routerPath.navigate(to: .remoteStatusDetail(url: url))
|
routerPath.navigate(to: .remoteStatusDetail(url: url))
|
||||||
} else {
|
} else {
|
||||||
routerPath.navigate(to: .statusDetail(id: status.reblog?.id ?? status.id))
|
routerPath.navigate(to: .statusDetail(id: status.reblog?.id ?? status.id))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user