diff --git a/Tusker/Views/ContentTextView.swift b/Tusker/Views/ContentTextView.swift index 0a544121..a2c61180 100644 --- a/Tusker/Views/ContentTextView.swift +++ b/Tusker/Views/ContentTextView.swift @@ -78,10 +78,21 @@ class ContentTextView: LinkTextView, BaseEmojiLabel { linkTextAttributes = [ .foregroundColor: UIColor.tintColor ] + updateLinkUnderlineStyle() // 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) + + NotificationCenter.default.addObserver(self, selector: #selector(updateLinkUnderlineStyle), name: UIAccessibility.buttonShapesEnabledStatusDidChangeNotification, object: nil) + } + + @objc private func updateLinkUnderlineStyle() { + if UIAccessibility.buttonShapesEnabled { + linkTextAttributes[.underlineStyle] = NSUnderlineStyle.single.rawValue + } else { + linkTextAttributes.removeValue(forKey: .underlineStyle) + } } // MARK: - Emojis