From 893fd8e91f6c0755fa9f3a31ecd843c63f4c16f7 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 5 Jul 2021 14:24:50 -0500 Subject: [PATCH] Changed how images are placed in Twitter articles so that you can better see who Tweeted the image. --- .../FeedProvider/Twitter/TwitterStatus.swift | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/Account/Sources/Account/FeedProvider/Twitter/TwitterStatus.swift b/Account/Sources/Account/FeedProvider/Twitter/TwitterStatus.swift index affe9ff64..047b6a422 100644 --- a/Account/Sources/Account/FeedProvider/Twitter/TwitterStatus.swift +++ b/Account/Sources/Account/FeedProvider/Twitter/TwitterStatus.swift @@ -48,7 +48,7 @@ final class TwitterStatus: Codable { func renderAsHTML(topLevel: Bool = true) -> String { if let retweetedStatus = retweetedStatus { - return renderAsRetweetHTML(retweetedStatus, topLevel: topLevel) + return renderAsRetweetHTML(retweetedStatus) } if let quotedStatus = quotedStatus { return renderAsQuoteHTML(quotedStatus, topLevel: topLevel) @@ -139,26 +139,17 @@ private extension TwitterStatus { func renderAsOriginalHTML(topLevel: Bool) -> String { var html = renderAsTweetHTML(self, topLevel: topLevel) - if topLevel { - html += extendedEntities?.renderAsHTML() ?? "" - html += retweetedStatus?.extendedEntities?.renderAsHTML() ?? "" - html += quotedStatus?.extendedEntities?.renderAsHTML() ?? "" - } + html += extendedEntities?.renderAsHTML() ?? "" return html } - func renderAsRetweetHTML(_ status: TwitterStatus, topLevel: Bool) -> String { + func renderAsRetweetHTML(_ status: TwitterStatus) -> String { var html = "
" if let userHTML = status.user?.renderAsHTML() { html += userHTML } html += status.renderAsHTML(topLevel: false) html += "
" - if topLevel { - html += status.extendedEntities?.renderAsHTML() ?? "" - html += status.retweetedStatus?.extendedEntities?.renderAsHTML() ?? "" - html += status.quotedStatus?.extendedEntities?.renderAsHTML() ?? "" - } return html } @@ -172,11 +163,6 @@ private extension TwitterStatus { } html += quotedStatus.renderAsHTML(topLevel: false) html += "" - if topLevel { - html += quotedStatus.extendedEntities?.renderAsHTML() ?? "" - html += quotedStatus.retweetedStatus?.extendedEntities?.renderAsHTML() ?? "" - html += quotedStatus.quotedStatus?.extendedEntities?.renderAsHTML() ?? "" - } return html }