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
1 changed files with 4 additions and 4 deletions

View File

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