- Forum improvements

- Global autoremove settings
This commit is contained in:
Ali
2022-11-25 23:08:40 +04:00
parent b358391e1d
commit 1656ecff49
82 changed files with 2495 additions and 1059 deletions

View File

@@ -85,7 +85,6 @@ private final class ContextControllerActionsListActionItemNode: HighlightTrackin
self.titleLabelNode = ImmediateTextNode()
self.titleLabelNode.isAccessibilityElement = false
self.titleLabelNode.displaysAsynchronously = false
self.titleLabelNode.isUserInteractionEnabled = false
self.subtitleNode = ImmediateTextNode()
self.subtitleNode.isAccessibilityElement = false
@@ -160,6 +159,16 @@ private final class ContextControllerActionsListActionItemNode: HighlightTrackin
self.pressed()
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if self.titleLabelNode.tapAttributeAction != nil {
if let result = self.titleLabelNode.hitTest(self.view.convert(point, to: self.titleLabelNode.view), with: event) {
return result
}
}
return super.hitTest(point, with: event)
}
func update(presentationData: PresentationData, constrainedSize: CGSize) -> (minSize: CGSize, apply: (_ size: CGSize, _ transition: ContainedViewLayoutTransition) -> Void) {
let sideInset: CGFloat = 16.0
let verticalInset: CGFloat = 11.0
@@ -219,10 +228,23 @@ private final class ContextControllerActionsListActionItemNode: HighlightTrackin
body: MarkdownAttributeSet(font: titleFont, textColor: titleColor),
bold: MarkdownAttributeSet(font: titleBoldFont, textColor: titleColor),
link: MarkdownAttributeSet(font: titleBoldFont, textColor: presentationData.theme.list.itemAccentColor),
linkAttribute: { _ in return nil }
linkAttribute: { value in return ("URL", value) }
)
)
self.titleLabelNode.attributedText = attributedText
self.titleLabelNode.linkHighlightColor = presentationData.theme.list.itemAccentColor.withMultipliedAlpha(0.5)
self.titleLabelNode.highlightAttributeAction = { attributes in
if let _ = attributes[NSAttributedString.Key(rawValue: "URL")] {
return NSAttributedString.Key(rawValue: "URL")
} else {
return nil
}
}
self.titleLabelNode.tapAttributeAction = { [weak item] attributes, _ in
if let _ = attributes[NSAttributedString.Key(rawValue: "URL")] {
item?.textLinkAction()
}
}
} else {
self.titleLabelNode.attributedText = NSAttributedString(
string: self.item.text,
@@ -230,6 +252,8 @@ private final class ContextControllerActionsListActionItemNode: HighlightTrackin
textColor: titleColor)
}
self.titleLabelNode.isUserInteractionEnabled = self.titleLabelNode.tapAttributeAction != nil
self.subtitleNode.attributedText = subtitle.flatMap { subtitle in
return NSAttributedString(
string: subtitle,