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 typeRaw: 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 metaData: Data?
|
||||
|
@ -80,7 +80,7 @@ public extension Attachment {
|
|||
public let typeRaw: String
|
||||
public let url: String
|
||||
|
||||
public let previewURL: String
|
||||
public let previewURL: String?
|
||||
public let remoteURL: String?
|
||||
public let metaData: Data?
|
||||
public let textURL: String?
|
||||
|
@ -95,7 +95,7 @@ public extension Attachment {
|
|||
id: Attachment.ID,
|
||||
typeRaw: String,
|
||||
url: String,
|
||||
previewURL: String,
|
||||
previewURL: String?,
|
||||
remoteURL: String?,
|
||||
metaData: Data?,
|
||||
textURL: String?,
|
||||
|
|
|
@ -16,7 +16,8 @@ struct MosaicImageViewModel {
|
|||
var metas: [MosaicMeta] = []
|
||||
for element in mediaAttachments where element.type == .image {
|
||||
// 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,
|
||||
let width = meta.original?.width,
|
||||
let height = meta.original?.height,
|
||||
|
|
|
@ -23,7 +23,7 @@ extension Mastodon.Entity {
|
|||
public let id: ID
|
||||
public let type: Type
|
||||
public let url: String
|
||||
public let previewURL: String
|
||||
public let previewURL: String?
|
||||
|
||||
public let remoteURL: String?
|
||||
public let textURL: String?
|
||||
|
|
Loading…
Reference in New Issue