visionOS: Use UIColor.link for text links

This commit is contained in:
Shadowfacts 2023-11-07 22:37:07 -05:00
parent a93a4fccc1
commit 9d01bbabd7
3 changed files with 14 additions and 0 deletions

View File

@ -78,9 +78,15 @@ class ContentTextView: LinkTextView, BaseEmojiLabel {
textContainerInset = .zero textContainerInset = .zero
textContainer.lineFragmentPadding = 0 textContainer.lineFragmentPadding = 0
#if os(visionOS)
linkTextAttributes = [
.foregroundColor: UIColor.link
]
#else
linkTextAttributes = [ linkTextAttributes = [
.foregroundColor: UIColor.tintColor .foregroundColor: UIColor.tintColor
] ]
#endif
updateLinkUnderlineStyle() updateLinkUnderlineStyle()
// the text view's builtin link interaction code is tied to isSelectable, so we need to use our own tap recognizer // the text view's builtin link interaction code is tied to isSelectable, so we need to use our own tap recognizer

View File

@ -48,7 +48,11 @@ class ProfileFieldValueView: UIView {
converted.enumerateAttribute(.link, in: converted.fullRange) { value, range, stop in converted.enumerateAttribute(.link, in: converted.fullRange) { value, range, stop in
guard value != nil else { return } guard value != nil else { return }
#if os(visionOS)
converted.addAttribute(.foregroundColor, value: UIColor.link, range: range)
#else
converted.addAttribute(.foregroundColor, value: UIColor.tintColor, range: range) converted.addAttribute(.foregroundColor, value: UIColor.tintColor, range: range)
#endif
// the .link attribute in a UILabel always makes the color blue >.> // the .link attribute in a UILabel always makes the color blue >.>
converted.removeAttribute(.link, range: range) converted.removeAttribute(.link, range: range)
} }

View File

@ -69,7 +69,11 @@ class StatusCardView: UIView {
domainLabel.font = .preferredFont(forTextStyle: .caption2) domainLabel.font = .preferredFont(forTextStyle: .caption2)
domainLabel.adjustsFontForContentSizeCategory = true domainLabel.adjustsFontForContentSizeCategory = true
domainLabel.numberOfLines = 1 domainLabel.numberOfLines = 1
#if os(visionOS)
domainLabel.textColor = .link
#else
domainLabel.textColor = .tintColor domainLabel.textColor = .tintColor
#endif
vStack = UIStackView(arrangedSubviews: [ vStack = UIStackView(arrangedSubviews: [
titleLabel, titleLabel,