From 105a01811ab6d13a61c18403296d85c930972a28 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 18 Jul 2023 21:01:30 -0700 Subject: [PATCH] Actual fix for links appearing as the wrong color Closes #402 --- Tusker/Views/ContentTextView.swift | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Tusker/Views/ContentTextView.swift b/Tusker/Views/ContentTextView.swift index f4136855..0a544121 100644 --- a/Tusker/Views/ContentTextView.swift +++ b/Tusker/Views/ContentTextView.swift @@ -75,6 +75,10 @@ class ContentTextView: LinkTextView, BaseEmojiLabel { textContainerInset = .zero textContainer.lineFragmentPadding = 0 + linkTextAttributes = [ + .foregroundColor: UIColor.tintColor + ] + // the text view's builtin link interaction code is tied to isSelectable, so we need to use our own tap recognizer let recognizer = UITapGestureRecognizer(target: self, action: #selector(textTapped(_:))) addGestureRecognizer(recognizer) @@ -94,12 +98,6 @@ class ContentTextView: LinkTextView, BaseEmojiLabel { // MARK: - HTML Parsing func setTextFromHtml(_ html: String) { - // this shouldn't be necessary, but sometimes when the text view is updated before - // being added to the view hierarchy, it doesn't get tintColorDidChange calld - // when it's actually added, so links have the wrong color - // see #402 - self.tintColor = Preferences.shared.accentColor.color - self.attributedText = htmlConverter.convert(html) }