chore: make media_attachments.preview_url optional
It's null when toot has audio So the document is wrong
This commit is contained in:
parent
ce0fc56cd7
commit
8bce197136
|
@ -15,7 +15,7 @@ public final class Attachment: NSManagedObject {
|
||||||
@NSManaged public private(set) var domain: String
|
@NSManaged public private(set) var domain: String
|
||||||
@NSManaged public private(set) var typeRaw: String
|
@NSManaged public private(set) var typeRaw: String
|
||||||
@NSManaged public private(set) var url: String
|
@NSManaged public private(set) var url: String
|
||||||
@NSManaged public private(set) var previewURL: String
|
@NSManaged public private(set) var previewURL: String?
|
||||||
|
|
||||||
@NSManaged public private(set) var remoteURL: String?
|
@NSManaged public private(set) var remoteURL: String?
|
||||||
@NSManaged public private(set) var metaData: Data?
|
@NSManaged public private(set) var metaData: Data?
|
||||||
|
@ -80,7 +80,7 @@ public extension Attachment {
|
||||||
public let typeRaw: String
|
public let typeRaw: String
|
||||||
public let url: String
|
public let url: String
|
||||||
|
|
||||||
public let previewURL: String
|
public let previewURL: String?
|
||||||
public let remoteURL: String?
|
public let remoteURL: String?
|
||||||
public let metaData: Data?
|
public let metaData: Data?
|
||||||
public let textURL: String?
|
public let textURL: String?
|
||||||
|
@ -95,7 +95,7 @@ public extension Attachment {
|
||||||
id: Attachment.ID,
|
id: Attachment.ID,
|
||||||
typeRaw: String,
|
typeRaw: String,
|
||||||
url: String,
|
url: String,
|
||||||
previewURL: String,
|
previewURL: String?,
|
||||||
remoteURL: String?,
|
remoteURL: String?,
|
||||||
metaData: Data?,
|
metaData: Data?,
|
||||||
textURL: String?,
|
textURL: String?,
|
||||||
|
|
|
@ -16,7 +16,8 @@ struct MosaicImageViewModel {
|
||||||
var metas: [MosaicMeta] = []
|
var metas: [MosaicMeta] = []
|
||||||
for element in mediaAttachments where element.type == .image {
|
for element in mediaAttachments where element.type == .image {
|
||||||
// Display original on the iPad/Mac
|
// Display original on the iPad/Mac
|
||||||
let urlString = UIDevice.current.userInterfaceIdiom == .phone ? element.previewURL : element.url
|
guard let previewURL = element.previewURL else { continue }
|
||||||
|
let urlString = UIDevice.current.userInterfaceIdiom == .phone ? previewURL : element.url
|
||||||
guard let meta = element.meta,
|
guard let meta = element.meta,
|
||||||
let width = meta.original?.width,
|
let width = meta.original?.width,
|
||||||
let height = meta.original?.height,
|
let height = meta.original?.height,
|
||||||
|
|
|
@ -23,7 +23,7 @@ extension Mastodon.Entity {
|
||||||
public let id: ID
|
public let id: ID
|
||||||
public let type: Type
|
public let type: Type
|
||||||
public let url: String
|
public let url: String
|
||||||
public let previewURL: String
|
public let previewURL: String?
|
||||||
|
|
||||||
public let remoteURL: String?
|
public let remoteURL: String?
|
||||||
public let textURL: String?
|
public let textURL: String?
|
||||||
|
|
Loading…
Reference in New Issue