Supported func if div view was fully reused

commit_hash:95d786c53358f33ce8a80b6b324d309c5601b75f
This commit is contained in:
burstein
2025-04-08 13:03:20 +03:00
parent 9ae467c700
commit 020d84eb08
6 changed files with 21 additions and 0 deletions
@@ -27,6 +27,10 @@ final class DebugErrorCollector: DivReporter {
wrappedDivReporter.reportAction(cardId: cardId, info: info)
}
func reportViewWasCreated(cardId: DivCardID) {
wrappedDivReporter.reportViewWasCreated(cardId: cardId)
}
var totalErrorCount: Int {
errorStorage.errors.count + layoutErrors.count
}
+4
View File
@@ -445,6 +445,10 @@ private final class ErrorsReportingRenderingDelegate: RenderingDelegate {
divReporter.reportError(cardId: cardId, error: error)
}
func reportViewWasCreated() {
divReporter?.reportViewWasCreated(cardId: cardId)
}
func mapView(_ view: any LayoutKit.BlockView, to id: LayoutKit.BlockViewID) {
wrappedRenderingDelegate.mapView(view, to: id)
}
+4
View File
@@ -6,9 +6,13 @@ import LayoutKit
public protocol DivReporter {
func reportError(cardId: DivCardID, error: DivError)
func reportAction(cardId: DivCardID, info: DivActionInfo)
@_spi(Internal)
func reportViewWasCreated(cardId: DivCardID)
}
extension DivReporter {
public func reportViewWasCreated(cardId _: DivCardID) {}
public func reportAction(cardId _: DivCardID, info _: DivActionInfo) {}
func asExpressionErrorTracker(cardId: DivCardID) -> ExpressionErrorTracker {
@@ -7,6 +7,9 @@ public protocol RenderingDelegate: AnyObject {
func tooltipAnchorViewAdded(anchorView: TooltipAnchorView)
func tooltipAnchorViewRemoved(anchorView: TooltipAnchorView)
func reportRenderingError(message: String, isWarning: Bool, path: UIElementPath)
@_spi(Internal)
func reportViewWasCreated()
}
public typealias BlockViewID = Tagged<BlockViewProtocol, String>
@@ -17,6 +20,7 @@ public protocol DivViewMetaProviding: AnyObject {
extension RenderingDelegate {
public func reportRenderingError(message _: String, isWarning _: Bool, path _: UIElementPath) {}
public func reportViewWasCreated() {}
}
#else
public protocol RenderingDelegate {}
@@ -76,6 +76,10 @@ private final class SubviewStorage: RenderingDelegate {
)
}
func reportViewWasCreated() {
wrappedRenderingDelegate?.reportViewWasCreated()
}
func getView(_ id: BlockViewID) -> DetachableAnimationBlockView? {
views.first { $0.id == id }?.view
}
@@ -23,6 +23,7 @@ extension UIViewRenderable {
renderingDelegate: RenderingDelegate? = nil
) -> BlockView {
let result = type(of: self).makeBlockView()
renderingDelegate?.reportViewWasCreated()
configureBlockView(
result,
observer: observer,