Skip to content

Commit baeae01

Browse files
author
robot-divkit
committed
Release 30.33.0
commit_hash:3382acdf9d443706895eae2c474378499eddd133
1 parent 5e7bef5 commit baeae01

File tree

337 files changed

+2960
-873
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+2960
-873
lines changed

.mapping.json

+18
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"DivKit/Animators/ProgressInterpolator.swift":"divkit/public-ios/DivKit/Animators/ProgressInterpolator.swift",
2929
"DivKit/Animators/ValueInterpolator.swift":"divkit/public-ios/DivKit/Animators/ValueInterpolator.swift",
3030
"DivKit/Debug/Block+DebugInfo.swift":"divkit/public-ios/DivKit/Debug/Block+DebugInfo.swift",
31+
"DivKit/Debug/DebugBlock+UIViewRenderableBlock.swift":"divkit/public-ios/DivKit/Debug/DebugBlock+UIViewRenderableBlock.swift",
32+
"DivKit/Debug/DebugBlock.swift":"divkit/public-ios/DivKit/Debug/DebugBlock.swift",
33+
"DivKit/Debug/DebugErrorCollector.swift":"divkit/public-ios/DivKit/Debug/DebugErrorCollector.swift",
3134
"DivKit/Debug/DebugParams.swift":"divkit/public-ios/DivKit/Debug/DebugParams.swift",
3235
"DivKit/Debug/ErrorListView.swift":"divkit/public-ios/DivKit/Debug/ErrorListView.swift",
3336
"DivKit/DivAccessibilityElementsStorage.swift":"divkit/public-ios/DivKit/DivAccessibilityElementsStorage.swift",
@@ -181,6 +184,7 @@
181184
"DivKit/Timers/DivTimerStorage.swift":"divkit/public-ios/DivKit/Timers/DivTimerStorage.swift",
182185
"DivKit/Timers/TimeIntervalMeasuring.swift":"divkit/public-ios/DivKit/Timers/TimeIntervalMeasuring.swift",
183186
"DivKit/Tooltips/DivTooltipViewFactory.swift":"divkit/public-ios/DivKit/Tooltips/DivTooltipViewFactory.swift",
187+
"DivKit/Types.swift":"divkit/public-ios/DivKit/Types.swift",
184188
"DivKit/Variables/DivTriggersStorage.swift":"divkit/public-ios/DivKit/Variables/DivTriggersStorage.swift",
185189
"DivKit/Variables/DivVariableName.swift":"divkit/public-ios/DivKit/Variables/DivVariableName.swift",
186190
"DivKit/Variables/DivVariableStorage.swift":"divkit/public-ios/DivKit/Variables/DivVariableStorage.swift",
@@ -483,6 +487,14 @@
483487
"DivKit/generated_sources/DivTextRangeBackgroundTemplate.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeBackgroundTemplate.swift",
484488
"DivKit/generated_sources/DivTextRangeBorder.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeBorder.swift",
485489
"DivKit/generated_sources/DivTextRangeBorderTemplate.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeBorderTemplate.swift",
490+
"DivKit/generated_sources/DivTextRangeMask.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeMask.swift",
491+
"DivKit/generated_sources/DivTextRangeMaskBase.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeMaskBase.swift",
492+
"DivKit/generated_sources/DivTextRangeMaskBaseTemplate.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeMaskBaseTemplate.swift",
493+
"DivKit/generated_sources/DivTextRangeMaskParticles.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeMaskParticles.swift",
494+
"DivKit/generated_sources/DivTextRangeMaskParticlesTemplate.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeMaskParticlesTemplate.swift",
495+
"DivKit/generated_sources/DivTextRangeMaskSolid.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeMaskSolid.swift",
496+
"DivKit/generated_sources/DivTextRangeMaskSolidTemplate.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeMaskSolidTemplate.swift",
497+
"DivKit/generated_sources/DivTextRangeMaskTemplate.swift":"divkit/public-ios/DivKit/generated_sources/DivTextRangeMaskTemplate.swift",
486498
"DivKit/generated_sources/DivTextTemplate.swift":"divkit/public-ios/DivKit/generated_sources/DivTextTemplate.swift",
487499
"DivKit/generated_sources/DivTimer.swift":"divkit/public-ios/DivKit/generated_sources/DivTimer.swift",
488500
"DivKit/generated_sources/DivTimerTemplate.swift":"divkit/public-ios/DivKit/generated_sources/DivTimerTemplate.swift",
@@ -717,6 +729,7 @@
717729
"LayoutKit/LayoutKit/ClosureIntrinsicCalculator.swift":"divkit/public-ios/LayoutKit/LayoutKit/ClosureIntrinsicCalculator.swift",
718730
"LayoutKit/LayoutKit/Exports.swift":"divkit/public-ios/LayoutKit/LayoutKit/Exports.swift",
719731
"LayoutKit/LayoutKit/GenericViewBlock.swift":"divkit/public-ios/LayoutKit/LayoutKit/GenericViewBlock.swift",
732+
"LayoutKit/LayoutKit/Tooltips/TooltipAnchorView.swift":"divkit/public-ios/LayoutKit/LayoutKit/Tooltips/TooltipAnchorView.swift",
720733
"LayoutKit/LayoutKit/Tooltips/TooltipFactory.swift":"divkit/public-ios/LayoutKit/LayoutKit/Tooltips/TooltipFactory.swift",
721734
"LayoutKit/LayoutKit/Tooltips/TooltipManager.swift":"divkit/public-ios/LayoutKit/LayoutKit/Tooltips/TooltipManager.swift",
722735
"LayoutKit/LayoutKit/Types.swift":"divkit/public-ios/LayoutKit/LayoutKit/Types.swift",
@@ -1011,6 +1024,7 @@
10111024
"Specs/DivKit/30.30.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.30.0/DivKit.podspec",
10121025
"Specs/DivKit/30.31.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.31.0/DivKit.podspec",
10131026
"Specs/DivKit/30.32.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.32.0/DivKit.podspec",
1027+
"Specs/DivKit/30.33.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.33.0/DivKit.podspec",
10141028
"Specs/DivKit/30.4.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.4.0/DivKit.podspec",
10151029
"Specs/DivKit/30.5.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.5.0/DivKit.podspec",
10161030
"Specs/DivKit/30.6.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.6.0/DivKit.podspec",
@@ -1095,6 +1109,7 @@
10951109
"Specs/DivKitExtensions/30.30.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.30.0/DivKitExtensions.podspec",
10961110
"Specs/DivKitExtensions/30.31.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.31.0/DivKitExtensions.podspec",
10971111
"Specs/DivKitExtensions/30.32.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.32.0/DivKitExtensions.podspec",
1112+
"Specs/DivKitExtensions/30.33.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.33.0/DivKitExtensions.podspec",
10981113
"Specs/DivKitExtensions/30.4.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.4.0/DivKitExtensions.podspec",
10991114
"Specs/DivKitExtensions/30.5.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.5.0/DivKitExtensions.podspec",
11001115
"Specs/DivKitExtensions/30.6.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.6.0/DivKitExtensions.podspec",
@@ -1161,6 +1176,7 @@
11611176
"Specs/DivKit_LayoutKit/30.30.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.30.0/DivKit_LayoutKit.podspec",
11621177
"Specs/DivKit_LayoutKit/30.31.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.31.0/DivKit_LayoutKit.podspec",
11631178
"Specs/DivKit_LayoutKit/30.32.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.32.0/DivKit_LayoutKit.podspec",
1179+
"Specs/DivKit_LayoutKit/30.33.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.33.0/DivKit_LayoutKit.podspec",
11641180
"Specs/DivKit_LayoutKit/30.4.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.4.0/DivKit_LayoutKit.podspec",
11651181
"Specs/DivKit_LayoutKit/30.5.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.5.0/DivKit_LayoutKit.podspec",
11661182
"Specs/DivKit_LayoutKit/30.6.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.6.0/DivKit_LayoutKit.podspec",
@@ -1227,6 +1243,7 @@
12271243
"Specs/DivKit_LayoutKitInterface/30.30.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.30.0/DivKit_LayoutKitInterface.podspec",
12281244
"Specs/DivKit_LayoutKitInterface/30.31.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.31.0/DivKit_LayoutKitInterface.podspec",
12291245
"Specs/DivKit_LayoutKitInterface/30.32.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.32.0/DivKit_LayoutKitInterface.podspec",
1246+
"Specs/DivKit_LayoutKitInterface/30.33.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.33.0/DivKit_LayoutKitInterface.podspec",
12301247
"Specs/DivKit_LayoutKitInterface/30.4.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.4.0/DivKit_LayoutKitInterface.podspec",
12311248
"Specs/DivKit_LayoutKitInterface/30.5.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.5.0/DivKit_LayoutKitInterface.podspec",
12321249
"Specs/DivKit_LayoutKitInterface/30.6.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.6.0/DivKit_LayoutKitInterface.podspec",
@@ -1293,6 +1310,7 @@
12931310
"Specs/DivKit_Serialization/30.30.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.30.0/DivKit_Serialization.podspec",
12941311
"Specs/DivKit_Serialization/30.31.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.31.0/DivKit_Serialization.podspec",
12951312
"Specs/DivKit_Serialization/30.32.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.32.0/DivKit_Serialization.podspec",
1313+
"Specs/DivKit_Serialization/30.33.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.33.0/DivKit_Serialization.podspec",
12961314
"Specs/DivKit_Serialization/30.4.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.4.0/DivKit_Serialization.podspec",
12971315
"Specs/DivKit_Serialization/30.5.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.5.0/DivKit_Serialization.podspec",
12981316
"Specs/DivKit_Serialization/30.6.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.6.0/DivKit_Serialization.podspec",

DivKit/Actions/ArrayActionsHandler.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ final class ArrayActionsHandler {
6565
}
6666

6767
extension DivActionHandlingContext {
68-
fileprivate func getVariableValue(_ name: DivVariableName) -> [AnyHashable]? {
68+
fileprivate func getVariableValue(_ name: DivVariableName) -> DivArray? {
6969
variablesStorage.getVariableValue(path: path, name: name)
7070
}
7171

72-
fileprivate func setVariableValue(_ name: DivVariableName, _ value: [AnyHashable]) {
72+
fileprivate func setVariableValue(_ name: DivVariableName, _ value: DivArray) {
7373
variablesStorage.update(path: path, name: name, value: .array(value))
7474
}
7575
}

DivKit/Actions/DivActionInfo.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Foundation
2-
32
import LayoutKit
43

54
public struct DivActionInfo {

DivKit/Actions/DivActionIntent.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Foundation
2-
32
import VGSL
43

54
enum DivActionIntent {

DivKit/Actions/DivActionURLHandler.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import CoreGraphics
22
import Foundation
3-
43
import LayoutKit
54
import VGSL
65

DivKit/Actions/SetStoredValueActionHandler.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ extension DivTypedValue {
4040
.string
4141
case .urlValue:
4242
.url
43-
case .arrayValue, .dictValue:
44-
nil
43+
case .arrayValue:
44+
.array
45+
case .dictValue:
46+
.dict
4547
}
4648
}
4749
}

DivKit/Debug/Block+DebugInfo.swift

+7-62
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,28 @@
11
import CoreGraphics
22
import Foundation
3-
43
import LayoutKit
54
import VGSL
65

76
extension Block {
87
func addingDebugInfo(context: DivBlockModelingContext) -> Block {
98
let debugParams = context.debugParams
10-
guard debugParams.isDebugInfoEnabled else {
11-
return self
12-
}
13-
14-
let errors = context.errorsStorage.errors
15-
let errorsCount = errors.count
16-
guard errorsCount > 0 else {
9+
guard debugParams.isDebugInfoEnabled,
10+
let debugErrorCollector = context.debugErrorCollector else {
1711
return self
1812
}
1913

20-
let counterText = errorsCount > maxCount
21-
? "\(maxCount)+"
22-
: "\(errorsCount)"
23-
24-
let typo = Typo(font: context.fontProvider.font(size: 14))
25-
.with(color: .white)
26-
27-
let action = UserInterfaceAction(
28-
payload: .url(DebugInfoBlock.showOverlayURL),
29-
path: context.parentPath + "div_errors_indicator",
30-
accessibilityElement: nil
31-
)
32-
33-
let counter = TextBlock(
34-
widthTrait: .intrinsic,
35-
text: counterText.with(typo: typo)
36-
)
37-
38-
let indicator = counter
39-
.addingVerticalGaps(errorsButtonCounterGaps)
40-
.addingHorizontalGaps(calculateCounterHorizontalGaps(counter: counter))
41-
.addingDecorations(
42-
boundary: .clipCorner(radius: 10),
43-
backgroundColor: .red
44-
)
45-
.addingEdgeInsets(debugParams.errorCounterInsets)
46-
.addingEdgeGaps(2)
47-
.addingAccessibilityID(withTraits: (
48-
"divLayoutErrorCounter",
49-
.button
50-
))
51-
.addingDecorations(action: action)
52-
53-
let debugInfoBlock = DebugInfoBlock(
54-
child: indicator,
55-
showDebugInfo: {
56-
#if os(iOS)
57-
debugParams.showDebugInfo(ErrorListView(errors: errors.map(\.prettyMessage)))
58-
#else
59-
return
60-
#endif
61-
}
14+
let debugBlock = DebugBlock(
15+
errorCollector: debugErrorCollector,
16+
showDebugInfo: debugParams.showDebugInfo
6217
)
6318

6419
let block = LayeredBlock(
6520
widthTrait: calculatedWidthTrait,
6621
heightTrait: calculatedHeightTrait,
67-
children: [self, debugInfoBlock]
22+
verticalChildrenAlignment: .center,
23+
children: [self, debugBlock]
6824
)
6925

7026
return block
7127
}
7228
}
73-
74-
private func calculateCounterHorizontalGaps(counter: Block) -> CGFloat {
75-
let additionalGap = (counter.intrinsicSize.height - counter.intrinsicSize.width) / 2
76-
return max(
77-
errorsButtonCounterGaps,
78-
errorsButtonCounterGaps + additionalGap
79-
)
80-
}
81-
82-
private let errorsButtonCounterGaps: CGFloat = 4
83-
private let maxCount = 9999
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import LayoutKit
2+
import UIKit
3+
import VGSL
4+
5+
extension DebugBlock: UIViewRenderable {
6+
static func makeBlockView() -> any LayoutKit.BlockView {
7+
DebugBlockView()
8+
}
9+
10+
func canConfigureBlockView(_ view: any LayoutKit.BlockView) -> Bool {
11+
view is DebugBlockView
12+
}
13+
14+
func configureBlockView(
15+
_ view: BlockView,
16+
observer _: ElementStateObserver?,
17+
overscrollDelegate _: ScrollDelegate?,
18+
renderingDelegate _: RenderingDelegate?
19+
) {
20+
(view as? DebugBlockView)?.configure(
21+
errorCollector: errorCollector,
22+
showDebugInfo: showDebugInfo
23+
)
24+
}
25+
}
26+
27+
private final class DebugBlockView: BlockView, VisibleBoundsTrackingContainer {
28+
let effectiveBackgroundColor: UIColor? = nil
29+
let visibleBoundsTrackingSubviews: [VisibleBoundsTrackingView] = []
30+
31+
private var showDebugInfo: ((ViewType) -> Void)?
32+
private var errorCollector: DebugErrorCollector?
33+
private let disposePool = AutodisposePool()
34+
35+
private let errorsLabel: UILabel = {
36+
let label = UILabel(frame: CGRect(origin: .zero, size: CGSize(squareDimension: 50.0)))
37+
label.text = "0"
38+
label.numberOfLines = 1
39+
label.font = .systemFont(ofSize: 14)
40+
label.textColor = .white
41+
label.textAlignment = .center
42+
label.backgroundColor = .red
43+
label.isHidden = true
44+
return label
45+
}()
46+
47+
init() {
48+
super.init(frame: .zero)
49+
addSubview(errorsLabel)
50+
accessibilityIdentifier = "divLayoutErrorCounter"
51+
accessibilityTraits = .button
52+
clipsToBounds = true
53+
addGestureRecognizer(UITapGestureRecognizer(
54+
target: self,
55+
action: #selector(handleTapGesture(_:))
56+
))
57+
}
58+
59+
@available(*, unavailable)
60+
required init?(coder _: NSCoder) {
61+
fatalError("init(coder:) has not been implemented")
62+
}
63+
64+
func configure(
65+
errorCollector: DebugErrorCollector,
66+
showDebugInfo: @escaping (ViewType) -> Void
67+
) {
68+
self.showDebugInfo = showDebugInfo
69+
if self.errorCollector !== errorCollector {
70+
self.errorCollector = errorCollector
71+
errorCollector.observableErrorCount.currentAndNewValues.addObserver { [weak self] _ in
72+
self?.updateCountLabel()
73+
}.dispose(in: disposePool)
74+
}
75+
}
76+
77+
override func layoutSubviews() {
78+
super.layoutSubviews()
79+
errorsLabel.frame = bounds
80+
layer.cornerRadius = bounds.size.height / 2
81+
}
82+
83+
private func updateCountLabel() {
84+
let errorsCount = errorCollector?.totalErrorCount ?? 0
85+
let isHidden = errorsCount == 0
86+
isUserInteractionEnabled = !isHidden
87+
errorsLabel.isHidden = isHidden
88+
errorsLabel.text = "\(min(maxCount, errorsCount))"
89+
}
90+
91+
@objc func handleTapGesture(_: UITapGestureRecognizer) {
92+
guard let showDebugInfo, let errorCollector, errorCollector.totalErrorCount > 0 else { return }
93+
showDebugInfo(ErrorListView(errors: errorCollector.errorList))
94+
}
95+
}
96+
97+
private let showOverlayURL = URL(string: "debugInfo://show")!
98+
private let maxCount = 9999

DivKit/Debug/DebugBlock.swift

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import Foundation
2+
import LayoutKit
3+
import VGSL
4+
5+
final class DebugBlock: BlockWithTraits, LayoutCachingDefaultImpl {
6+
let widthTrait = LayoutTrait.fixed(buttonSize)
7+
let heightTrait = LayoutTrait.fixed(buttonSize)
8+
9+
var intrinsicContentWidth: CGFloat {
10+
widthTrait.fixedValue ?? 0.0
11+
}
12+
13+
func intrinsicContentHeight(forWidth _: CGFloat) -> CGFloat {
14+
heightTrait.fixedValue ?? 0.0
15+
}
16+
17+
let errorCollector: DebugErrorCollector
18+
let showDebugInfo: (ViewType) -> Void
19+
20+
init(
21+
errorCollector: DebugErrorCollector,
22+
showDebugInfo: @escaping (ViewType) -> Void
23+
) {
24+
self.errorCollector = errorCollector
25+
self.showDebugInfo = showDebugInfo
26+
}
27+
28+
func equals(_ other: any LayoutKit.Block) -> Bool {
29+
if self === other { return true }
30+
guard let other = other as? DebugBlock else { return false }
31+
return errorCollector === other.errorCollector
32+
}
33+
34+
var debugDescription: String {
35+
"DebugBlock errors: \(errorCollector.debugDescription))"
36+
}
37+
38+
func getImageHolders() -> [any VGSLUI.ImageHolder] {
39+
[]
40+
}
41+
42+
func updated(withStates _: LayoutKit.BlocksState) throws -> Self {
43+
self
44+
}
45+
}
46+
47+
private let buttonSize = 50.0

0 commit comments

Comments
 (0)