Compare commits
No commits in common. "3109aafd20c7aa5a39c174fff90d20c628a59304" and "33999fe895c600ae91b6f0e79d66e6f00622c3d9" have entirely different histories.
3109aafd20
...
33999fe895
|
@ -75,10 +75,6 @@ class ContentTextView: LinkTextView, BaseEmojiLabel {
|
||||||
textContainerInset = .zero
|
textContainerInset = .zero
|
||||||
textContainer.lineFragmentPadding = 0
|
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
|
// 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(_:)))
|
let recognizer = UITapGestureRecognizer(target: self, action: #selector(textTapped(_:)))
|
||||||
addGestureRecognizer(recognizer)
|
addGestureRecognizer(recognizer)
|
||||||
|
@ -98,6 +94,12 @@ class ContentTextView: LinkTextView, BaseEmojiLabel {
|
||||||
|
|
||||||
// MARK: - HTML Parsing
|
// MARK: - HTML Parsing
|
||||||
func setTextFromHtml(_ html: String) {
|
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)
|
self.attributedText = htmlConverter.convert(html)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,19 +125,7 @@ extension StatusCollectionViewCell {
|
||||||
statusState.collapsed = false
|
statusState.collapsed = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let expected = !statusState.collapsible!
|
collapseButton.isHidden = !statusState.collapsible!
|
||||||
// Very very rarely, setting isHidden to false only seems to partially take effect:
|
|
||||||
// the button will be rendered, but isHidden will still return true, and the
|
|
||||||
// containing stack view won't have updated constraints for it and so the cell
|
|
||||||
// layout will be wrong and the button will overlap other views in the stack.
|
|
||||||
// So, as a truly cursed workaround, just try a few times in a row until reading
|
|
||||||
// back isHidden returns the correct value.
|
|
||||||
for _ in 0..<5 {
|
|
||||||
collapseButton.isHidden = expected
|
|
||||||
if collapseButton.isHidden == expected {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contentContainer.setCollapsed(statusState.collapsed!)
|
contentContainer.setCollapsed(statusState.collapsed!)
|
||||||
if statusState.collapsed! {
|
if statusState.collapsed! {
|
||||||
contentContainer.alpha = 0
|
contentContainer.alpha = 0
|
||||||
|
|
Loading…
Reference in New Issue