From 93c859a3c4076709fc94cc19c91c87d796a555e2 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 23 Dec 2023 10:47:40 -0500 Subject: [PATCH] Fix TextConverter inserting newlines --- Tusker/Activities/StatusActivityItemSource.swift | 2 +- Tusker/Screens/Explore/TrendingLinkCardCollectionViewCell.swift | 2 +- .../ActionNotificationGroupCollectionViewCell.swift | 2 +- .../PollFinishedNotificationCollectionViewCell.swift | 2 +- .../StatusUpdatedNotificationCollectionViewCell.swift | 2 +- Tusker/Views/Account Cell/AccountCollectionViewCell.swift | 2 +- Tusker/Views/Status/StatusCardView.swift | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Tusker/Activities/StatusActivityItemSource.swift b/Tusker/Activities/StatusActivityItemSource.swift index b437bec8..4255295c 100644 --- a/Tusker/Activities/StatusActivityItemSource.swift +++ b/Tusker/Activities/StatusActivityItemSource.swift @@ -33,7 +33,7 @@ class StatusActivityItemSource: NSObject, UIActivityItemSource { let metadata = LPLinkMetadata() metadata.originalURL = status.url! metadata.url = status.url! - var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) + var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self) let content = converter.convert(html: status.content) metadata.title = "\(status.account.displayName): \"\(content)\"" if let avatar = status.account.avatar, diff --git a/Tusker/Screens/Explore/TrendingLinkCardCollectionViewCell.swift b/Tusker/Screens/Explore/TrendingLinkCardCollectionViewCell.swift index 3aabe88e..ae5329eb 100644 --- a/Tusker/Screens/Explore/TrendingLinkCardCollectionViewCell.swift +++ b/Tusker/Screens/Explore/TrendingLinkCardCollectionViewCell.swift @@ -78,7 +78,7 @@ class TrendingLinkCardCollectionViewCell: UICollectionViewCell { let provider = card.providerName!.trimmingCharacters(in: .whitespacesAndNewlines) providerLabel.text = provider - var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) + var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self) descriptionLabel.text = converter.convert(html: card.description) descriptionLabel.isHidden = description.isEmpty diff --git a/Tusker/Screens/Notifications/ActionNotificationGroupCollectionViewCell.swift b/Tusker/Screens/Notifications/ActionNotificationGroupCollectionViewCell.swift index cd80dbe0..a261dfe5 100644 --- a/Tusker/Screens/Notifications/ActionNotificationGroupCollectionViewCell.swift +++ b/Tusker/Screens/Notifications/ActionNotificationGroupCollectionViewCell.swift @@ -161,7 +161,7 @@ class ActionNotificationGroupCollectionViewCell: UICollectionViewListCell { actionLabel.setEmojis(pairs: people.map { ($0.displayOrUserName, $0.emojis) }, identifier: group.id) - var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) + var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self) statusContentLabel.text = converter.convert(html: status.content) } diff --git a/Tusker/Screens/Notifications/PollFinishedNotificationCollectionViewCell.swift b/Tusker/Screens/Notifications/PollFinishedNotificationCollectionViewCell.swift index 756b38b0..a4fabca4 100644 --- a/Tusker/Screens/Notifications/PollFinishedNotificationCollectionViewCell.swift +++ b/Tusker/Screens/Notifications/PollFinishedNotificationCollectionViewCell.swift @@ -124,7 +124,7 @@ class PollFinishedNotificationCollectionViewCell: UICollectionViewListCell { updateTimestamp() updateDisplayName(account: account) - var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) + var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self) contentLabel.text = converter.convert(html: status.content) pollView.mastodonController = mastodonController diff --git a/Tusker/Screens/Notifications/StatusUpdatedNotificationCollectionViewCell.swift b/Tusker/Screens/Notifications/StatusUpdatedNotificationCollectionViewCell.swift index 9d7177c9..ccc88628 100644 --- a/Tusker/Screens/Notifications/StatusUpdatedNotificationCollectionViewCell.swift +++ b/Tusker/Screens/Notifications/StatusUpdatedNotificationCollectionViewCell.swift @@ -120,7 +120,7 @@ class StatusUpdatedNotificationCollectionViewCell: UICollectionViewListCell { updateTimestamp() updateDisplayName(account: account) - var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) + var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self) contentLabel.text = converter.convert(html: status.content) } diff --git a/Tusker/Views/Account Cell/AccountCollectionViewCell.swift b/Tusker/Views/Account Cell/AccountCollectionViewCell.swift index 4f1e13e9..f7cede79 100644 --- a/Tusker/Views/Account Cell/AccountCollectionViewCell.swift +++ b/Tusker/Views/Account Cell/AccountCollectionViewCell.swift @@ -134,7 +134,7 @@ class AccountCollectionViewCell: UICollectionViewListCell { displayNameLabel.setEmojis(account.emojis, identifier: account.id) } - var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) + var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self) noteLabel.text = converter.convert(html: account.note) noteLabel.setEmojis(account.emojis, identifier: account.id) } diff --git a/Tusker/Views/Status/StatusCardView.swift b/Tusker/Views/Status/StatusCardView.swift index 389f78f1..3cf81e77 100644 --- a/Tusker/Views/Status/StatusCardView.swift +++ b/Tusker/Views/Status/StatusCardView.swift @@ -191,7 +191,7 @@ class StatusCardView: UIView { titleLabel.text = title titleLabel.isHidden = title.isEmpty - var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) + var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self) let description = converter.convert(html: card.description) descriptionLabel.text = description descriptionLabel.isHidden = description.isEmpty