From 33f1cfcc77b11073b54585f97f1a3e48da063a9a Mon Sep 17 00:00:00 2001 From: CMK Date: Tue, 2 Mar 2021 12:01:11 +0800 Subject: [PATCH] fix: server description may display in HTML format issue. resolve: #30 --- .../PickServer/TableViewCell/PickServerCell.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift index 0ded9392..fef09b95 100644 --- a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift +++ b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift @@ -8,6 +8,7 @@ import UIKit import MastodonSDK import Kingfisher +import Kanna protocol PickServerCellDelegate: class { func pickServerCell(modeChange server: Mastodon.Entity.Server, newMode: PickServerCell.Mode, updates: (() -> Void)) @@ -326,7 +327,13 @@ extension PickServerCell { private func updateServerInfo() { guard let serverInfo = server else { return } domainLabel.text = serverInfo.domain - descriptionLabel.text = serverInfo.description + descriptionLabel.text = { + guard let html = try? HTML(html: serverInfo.description, encoding: .utf8) else { + return serverInfo.description + } + + return html.text ?? serverInfo.description + }() let processor = RoundCornerImageProcessor(cornerRadius: 3) thumbImageView.kf.indicatorType = .activity thumbImageView.kf.setImage(with: URL(string: serverInfo.proxiedThumbnail ?? "")!, placeholder: UIImage.placeholder(color: Asset.Colors.lightBackground.color), options: [