Skip to content

Commit

Permalink
Release 29.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robot-divkit committed Jan 15, 2024
1 parent e245d3c commit 57b3e7f
Show file tree
Hide file tree
Showing 151 changed files with 715 additions and 706 deletions.
6 changes: 6 additions & 0 deletions .mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"DivKit/Extensions/DivBase/DivBaseExtensions.swift":"divkit/public-ios/DivKit/Extensions/DivBase/DivBaseExtensions.swift",
"DivKit/Extensions/DivChangeTransitionExtensions.swift":"divkit/public-ios/DivKit/Extensions/DivChangeTransitionExtensions.swift",
"DivKit/Extensions/DivContainer/DivCollectionItemsBuilderExtensions.swift":"divkit/public-ios/DivKit/Extensions/DivContainer/DivCollectionItemsBuilderExtensions.swift",
"DivKit/Extensions/DivContainer/DivContainer+Accessibility.swift":"divkit/public-ios/DivKit/Extensions/DivContainer/DivContainer+Accessibility.swift",
"DivKit/Extensions/DivContainer/DivContainerExtensions.swift":"divkit/public-ios/DivKit/Extensions/DivContainer/DivContainerExtensions.swift",
"DivKit/Extensions/DivContainer/DivContainerItemsExtensions.swift":"divkit/public-ios/DivKit/Extensions/DivContainer/DivContainerItemsExtensions.swift",
"DivKit/Extensions/DivContainer/DivContainerSizeModifier.swift":"divkit/public-ios/DivKit/Extensions/DivContainer/DivContainerSizeModifier.swift",
Expand Down Expand Up @@ -842,6 +843,7 @@
"Specs/DivKit/29.0.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/29.0.0/DivKit.podspec",
"Specs/DivKit/29.0.1/DivKit.podspec":"divkit/public-ios/Specs/DivKit/29.0.1/DivKit.podspec",
"Specs/DivKit/29.1.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/29.1.0/DivKit.podspec",
"Specs/DivKit/29.2.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/29.2.0/DivKit.podspec",
"Specs/DivKitExtensions/24.3.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/24.3.0/DivKitExtensions.podspec",
"Specs/DivKitExtensions/25.0.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/25.0.0/DivKitExtensions.podspec",
"Specs/DivKitExtensions/25.1.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/25.1.0/DivKitExtensions.podspec",
Expand Down Expand Up @@ -877,6 +879,7 @@
"Specs/DivKitExtensions/29.0.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/29.0.0/DivKitExtensions.podspec",
"Specs/DivKitExtensions/29.0.1/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/29.0.1/DivKitExtensions.podspec",
"Specs/DivKitExtensions/29.1.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/29.1.0/DivKitExtensions.podspec",
"Specs/DivKitExtensions/29.2.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/29.2.0/DivKitExtensions.podspec",
"Specs/DivKit_LayoutKit/28.0.1/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/28.0.1/DivKit_LayoutKit.podspec",
"Specs/DivKit_LayoutKit/28.1.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/28.1.0/DivKit_LayoutKit.podspec",
"Specs/DivKit_LayoutKit/28.10.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/28.10.0/DivKit_LayoutKit.podspec",
Expand All @@ -894,6 +897,7 @@
"Specs/DivKit_LayoutKit/29.0.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/29.0.0/DivKit_LayoutKit.podspec",
"Specs/DivKit_LayoutKit/29.0.1/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/29.0.1/DivKit_LayoutKit.podspec",
"Specs/DivKit_LayoutKit/29.1.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/29.1.0/DivKit_LayoutKit.podspec",
"Specs/DivKit_LayoutKit/29.2.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/29.2.0/DivKit_LayoutKit.podspec",
"Specs/DivKit_LayoutKitInterface/28.0.1/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/28.0.1/DivKit_LayoutKitInterface.podspec",
"Specs/DivKit_LayoutKitInterface/28.1.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/28.1.0/DivKit_LayoutKitInterface.podspec",
"Specs/DivKit_LayoutKitInterface/28.10.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/28.10.0/DivKit_LayoutKitInterface.podspec",
Expand All @@ -911,6 +915,7 @@
"Specs/DivKit_LayoutKitInterface/29.0.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/29.0.0/DivKit_LayoutKitInterface.podspec",
"Specs/DivKit_LayoutKitInterface/29.0.1/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/29.0.1/DivKit_LayoutKitInterface.podspec",
"Specs/DivKit_LayoutKitInterface/29.1.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/29.1.0/DivKit_LayoutKitInterface.podspec",
"Specs/DivKit_LayoutKitInterface/29.2.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/29.2.0/DivKit_LayoutKitInterface.podspec",
"Specs/DivKit_Serialization/28.0.1/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/28.0.1/DivKit_Serialization.podspec",
"Specs/DivKit_Serialization/28.1.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/28.1.0/DivKit_Serialization.podspec",
"Specs/DivKit_Serialization/28.10.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/28.10.0/DivKit_Serialization.podspec",
Expand All @@ -928,6 +933,7 @@
"Specs/DivKit_Serialization/29.0.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/29.0.0/DivKit_Serialization.podspec",
"Specs/DivKit_Serialization/29.0.1/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/29.0.1/DivKit_Serialization.podspec",
"Specs/DivKit_Serialization/29.1.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/29.1.0/DivKit_Serialization.podspec",
"Specs/DivKit_Serialization/29.2.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/29.2.0/DivKit_Serialization.podspec",
"Specs/LayoutKit/24.3.0/LayoutKit.podspec":"divkit/public-ios/Specs/LayoutKit/24.3.0/LayoutKit.podspec",
"Specs/LayoutKit/25.0.0/LayoutKit.podspec":"divkit/public-ios/Specs/LayoutKit/25.0.0/LayoutKit.podspec",
"Specs/LayoutKit/25.1.0/LayoutKit.podspec":"divkit/public-ios/Specs/LayoutKit/25.1.0/LayoutKit.podspec",
Expand Down
10 changes: 6 additions & 4 deletions DivKit/Actions/CopyToClipboardActionHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ import UIKit
#endif

final class CopyToClipboardActionHandler {
func handle(_ action: DivActionCopyToClipboard) {
func handle(
_ action: DivActionCopyToClipboard,
context: DivActionHandlingContext
) {
#if os(iOS)
let pasteboard = UIPasteboard.general

switch action.content {
case let .contentText(text):
if let text = text.value.rawValue {
if let text = text.resolveValue(context.expressionResolver) {
pasteboard.string = text
}
case let .contentUrl(url):
if let url = url.value.rawValue {
if let url = url.resolveValue(context.expressionResolver) {
pasteboard.url = url
}
}
Expand Down
6 changes: 3 additions & 3 deletions DivKit/Actions/DivActionHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public final class DivActionHandler {
default:
action = parseAction(type: DivActionTemplate.self, json: params.action)
}
guard let action = action else {
guard let action else {
return
}

Expand Down Expand Up @@ -129,7 +129,7 @@ public final class DivActionHandler {
case let .divActionArrayRemoveValue(action):
arrayRemoveValueActionHandler.handle(action, context: context)
case let .divActionCopyToClipboard(action):
copyToClipboardActionHandler.handle(action)
copyToClipboardActionHandler.handle(action, context: context)
case .none:
isHandled = false
default:
Expand Down Expand Up @@ -170,7 +170,7 @@ public final class DivActionHandler {
url,
cardId: context.cardId,
completion: { [weak self] result in
guard let self = self else {
guard let self else {
return
}
let callbackActions: [DivAction]
Expand Down
4 changes: 2 additions & 2 deletions DivKit/Actions/DivActionLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public struct DefaultDivActionLogger: DivActionLogger {

public func log(url: URL, referer: URL?, payload: [String: Any]?) {
var request = URLRequest(url: url)
if let referer = referer {
if let referer {
request.setValue(referer.absoluteString, forHTTPHeaderField: "referer")
}

if let payload = payload {
if let payload {
let json: JSONObject = .object(payload.typedJSON())
guard let body = try? json.toJSONString().data(using: .utf8) else {
assertionFailure("Can't serialize JSON payload")
Expand Down
2 changes: 1 addition & 1 deletion DivKit/Debug/Block+DebugInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension Block {
child: indicator,
showDebugInfo: {
#if os(iOS)
debugParams.showDebugInfo(ErrorListView(errors: errors.map { $0.prettyMessage }))
debugParams.showDebugInfo(ErrorListView(errors: errors.map(\.prettyMessage)))
#else
return
#endif
Expand Down
13 changes: 0 additions & 13 deletions DivKit/DivBlockModelingContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public struct DivBlockModelingContext {
let debugParams: DebugParams
let scheduler: Scheduling
let playerFactory: PlayerFactory?
private(set) var childrenA11yDescription: String?
private(set) weak var parentScrollView: ScrollView?
public private(set) var errorsStorage: DivErrorsStorage
private let persistentValuesStorage: DivPersistentValuesStorage
Expand Down Expand Up @@ -64,7 +63,6 @@ public struct DivBlockModelingContext {
playerFactory: PlayerFactory? = nil,
debugParams: DebugParams = DebugParams(),
scheduler: Scheduling? = nil,
childrenA11yDescription: String? = nil,
parentScrollView: ScrollView? = nil,
errorsStorage: DivErrorsStorage? = nil,
layoutDirection: UserInterfaceLayoutDirection = .leftToRight,
Expand Down Expand Up @@ -113,7 +111,6 @@ public struct DivBlockModelingContext {
playerFactory: playerFactory,
debugParams: debugParams,
scheduler: scheduler,
childrenA11yDescription: childrenA11yDescription,
parentScrollView: parentScrollView,
errorsStorage: errorsStorage,
layoutDirection: layoutDirection,
Expand Down Expand Up @@ -143,7 +140,6 @@ public struct DivBlockModelingContext {
playerFactory: PlayerFactory?,
debugParams: DebugParams,
scheduler: Scheduling?,
childrenA11yDescription: String?,
parentScrollView: ScrollView?,
errorsStorage: DivErrorsStorage?,
layoutDirection: UserInterfaceLayoutDirection,
Expand All @@ -168,7 +164,6 @@ public struct DivBlockModelingContext {
self.playerFactory = playerFactory
self.debugParams = debugParams
self.scheduler = scheduler ?? TimerScheduler()
self.childrenA11yDescription = childrenA11yDescription
self.parentScrollView = parentScrollView
self.errorsStorage = errorsStorage ?? DivErrorsStorage(errors: [])
self.layoutDirection = layoutDirection
Expand Down Expand Up @@ -314,14 +309,6 @@ extension DivBlockModelingContext {

return context
}

func modifying(
childrenA11yDescription: String?
) -> Self {
modified(self) {
$0.childrenA11yDescription = childrenA11yDescription
}
}
}

private func makeExpressionResolver(
Expand Down
2 changes: 1 addition & 1 deletion DivKit/DivError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extension DivError {
"[\(path)]: \(message)" + (
causes.isEmpty
? ""
: " caused by \(rootCauses.map { $0.description }.joined(separator: "; "))"
: " caused by \(rootCauses.map(\.description).joined(separator: "; "))"
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion DivKit/DivImageHolderFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class DefaultImageHolderFactory: DivImageHolderFactory {
}

func make(_ url: URL?, _ placeholder: ImagePlaceholder?) -> ImageHolder {
guard let url = url else {
guard let url else {
return placeholder?.toImageHolder() ?? NilImageHolder()
}
return RemoteImageHolder(
Expand Down
4 changes: 0 additions & 4 deletions DivKit/DivKitComponents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,6 @@ public final class DivKitComponents {
timerStorage.set(cardId: cardId, timers: divData.timers ?? [])
}

public func flushUpdateActions() {
updateAggregator.flushUpdateActions()
}

private func onVariablesChanged(event: DivVariablesStorage.ChangeEvent) {
switch event.kind {
case let .global(variables):
Expand Down
2 changes: 1 addition & 1 deletion DivKit/DivKitInfo.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
public enum DivKitInfo {
public static let version = "29.1.0"
public static let version = "29.2.0"
}
4 changes: 2 additions & 2 deletions DivKit/DivStatePath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ extension Tagged where Tag == DivDataStateIDTag, RawValue == Int {
}
}

extension Optional where Wrapped == DivStatePath {
extension DivStatePath? {
public static func +(parent: Self, child: String) -> DivStatePath {
if let parent = parent {
if let parent {
return parent + DivStateID(rawValue: child)
} else {
return DivStatePath(rawValue: UIElementPath(child))
Expand Down
2 changes: 1 addition & 1 deletion DivKit/Expressions/CalcExpression/AnyCalcExpression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ extension AnyCalcExpression {
default:
return args[0]
}
}
},
]
}

Expand Down
8 changes: 4 additions & 4 deletions DivKit/Expressions/CalcExpression/CalcExpression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ extension CalcExpression {
":": -8, // ternary
].mapValues { ($0, false) }
precedences["?"] = (-7, true) // ternary
for op in [ "<", "<=", ">=", ">", "==", "!=" ] { // comparison
for op in ["<", "<=", ">=", ">", "==", "!="] { // comparison
precedences[op] = (-4, true)
}
return precedences
Expand Down Expand Up @@ -411,7 +411,7 @@ struct ParsedCalcExpression: CustomStringConvertible {
guard case .variable = $0 else { return false }
return true
}
.map { $0.name }
.map(\.name)
}
}

Expand Down Expand Up @@ -442,7 +442,7 @@ private enum Subexpression: CustomStringConvertible {
case let .literal(literal):
return literal
case let .symbol(symbol, args, fn):
guard let fn = fn else {
guard let fn else {
return .error(CalcExpression.Error.undefinedSymbol(symbol))
}
do {
Expand All @@ -457,7 +457,7 @@ private enum Subexpression: CustomStringConvertible {

var description: String {
func arguments(_ args: [Subexpression]) -> String {
args.map { $0.description }
args.map(\.description)
.joined(separator: ", ")
}
switch self {
Expand Down
18 changes: 9 additions & 9 deletions DivKit/Expressions/CalcExpression/CalcExpressionError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ extension CalcExpression {
enum Error: Swift.Error, CustomStringConvertible, Equatable {
/// An application-specific error
case message(String)

/// An application-specific error without information about failed expression
case shortMessage(String)

/// The parser encountered a sequence of characters it didn't recognize
case unexpectedToken(String)

/// The parser expected to find a delimiter (e.g. closing paren) but didn't
case missingDelimiter(String)

/// The specified constant, operator or function was not recognized
case undefinedSymbol(Symbol)

/// A function was called with the wrong number of arguments (arity)
case arityMismatch(Symbol)

case escaping

var description: String {
switch self {
case let .message(message),
let .shortMessage(message):
let .shortMessage(message):
return message
case let .unexpectedToken(string):
return "Unexpected token: \(string)"
Expand Down Expand Up @@ -57,7 +57,7 @@ extension CalcExpression {
return "Incorrect string escape"
}
}

func makeOutputMessage(for expression: String) -> String {
switch self {
case let .shortMessage(message):
Expand Down
9 changes: 0 additions & 9 deletions DivKit/Expressions/Expression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ import Foundation
public enum Expression<T> {
case value(T)
case link(ExpressionLink<T>)

public var rawValue: T? {
switch self {
case let .value(value):
return value
case .link:
return nil
}
}
}

extension Expression: Equatable where T: Equatable {
Expand Down
2 changes: 1 addition & 1 deletion DivKit/Expressions/ExpressionError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public struct ExpressionError: Error {

extension ExpressionError: CustomStringConvertible {
public var description: String {
if let expression = expression {
if let expression {
return "\(message). Expression: \(expression)"
}
return message
Expand Down
7 changes: 3 additions & 4 deletions DivKit/Expressions/ExpressionLink.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

import CommonCorePublic
import Serialization

public struct ExpressionLink<T> {
enum Item {
Expand All @@ -12,13 +13,12 @@ public struct ExpressionLink<T> {
let items: [Item]
let variablesNames: [String]
let rawValue: String
let validator: ExpressionValueValidator<T>?
let errorTracker: ExpressionErrorTracker?
let validator: AnyValueValidator<T>?

@usableFromInline
init?(
rawValue: String,
validator: ExpressionValueValidator<T>? = nil,
validator: AnyValueValidator<T>? = nil,
errorTracker: ExpressionErrorTracker? = nil,
resolveNested: Bool = true
) throws {
Expand Down Expand Up @@ -76,7 +76,6 @@ public struct ExpressionLink<T> {
self.variablesNames = variablesNames
self.rawValue = rawValue
self.validator = validator
self.errorTracker = errorTracker
}
}

Expand Down
Loading

0 comments on commit 57b3e7f

Please sign in to comment.