Change media embed priority to be lower than video previews

This commit is contained in:
Maurice Parker 2020-05-06 13:21:37 -05:00
parent 73f9d750b7
commit 9e235564af

View File

@ -69,10 +69,6 @@ struct RedditLinkData: Codable {
func renderURLAsHTML() -> String? { func renderURLAsHTML() -> String? {
guard let url = url else { return nil } guard let url = url else { return nil }
if !url.hasPrefix("https://imgur.com"), let mediaEmbedContent = mediaEmbed?.content {
return mediaEmbedContent
}
if url.hasSuffix(".gif") { if url.hasSuffix(".gif") {
return "<figure><img src=\"\(url)\"></figure>" return "<figure><img src=\"\(url)\"></figure>"
} }
@ -102,6 +98,10 @@ struct RedditLinkData: Codable {
return html return html
} }
if let mediaEmbedContent = mediaEmbed?.content {
return mediaEmbedContent
}
if let imageSource = preview?.images?.first?.source, let imageURL = imageSource.url { if let imageSource = preview?.images?.first?.source, let imageURL = imageSource.url {
var html = "<figure><a href=\"\(url)\"><img src=\"\(imageURL)\" " var html = "<figure><a href=\"\(url)\"><img src=\"\(imageURL)\" "
if let width = imageSource.width, let height = imageSource.height { if let width = imageSource.width, let height = imageSource.height {