[WIP] Monoforums

This commit is contained in:
Isaac
2025-05-14 00:50:46 +08:00
parent 9e18743b1b
commit f90402102b
36 changed files with 1191 additions and 340 deletions

View File

@@ -1099,19 +1099,22 @@ open class InteractiveTextNode: ASDisplayNode, TextNodeProtocol, UIGestureRecogn
public let spoilerEffectColor: UIColor
public let areContentAnimationsEnabled: Bool
public let spoilerExpandRect: CGRect?
public var crossfadeContents: ((UIView) -> Void)?
public init(
animation: ListViewItemUpdateAnimation,
spoilerTextColor: UIColor,
spoilerEffectColor: UIColor,
areContentAnimationsEnabled: Bool,
spoilerExpandRect: CGRect?
spoilerExpandRect: CGRect?,
crossfadeContents: ((UIView) -> Void)? = nil
) {
self.animation = animation
self.spoilerTextColor = spoilerTextColor
self.spoilerEffectColor = spoilerEffectColor
self.areContentAnimationsEnabled = areContentAnimationsEnabled
self.spoilerExpandRect = spoilerExpandRect
self.crossfadeContents = crossfadeContents
}
}

View File

@@ -216,9 +216,14 @@ public final class InteractiveTextNodeWithEntities {
return (layout, { applyArguments in
let animation: ListViewItemUpdateAnimation = applyArguments.applyArguments.animation
var crossfadeSourceView: UIView?
if let maybeNode, applyArguments.applyArguments.animation.transition.isAnimated, let animator = applyArguments.applyArguments.animation.animator as? ControlledTransition.LegacyAnimator, animator.transition.isAnimated, maybeNode.textNode.bounds.size != layout.size {
crossfadeSourceView = maybeNode.textNode.view.snapshotView(afterScreenUpdates: false)
}
let result = apply(applyArguments.applyArguments)
if let maybeNode = maybeNode {
if let maybeNode {
maybeNode.attributedString = arguments.attributedString
maybeNode.updateInteractiveContents(
@@ -234,6 +239,10 @@ public final class InteractiveTextNodeWithEntities {
applyArguments: applyArguments.applyArguments
)
if let crossfadeSourceView {
applyArguments.applyArguments.crossfadeContents?(crossfadeSourceView)
}
return maybeNode
} else {
let resultNode = InteractiveTextNodeWithEntities(textNode: result)