diff --git a/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift b/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift index 72015adce..cd10c6c0b 100644 --- a/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift +++ b/Frameworks/Account/FeedProvider/Reddit/RedditLink.swift @@ -58,10 +58,10 @@ struct RedditLinkData: Codable { func renderAsHTML() -> String? { var html = String() if let selfHTML = selfHTML { - html.append(selfHTML) + html += selfHTML } if let urlHTML = renderURLAsHTML() { - html.append(urlHTML) + html += urlHTML } return html } @@ -69,33 +69,35 @@ struct RedditLinkData: Codable { func renderURLAsHTML() -> String? { guard let url = url else { return nil } - if let mediaEmbedContent = mediaEmbed?.content { - return mediaEmbedContent - } - if isVideo ?? false { guard let fallbackURL = media?.video?.fallbackURL else { return nil } - var html = "" return html } - guard url.hasSuffix(".jpg") || url.hasSuffix(".jpeg") || url.hasSuffix(".png") || url.hasSuffix(".gif") else { - return nil + if let imageSource = preview?.images?.first?.source, let imageURL = imageSource.url { + var html = "
" + + if let mediaEmbedContent = mediaEmbed?.content { + return mediaEmbedContent + } + + return nil } }