diff --git a/client/ios/DivKit/Debug/DebugErrorCollector.swift b/client/ios/DivKit/Debug/DebugErrorCollector.swift index c9b1c48ec..7623bec09 100644 --- a/client/ios/DivKit/Debug/DebugErrorCollector.swift +++ b/client/ios/DivKit/Debug/DebugErrorCollector.swift @@ -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 } diff --git a/client/ios/DivKit/DivKitComponents.swift b/client/ios/DivKit/DivKitComponents.swift index 80362d052..b37e48b65 100644 --- a/client/ios/DivKit/DivKitComponents.swift +++ b/client/ios/DivKit/DivKitComponents.swift @@ -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) } diff --git a/client/ios/DivKit/DivReporter.swift b/client/ios/DivKit/DivReporter.swift index 8f1fc6e3e..e4a35c2ec 100644 --- a/client/ios/DivKit/DivReporter.swift +++ b/client/ios/DivKit/DivReporter.swift @@ -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 { diff --git a/client/ios/LayoutKit/LayoutKit/UI/Blocks/RenderingDelegate.swift b/client/ios/LayoutKit/LayoutKit/UI/Blocks/RenderingDelegate.swift index 2482ef4e1..64ede367e 100644 --- a/client/ios/LayoutKit/LayoutKit/UI/Blocks/RenderingDelegate.swift +++ b/client/ios/LayoutKit/LayoutKit/UI/Blocks/RenderingDelegate.swift @@ -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 @@ -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 {} diff --git a/client/ios/LayoutKit/LayoutKit/UI/Blocks/StateBlock+UIViewRenderableBlock.swift b/client/ios/LayoutKit/LayoutKit/UI/Blocks/StateBlock+UIViewRenderableBlock.swift index a3a068b29..c36cf9550 100644 --- a/client/ios/LayoutKit/LayoutKit/UI/Blocks/StateBlock+UIViewRenderableBlock.swift +++ b/client/ios/LayoutKit/LayoutKit/UI/Blocks/StateBlock+UIViewRenderableBlock.swift @@ -76,6 +76,10 @@ private final class SubviewStorage: RenderingDelegate { ) } + func reportViewWasCreated() { + wrappedRenderingDelegate?.reportViewWasCreated() + } + func getView(_ id: BlockViewID) -> DetachableAnimationBlockView? { views.first { $0.id == id }?.view } diff --git a/client/ios/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderable.swift b/client/ios/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderable.swift index fd17b820d..45ad03e1c 100644 --- a/client/ios/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderable.swift +++ b/client/ios/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderable.swift @@ -23,6 +23,7 @@ extension UIViewRenderable { renderingDelegate: RenderingDelegate? = nil ) -> BlockView { let result = type(of: self).makeBlockView() + renderingDelegate?.reportViewWasCreated() configureBlockView( result, observer: observer,