Skip to content

Commit 0978d01

Browse files
author
robot-divkit
committed
Release 31.6.0
commit_hash:2a4413b0c98ffd48bee53ef6ea363de1c1da5ab0
1 parent c016dc5 commit 0978d01

File tree

16 files changed

+202
-32
lines changed

16 files changed

+202
-32
lines changed

.mapping.json

+5
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,7 @@
10501050
"Specs/DivKit/31.4.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/31.4.0/DivKit.podspec",
10511051
"Specs/DivKit/31.5.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/31.5.0/DivKit.podspec",
10521052
"Specs/DivKit/31.5.1/DivKit.podspec":"divkit/public-ios/Specs/DivKit/31.5.1/DivKit.podspec",
1053+
"Specs/DivKit/31.6.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/31.6.0/DivKit.podspec",
10531054
"Specs/DivKitExtensions/24.3.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/24.3.0/DivKitExtensions.podspec",
10541055
"Specs/DivKitExtensions/25.0.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/25.0.0/DivKitExtensions.podspec",
10551056
"Specs/DivKitExtensions/25.1.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/25.1.0/DivKitExtensions.podspec",
@@ -1142,6 +1143,7 @@
11421143
"Specs/DivKitExtensions/31.4.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/31.4.0/DivKitExtensions.podspec",
11431144
"Specs/DivKitExtensions/31.5.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/31.5.0/DivKitExtensions.podspec",
11441145
"Specs/DivKitExtensions/31.5.1/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/31.5.1/DivKitExtensions.podspec",
1146+
"Specs/DivKitExtensions/31.6.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/31.6.0/DivKitExtensions.podspec",
11451147
"Specs/DivKit_LayoutKit/28.0.1/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/28.0.1/DivKit_LayoutKit.podspec",
11461148
"Specs/DivKit_LayoutKit/28.1.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/28.1.0/DivKit_LayoutKit.podspec",
11471149
"Specs/DivKit_LayoutKit/28.10.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/28.10.0/DivKit_LayoutKit.podspec",
@@ -1216,6 +1218,7 @@
12161218
"Specs/DivKit_LayoutKit/31.4.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/31.4.0/DivKit_LayoutKit.podspec",
12171219
"Specs/DivKit_LayoutKit/31.5.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/31.5.0/DivKit_LayoutKit.podspec",
12181220
"Specs/DivKit_LayoutKit/31.5.1/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/31.5.1/DivKit_LayoutKit.podspec",
1221+
"Specs/DivKit_LayoutKit/31.6.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/31.6.0/DivKit_LayoutKit.podspec",
12191222
"Specs/DivKit_LayoutKitInterface/28.0.1/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/28.0.1/DivKit_LayoutKitInterface.podspec",
12201223
"Specs/DivKit_LayoutKitInterface/28.1.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/28.1.0/DivKit_LayoutKitInterface.podspec",
12211224
"Specs/DivKit_LayoutKitInterface/28.10.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/28.10.0/DivKit_LayoutKitInterface.podspec",
@@ -1290,6 +1293,7 @@
12901293
"Specs/DivKit_LayoutKitInterface/31.4.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/31.4.0/DivKit_LayoutKitInterface.podspec",
12911294
"Specs/DivKit_LayoutKitInterface/31.5.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/31.5.0/DivKit_LayoutKitInterface.podspec",
12921295
"Specs/DivKit_LayoutKitInterface/31.5.1/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/31.5.1/DivKit_LayoutKitInterface.podspec",
1296+
"Specs/DivKit_LayoutKitInterface/31.6.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/31.6.0/DivKit_LayoutKitInterface.podspec",
12931297
"Specs/DivKit_Serialization/28.0.1/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/28.0.1/DivKit_Serialization.podspec",
12941298
"Specs/DivKit_Serialization/28.1.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/28.1.0/DivKit_Serialization.podspec",
12951299
"Specs/DivKit_Serialization/28.10.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/28.10.0/DivKit_Serialization.podspec",
@@ -1364,6 +1368,7 @@
13641368
"Specs/DivKit_Serialization/31.4.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/31.4.0/DivKit_Serialization.podspec",
13651369
"Specs/DivKit_Serialization/31.5.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/31.5.0/DivKit_Serialization.podspec",
13661370
"Specs/DivKit_Serialization/31.5.1/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/31.5.1/DivKit_Serialization.podspec",
1371+
"Specs/DivKit_Serialization/31.6.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/31.6.0/DivKit_Serialization.podspec",
13671372
"Specs/LayoutKit/24.3.0/LayoutKit.podspec":"divkit/public-ios/Specs/LayoutKit/24.3.0/LayoutKit.podspec",
13681373
"Specs/LayoutKit/25.0.0/LayoutKit.podspec":"divkit/public-ios/Specs/LayoutKit/25.0.0/LayoutKit.podspec",
13691374
"Specs/LayoutKit/25.1.0/LayoutKit.podspec":"divkit/public-ios/Specs/LayoutKit/25.1.0/LayoutKit.podspec",

DivKit/Actions/DivActionURLHandler.swift

+9
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,14 @@ public enum DivActionURLHandler {
1010
case state(DivCardID)
1111
case variable([DivCardID: Set<DivVariableName>])
1212
case external
13+
14+
var isVariable: Bool {
15+
switch self {
16+
case .variable:
17+
return true
18+
default:
19+
return false
20+
}
21+
}
1322
}
1423
}

DivKit/DivKitInfo.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
public enum DivKitInfo {
2-
public static let version = "31.5.1"
2+
public static let version = "31.6.0"
33
}

DivKit/Extensions/DivTypedValueExtensions.swift

+6-8
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ extension DivTypedValue {
66
) -> DivVariableValue? {
77
switch self {
88
case let .arrayValue(value):
9-
if let arrayValue = value.resolveValue(expressionResolver) as? DivArray {
10-
return .array(arrayValue)
9+
if let array = value.resolveValue(expressionResolver),
10+
let divArray = DivArray.fromAny(array) {
11+
return .array(divArray)
1112
}
1213
return nil
1314
case let .booleanValue(value):
@@ -53,8 +54,8 @@ extension DivTypedValue {
5354
) -> AnyHashable? {
5455
switch self {
5556
case let .arrayValue(value):
56-
if let arrayValue = value.resolveValue(expressionResolver) as? DivArray {
57-
return arrayValue
57+
if let arrayValue = value.resolveValue(expressionResolver) {
58+
return DivArray.fromAny(arrayValue)
5859
}
5960
return nil
6061
case let .booleanValue(value):
@@ -68,10 +69,7 @@ extension DivTypedValue {
6869
}
6970
return nil
7071
case let .dictValue(value):
71-
if let dictValue = value.value as? DivDictionary {
72-
return dictValue
73-
}
74-
return nil
72+
return DivDictionary.fromAny(value.value)
7573
case let .integerValue(value):
7674
if let integerValue = value.resolveValue(expressionResolver) {
7775
return integerValue

DivKit/Form/SubmitRequest.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
public struct SubmitRequest {
3+
public struct SubmitRequest: Equatable {
44
public let url: URL
55
public let method: String
66
public let headers: [String: String]

DivKit/LayoutProvider/DivLayoutProviderHandler.swift

+11-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ public final class DivLayoutProviderHandler {
77
private let autodisposePool = AutodisposePool()
88

99
// Stores variables that has been updated during the layout cycle to prevent relayout.
10-
// onCardUpdated() must be called when the card is updated and new layout cycle begins.
10+
// resetUpdatedVariables() must be called when the card is updated and new layout cycle begins.
11+
private var updateVariablesCounter = 0
1112
private var updatedVariables: Set<DivVariableName> = []
1213

1314
public init(variablesStorage: DivVariablesStorage) {
@@ -41,6 +42,7 @@ public final class DivLayoutProviderHandler {
4142
}
4243

4344
public func resetUpdatedVariables() {
45+
updateVariablesCounter = 0
4446
updatedVariables = []
4547
}
4648

@@ -55,10 +57,14 @@ public final class DivLayoutProviderHandler {
5557
}
5658

5759
if updatedVariables.contains(variableName) {
58-
DivKitLogger.warning(
59-
"[DivLayoutProviderHandler] Variable '\(variableName)' was already updated during the layout cycle."
60-
)
61-
return
60+
if updateVariablesCounter > 3 {
61+
DivKitLogger.warning(
62+
"[DivLayoutProviderHandler] Variable '\(variableName)' was already updated more then 3 times during the layout cycle. It looks like there is a circular dependency in the layout."
63+
)
64+
return
65+
} else {
66+
updateVariablesCounter += 1
67+
}
6268
}
6369

6470
updatedVariables.insert(variableName)

DivKit/Views/DivBlockProvider.swift

+4
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ final class DivBlockProvider {
211211
debugParams: debugParams,
212212
parentScrollView: parentScrollView
213213
)
214+
215+
if reasons.filter(\.isVariable).isEmpty {
216+
context.layoutProviderHandler?.resetUpdatedVariables()
217+
}
214218
dataErrors.forEach { context.errorsStorage.add($0) }
215219
do {
216220
block = try measurements.renderTime.updateMeasure {

LayoutKit/LayoutKit/Blocks/TextInputBlock.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ public final class TextInputBlock: BlockWithTraits {
220220

221221
extension TextInputBlock {
222222
public static func ==(lhs: TextInputBlock, rhs: TextInputBlock) -> Bool {
223-
lhs.heightTrait == rhs.heightTrait
223+
lhs.autocapitalizationType == rhs.autocapitalizationType
224+
&& lhs.enterKeyType == rhs.enterKeyType
225+
&& lhs.enterKeyActions == rhs.enterKeyActions
226+
&& lhs.heightTrait == rhs.heightTrait
224227
&& lhs.highlightColor == rhs.highlightColor
225228
&& lhs.hint == rhs.hint
226229
&& lhs.inputType == rhs.inputType

LayoutKit/LayoutKit/Tooltips/TooltipManager.swift

+13-8
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,25 @@ public class DefaultTooltipManager: TooltipManager {
129129
}
130130
)
131131

132+
// Passing the statusBarStyle control to `rootViewController` of the main window
133+
let vc = ProxyViewController(
134+
viewController: currentKeyWindow.rootViewController ?? UIViewController(),
135+
viewDidAppear: { UIAccessibility.post(notification: .screenChanged, argument: view) }
136+
)
137+
vc.view = view
138+
132139
if tooltip.params.mode == .modal {
133-
// Passing the statusBarStyle control to `rootViewController` of the main window
134-
let vc = ProxyViewController(
135-
viewController: currentKeyWindow.rootViewController ?? UIViewController(),
136-
viewDidAppear: { UIAccessibility.post(notification: .screenChanged, argument: view) }
137-
)
138-
vc.view = view
139140
// Window won't rotate if `rootViewController` is not set
140141
modalTooltipWindow.rootViewController = vc
141142
modalWindowManager.showModalWindow()
142143
view.frame = modalTooltipWindow.bounds
143144
} else {
144-
currentKeyWindow.addSubview(view)
145-
view.frame = currentKeyWindow.bounds
145+
guard let rootViewController = currentKeyWindow.rootViewController else {
146+
return assertionFailure("Failed to read root view controller of key window")
147+
}
148+
rootViewController.addChild(vc)
149+
rootViewController.view.addSubview(view)
150+
view.frame = rootViewController.view.bounds
146151
}
147152

148153
showingTooltips[info.id] = view

LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorLayer.swift

+10-4
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,17 @@ extension ScrollPageIndicatorLayer {
240240
}
241241

242242
let fromIndex = Int(fromValue)
243-
if fromIndex == numberOfPages, currentIndex == 0 {
244-
addAnimation(-1)
245-
} else {
246-
addAnimation(fromValue)
243+
let indexDifference = currentIndex - fromIndex
244+
let numberOfPages = Double(numberOfPages)
245+
let correctedFromValue: Double = switch indexDifference {
246+
case ...(-2): // From last to first element
247+
-1
248+
case 2...: // From first to last element
249+
numberOfPages
250+
default:
251+
fromValue
247252
}
253+
addAnimation(correctedFromValue)
248254
}
249255
}
250256
}

LayoutKit/LayoutKit/UI/Blocks/TextInputBlock+UIViewRenderableBlock.swift

+22-4
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,12 @@ private final class TextInputBlockView: BlockView, VisibleBoundsTrackingLeaf {
9090
multiLineInput.isEditable = true
9191
multiLineInput.isSelectable = true
9292
multiLineInput.showsVerticalScrollIndicator = false
93-
multiLineInput.autocorrectionType = .no
9493
multiLineInput.backgroundColor = .clear
9594
multiLineInput.delegate = self
9695
multiLineInput.textContainer.lineFragmentPadding = 0
9796
multiLineInput.returnKeyType = .default
9897

9998
singleLineInput.isHidden = true
100-
singleLineInput.autocorrectionType = .no
10199
singleLineInput.backgroundColor = .clear
102100
singleLineInput.delegate = self
103101
singleLineInput.addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged)
@@ -185,15 +183,23 @@ private final class TextInputBlockView: BlockView, VisibleBoundsTrackingLeaf {
185183
multiLineInput.inputView = nil
186184
multiLineInput.tintColor = nil
187185
selectionItems = nil
188-
multiLineInput.keyboardType = type.uiType
189-
singleLineInput.keyboardType = type.uiType
186+
setKeyboardType(type)
190187
case let .selection(items):
191188
selectionItems = items
192189
multiLineInput.tintColor = multiLineInput.backgroundColor
193190
multiLineInput.inputView = selectionView
191+
setKeyboardType(.default)
194192
}
195193
}
196194

195+
private func setKeyboardType(_ type: TextInputBlock.InputType.KeyboardType) {
196+
multiLineInput.keyboardType = type.uiType
197+
singleLineInput.keyboardType = type.uiType
198+
199+
singleLineInput.autocorrectionType = type.autoCorrectionType
200+
multiLineInput.autocorrectionType = type.autoCorrectionType
201+
}
202+
197203
func setInputAccessoryView(_ accessoryView: ViewType?) {
198204
multiLineInput.inputAccessoryView = accessoryView
199205
singleLineInput.inputAccessoryView = accessoryView
@@ -793,6 +799,18 @@ extension TextInputBlock.InputType.KeyboardType {
793799
.asciiCapableNumberPad
794800
}
795801
}
802+
803+
fileprivate var autoCorrectionType: UITextAutocorrectionType {
804+
switch self {
805+
case .URL, .webSearch, .twitter, .emailAddress:
806+
return .no
807+
case .default:
808+
return .default
809+
case .asciiCapable, .numbersAndPunctuation, .numberPad, .phonePad,
810+
.namePhonePad, .decimalPad, .asciiCapableNumberPad:
811+
return .yes
812+
}
813+
}
796814
}
797815

798816
extension TextInputBlockView {

Specs/DivKit/31.6.0/DivKit.podspec

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'DivKit'
3+
s.version = '31.6.0'
4+
s.summary = 'DivKit framework'
5+
s.description = 'DivKit is a backend-driven UI framework'
6+
s.homepage = 'https://divkit.tech'
7+
8+
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
9+
s.author = { 'divkit' => '[email protected]' }
10+
s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s }
11+
12+
s.swift_version = '5.9'
13+
s.requires_arc = true
14+
s.prefix_header_file = false
15+
s.platforms = { :ios => '13.0' }
16+
17+
s.dependency 'DivKit_LayoutKit', s.version.to_s
18+
s.dependency 'DivKit_Serialization', s.version.to_s
19+
s.dependency 'VGSL', '~> 6.22'
20+
21+
s.source_files = [
22+
'DivKit/**/*'
23+
]
24+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'DivKitExtensions'
3+
s.version = '31.6.0'
4+
s.summary = 'DivKit framework extensions'
5+
s.description = 'Part of DivKit framework'
6+
s.homepage = 'https://divkit.tech'
7+
8+
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
9+
s.author = { 'divkit' => '[email protected]' }
10+
s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s }
11+
12+
s.swift_version = '5.9'
13+
s.requires_arc = true
14+
s.prefix_header_file = false
15+
s.platforms = { :ios => '13.0' }
16+
17+
s.dependency 'DivKit', s.version.to_s
18+
19+
s.source_files = [
20+
'DivKitExtensions/**/*'
21+
]
22+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'DivKit_LayoutKit'
3+
s.module_name = 'LayoutKit'
4+
s.version = '31.6.0'
5+
s.summary = 'Part of DivKit framework'
6+
s.description = 'Part of DivKit framework'
7+
s.homepage = 'https://divkit.tech'
8+
9+
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
10+
s.author = { 'divkit' => '[email protected]' }
11+
s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s }
12+
13+
s.swift_version = '5.9'
14+
s.requires_arc = true
15+
s.prefix_header_file = false
16+
s.platforms = { :ios => '13.0' }
17+
18+
s.dependency 'DivKit_LayoutKitInterface', s.version.to_s
19+
s.dependency 'VGSL', '~> 6.22'
20+
21+
s.source_files = [
22+
'LayoutKit/LayoutKit/**/*'
23+
]
24+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'DivKit_LayoutKitInterface'
3+
s.module_name = 'LayoutKitInterface'
4+
s.version = '31.6.0'
5+
s.summary = 'Part of DivKit framework'
6+
s.description = 'Part of DivKit framework'
7+
s.homepage = 'https://divkit.tech'
8+
9+
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
10+
s.author = { 'divkit' => '[email protected]' }
11+
s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s }
12+
13+
s.swift_version = '5.9'
14+
s.requires_arc = true
15+
s.prefix_header_file = false
16+
s.platforms = { :ios => '13.0' }
17+
18+
s.dependency 'VGSL', '~> 6.22'
19+
20+
s.source_files = [
21+
'LayoutKit/Interface/**/*'
22+
]
23+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'DivKit_Serialization'
3+
s.module_name = 'Serialization'
4+
s.version = '31.6.0'
5+
s.summary = 'Part of DivKit framework'
6+
s.description = 'Part of DivKit framework'
7+
s.homepage = 'https://divkit.tech'
8+
9+
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
10+
s.author = { 'divkit' => '[email protected]' }
11+
s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s }
12+
13+
s.swift_version = '5.9'
14+
s.requires_arc = true
15+
s.prefix_header_file = false
16+
s.platforms = { :ios => '13.0' }
17+
18+
s.dependency 'VGSL', '~> 6.22'
19+
20+
s.source_files = [
21+
'Serialization/**/*'
22+
]
23+
end

0 commit comments

Comments
 (0)