Prefer media embed except for imgur.com

This commit is contained in:
Maurice Parker 2020-05-05 20:42:34 -05:00
parent 11bdc23bdf
commit 00cb83559c
1 changed files with 4 additions and 4 deletions

View File

@ -69,6 +69,10 @@ 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 isVideo ?? false {
guard let fallbackURL = media?.video?.fallbackURL else {
return nil
@ -93,10 +97,6 @@ struct RedditLinkData: Codable {
return html
}
if let mediaEmbedContent = mediaEmbed?.content {
return mediaEmbedContent
}
return nil
}