Underline links when button shapes accessibility setting is on
This commit is contained in:
parent
f7a9075b77
commit
74820e8922
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue