From 8e5f7007f898ee699ce64acee0e1109813cc7998 Mon Sep 17 00:00:00 2001 From: robot-divkit Date: Mon, 25 Nov 2024 19:27:27 +0300 Subject: [PATCH] Release 30.28.0 commit_hash:ca3a1af8da93357f37c2e9cc851385359816f32a --- .mapping.json | 5 ++++ DivKit/DivKitInfo.swift | 2 +- DivKit/Expressions/FunctionsProvider.swift | 18 ++++++------- DivKit/Form/DivNetworkSubmitter.swift | 3 +++ .../LayoutKit/Tooltips/TooltipManager.swift | 25 +++++++++++++------ ...TextInputBlock+UIViewRenderableBlock.swift | 5 +++- Specs/DivKit/30.28.0/DivKit.podspec | 24 ++++++++++++++++++ .../30.28.0/DivKitExtensions.podspec | 22 ++++++++++++++++ .../30.28.0/DivKit_LayoutKit.podspec | 24 ++++++++++++++++++ .../30.28.0/DivKit_LayoutKitInterface.podspec | 23 +++++++++++++++++ .../30.28.0/DivKit_Serialization.podspec | 23 +++++++++++++++++ 11 files changed, 155 insertions(+), 19 deletions(-) create mode 100644 Specs/DivKit/30.28.0/DivKit.podspec create mode 100644 Specs/DivKitExtensions/30.28.0/DivKitExtensions.podspec create mode 100644 Specs/DivKit_LayoutKit/30.28.0/DivKit_LayoutKit.podspec create mode 100644 Specs/DivKit_LayoutKitInterface/30.28.0/DivKit_LayoutKitInterface.podspec create mode 100644 Specs/DivKit_Serialization/30.28.0/DivKit_Serialization.podspec diff --git a/.mapping.json b/.mapping.json index 0725786c..0b05d729 100644 --- a/.mapping.json +++ b/.mapping.json @@ -992,6 +992,7 @@ "Specs/DivKit/30.25.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.25.0/DivKit.podspec", "Specs/DivKit/30.26.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.26.0/DivKit.podspec", "Specs/DivKit/30.27.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.27.0/DivKit.podspec", + "Specs/DivKit/30.28.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.28.0/DivKit.podspec", "Specs/DivKit/30.3.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.3.0/DivKit.podspec", "Specs/DivKit/30.4.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.4.0/DivKit.podspec", "Specs/DivKit/30.5.0/DivKit.podspec":"divkit/public-ios/Specs/DivKit/30.5.0/DivKit.podspec", @@ -1071,6 +1072,7 @@ "Specs/DivKitExtensions/30.25.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.25.0/DivKitExtensions.podspec", "Specs/DivKitExtensions/30.26.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.26.0/DivKitExtensions.podspec", "Specs/DivKitExtensions/30.27.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.27.0/DivKitExtensions.podspec", + "Specs/DivKitExtensions/30.28.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.28.0/DivKitExtensions.podspec", "Specs/DivKitExtensions/30.3.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.3.0/DivKitExtensions.podspec", "Specs/DivKitExtensions/30.4.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.4.0/DivKitExtensions.podspec", "Specs/DivKitExtensions/30.5.0/DivKitExtensions.podspec":"divkit/public-ios/Specs/DivKitExtensions/30.5.0/DivKitExtensions.podspec", @@ -1132,6 +1134,7 @@ "Specs/DivKit_LayoutKit/30.25.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.25.0/DivKit_LayoutKit.podspec", "Specs/DivKit_LayoutKit/30.26.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.26.0/DivKit_LayoutKit.podspec", "Specs/DivKit_LayoutKit/30.27.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.27.0/DivKit_LayoutKit.podspec", + "Specs/DivKit_LayoutKit/30.28.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.28.0/DivKit_LayoutKit.podspec", "Specs/DivKit_LayoutKit/30.3.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.3.0/DivKit_LayoutKit.podspec", "Specs/DivKit_LayoutKit/30.4.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.4.0/DivKit_LayoutKit.podspec", "Specs/DivKit_LayoutKit/30.5.0/DivKit_LayoutKit.podspec":"divkit/public-ios/Specs/DivKit_LayoutKit/30.5.0/DivKit_LayoutKit.podspec", @@ -1193,6 +1196,7 @@ "Specs/DivKit_LayoutKitInterface/30.25.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.25.0/DivKit_LayoutKitInterface.podspec", "Specs/DivKit_LayoutKitInterface/30.26.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.26.0/DivKit_LayoutKitInterface.podspec", "Specs/DivKit_LayoutKitInterface/30.27.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.27.0/DivKit_LayoutKitInterface.podspec", + "Specs/DivKit_LayoutKitInterface/30.28.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.28.0/DivKit_LayoutKitInterface.podspec", "Specs/DivKit_LayoutKitInterface/30.3.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.3.0/DivKit_LayoutKitInterface.podspec", "Specs/DivKit_LayoutKitInterface/30.4.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.4.0/DivKit_LayoutKitInterface.podspec", "Specs/DivKit_LayoutKitInterface/30.5.0/DivKit_LayoutKitInterface.podspec":"divkit/public-ios/Specs/DivKit_LayoutKitInterface/30.5.0/DivKit_LayoutKitInterface.podspec", @@ -1254,6 +1258,7 @@ "Specs/DivKit_Serialization/30.25.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.25.0/DivKit_Serialization.podspec", "Specs/DivKit_Serialization/30.26.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.26.0/DivKit_Serialization.podspec", "Specs/DivKit_Serialization/30.27.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.27.0/DivKit_Serialization.podspec", + "Specs/DivKit_Serialization/30.28.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.28.0/DivKit_Serialization.podspec", "Specs/DivKit_Serialization/30.3.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.3.0/DivKit_Serialization.podspec", "Specs/DivKit_Serialization/30.4.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.4.0/DivKit_Serialization.podspec", "Specs/DivKit_Serialization/30.5.0/DivKit_Serialization.podspec":"divkit/public-ios/Specs/DivKit_Serialization/30.5.0/DivKit_Serialization.podspec", diff --git a/DivKit/DivKitInfo.swift b/DivKit/DivKitInfo.swift index 75736228..fd4d5a11 100644 --- a/DivKit/DivKitInfo.swift +++ b/DivKit/DivKitInfo.swift @@ -1,3 +1,3 @@ public enum DivKitInfo { - public static let version = "30.27.0" + public static let version = "30.28.0" } diff --git a/DivKit/Expressions/FunctionsProvider.swift b/DivKit/Expressions/FunctionsProvider.swift index 165f58bb..7bf9c581 100644 --- a/DivKit/Expressions/FunctionsProvider.swift +++ b/DivKit/Expressions/FunctionsProvider.swift @@ -12,6 +12,14 @@ final class FunctionsProvider { self.persistentValuesStorage = persistentValuesStorage } + static let methods: [String: Function] = { + var methods: [String: Function] = [:] + methods.addArrayMethods() + methods.addDictMethods() + methods.addToStringFunctions() + return methods + }() + lazy var functions: [String: Function] = lock.withLock { var functions = staticFunctions @@ -50,7 +58,7 @@ final class FunctionsProvider { ) ) case let .method(name): - return FunctionEvaluator(symbol, functions: methods) + return FunctionEvaluator(symbol, functions: FunctionsProvider.methods) case .postfix: return nil } @@ -168,14 +176,6 @@ private let operators: [CalcExpression.Symbol: Function] = { return operators }() -private let methods: [String: Function] = { - var methods: [String: Function] = [:] - methods.addArrayMethods() - methods.addDictMethods() - methods.addToStringFunctions() - return methods -}() - extension [String: Function] { mutating func addFunction(_ name: String, _ function: Function) { var functions: [SimpleFunction] = [] diff --git a/DivKit/Form/DivNetworkSubmitter.swift b/DivKit/Form/DivNetworkSubmitter.swift index 12a2a852..518bd20d 100644 --- a/DivKit/Form/DivNetworkSubmitter.swift +++ b/DivKit/Form/DivNetworkSubmitter.swift @@ -21,6 +21,9 @@ final public class DivNetworkSubmitter: DivSubmitter { urlRequest.setValue(header.value, forHTTPHeaderField: header.key) } urlRequest.httpMethod = request.method + if let body = try? JSONSerialization.data(withJSONObject: data) { + urlRequest.httpBody = body + } var task: NetworkTask? task = requestPerformer.performRequest(urlRequest) { [weak self] in diff --git a/LayoutKit/LayoutKit/Tooltips/TooltipManager.swift b/LayoutKit/LayoutKit/Tooltips/TooltipManager.swift index 0a000674..2aba0bec 100644 --- a/LayoutKit/LayoutKit/Tooltips/TooltipManager.swift +++ b/LayoutKit/LayoutKit/Tooltips/TooltipManager.swift @@ -74,7 +74,7 @@ public class DefaultTooltipManager: TooltipManager { private var handleAction: (UIActionEvent) -> Void private var existingAnchorViews = WeakCollection() private var showingTooltips = [String: TooltipContainerView]() - private var tooltipWindow: UIWindow? + private(set) var tooltipWindow: UIWindow? private var previousOrientation = UIDevice.current.orientation public init( @@ -99,7 +99,7 @@ public class DefaultTooltipManager: TooltipManager { let windowBounds = tooltipWindow.bounds.inset(by: tooltipWindow.safeAreaInsets) guard !showingTooltips.keys.contains(info.id), - let tooltip = existingAnchorViews.compactMap({ + let tooltip = existingAnchorViews.compactMap({ $0?.makeTooltip(id: info.id, in: windowBounds) }).first else { return } @@ -115,7 +115,8 @@ public class DefaultTooltipManager: TooltipManager { ) // Passing the statusBarStyle control to `rootViewController` of the main window let vc = ProxyViewController( - viewController: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController() + viewController: UIApplication.shared.delegate?.window?? + .rootViewController ?? UIViewController() ) vc.view = view // Window won't rotate if `rootViewController` is not set @@ -159,7 +160,7 @@ public class DefaultTooltipManager: TooltipManager { ) } - @objc func orientationDidChange(_ notification: Notification) { + @objc func orientationDidChange(_: Notification) { let orientation = UIDevice.current.orientation guard orientation != previousOrientation, !orientation.isFlat else { return } if !(orientation.isPortrait && previousOrientation.isPortrait) { @@ -181,18 +182,25 @@ public class DefaultTooltipManager: TooltipManager { } extension TooltipAnchorView { - fileprivate func makeTooltip(id: String, in constraint: CGRect) -> DefaultTooltipManager.Tooltip? { + fileprivate func makeTooltip( + id: String, + in constraint: CGRect + ) -> DefaultTooltipManager.Tooltip? { tooltips .first { $0.id == id } .flatMap { let tooltip = $0 + let targetRect = window != nil ? + convert(bounds, to: nil) : + frame + return DefaultTooltipManager.Tooltip( id: tooltip.id, duration: tooltip.duration, view: { let tooltipView = tooltip.tooltipViewFactory?.value ?? tooltip.block.makeBlockView() tooltipView.frame = tooltip.calculateFrame( - targeting: convert(bounds, to: nil), + targeting: targetRect, constrainedBy: constraint ) return tooltipView @@ -210,10 +218,11 @@ private final class ProxyViewController: UIViewController { super.init(nibName: nil, bundle: nil) } - required init?(coder: NSCoder) { + @available(*, unavailable) + required init?(coder _: NSCoder) { fatalError("init(coder:) has not been implemented") } - + override var preferredStatusBarStyle: UIStatusBarStyle { viewController.preferredStatusBarStyle } diff --git a/LayoutKit/LayoutKit/UI/Blocks/TextInputBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/TextInputBlock+UIViewRenderableBlock.swift index 42736bbd..f5b702bd 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/TextInputBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/TextInputBlock+UIViewRenderableBlock.swift @@ -359,7 +359,10 @@ private final class TextInputBlockView: BlockView, VisibleBoundsTrackingLeaf { guard let typo else { return } let attributedText = text.with(typo: typo) multiLineInput.attributedText = attributedText - singleLineInput.attributedText = attributedText + if let selectedRange = singleLineInput.selectedTextRange { + singleLineInput.attributedText = attributedText + singleLineInput.selectedTextRange = selectedRange + } multiLineInput.typingAttributes = typo.attributes singleLineInput.defaultTextAttributes = typo.attributes } diff --git a/Specs/DivKit/30.28.0/DivKit.podspec b/Specs/DivKit/30.28.0/DivKit.podspec new file mode 100644 index 00000000..f7907a57 --- /dev/null +++ b/Specs/DivKit/30.28.0/DivKit.podspec @@ -0,0 +1,24 @@ +Pod::Spec.new do |s| + s.name = 'DivKit' + s.version = '30.28.0' + s.summary = 'DivKit framework' + s.description = 'DivKit is a backend-driven UI framework' + s.homepage = 'https://divkit.tech' + + s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' } + s.author = { 'divkit' => 'divkit@yandex-team.ru' } + s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s } + + s.swift_version = '5.9' + s.requires_arc = true + s.prefix_header_file = false + s.platforms = { :ios => '13.0' } + + s.dependency 'DivKit_LayoutKit', s.version.to_s + s.dependency 'DivKit_Serialization', s.version.to_s + s.dependency 'VGSL', '~> 6.0' + + s.source_files = [ + 'DivKit/**/*' + ] +end diff --git a/Specs/DivKitExtensions/30.28.0/DivKitExtensions.podspec b/Specs/DivKitExtensions/30.28.0/DivKitExtensions.podspec new file mode 100644 index 00000000..96b93e0e --- /dev/null +++ b/Specs/DivKitExtensions/30.28.0/DivKitExtensions.podspec @@ -0,0 +1,22 @@ +Pod::Spec.new do |s| + s.name = 'DivKitExtensions' + s.version = '30.28.0' + s.summary = 'DivKit framework extensions' + s.description = 'Part of DivKit framework' + s.homepage = 'https://divkit.tech' + + s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' } + s.author = { 'divkit' => 'divkit@yandex-team.ru' } + s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s } + + s.swift_version = '5.9' + s.requires_arc = true + s.prefix_header_file = false + s.platforms = { :ios => '13.0' } + + s.dependency 'DivKit', s.version.to_s + + s.source_files = [ + 'DivKitExtensions/**/*' + ] +end diff --git a/Specs/DivKit_LayoutKit/30.28.0/DivKit_LayoutKit.podspec b/Specs/DivKit_LayoutKit/30.28.0/DivKit_LayoutKit.podspec new file mode 100644 index 00000000..803f3a88 --- /dev/null +++ b/Specs/DivKit_LayoutKit/30.28.0/DivKit_LayoutKit.podspec @@ -0,0 +1,24 @@ +Pod::Spec.new do |s| + s.name = 'DivKit_LayoutKit' + s.module_name = 'LayoutKit' + s.version = '30.28.0' + s.summary = 'Part of DivKit framework' + s.description = 'Part of DivKit framework' + s.homepage = 'https://divkit.tech' + + s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' } + s.author = { 'divkit' => 'divkit@yandex-team.ru' } + s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s } + + s.swift_version = '5.9' + s.requires_arc = true + s.prefix_header_file = false + s.platforms = { :ios => '13.0' } + + s.dependency 'DivKit_LayoutKitInterface', s.version.to_s + s.dependency 'VGSL', '~> 6.0' + + s.source_files = [ + 'LayoutKit/LayoutKit/**/*' + ] +end diff --git a/Specs/DivKit_LayoutKitInterface/30.28.0/DivKit_LayoutKitInterface.podspec b/Specs/DivKit_LayoutKitInterface/30.28.0/DivKit_LayoutKitInterface.podspec new file mode 100644 index 00000000..35fd656f --- /dev/null +++ b/Specs/DivKit_LayoutKitInterface/30.28.0/DivKit_LayoutKitInterface.podspec @@ -0,0 +1,23 @@ +Pod::Spec.new do |s| + s.name = 'DivKit_LayoutKitInterface' + s.module_name = 'LayoutKitInterface' + s.version = '30.28.0' + s.summary = 'Part of DivKit framework' + s.description = 'Part of DivKit framework' + s.homepage = 'https://divkit.tech' + + s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' } + s.author = { 'divkit' => 'divkit@yandex-team.ru' } + s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s } + + s.swift_version = '5.9' + s.requires_arc = true + s.prefix_header_file = false + s.platforms = { :ios => '13.0' } + + s.dependency 'VGSL', '~> 6.0' + + s.source_files = [ + 'LayoutKit/Interface/**/*' + ] +end diff --git a/Specs/DivKit_Serialization/30.28.0/DivKit_Serialization.podspec b/Specs/DivKit_Serialization/30.28.0/DivKit_Serialization.podspec new file mode 100644 index 00000000..fb83e47f --- /dev/null +++ b/Specs/DivKit_Serialization/30.28.0/DivKit_Serialization.podspec @@ -0,0 +1,23 @@ +Pod::Spec.new do |s| + s.name = 'DivKit_Serialization' + s.module_name = 'Serialization' + s.version = '30.28.0' + s.summary = 'Part of DivKit framework' + s.description = 'Part of DivKit framework' + s.homepage = 'https://divkit.tech' + + s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' } + s.author = { 'divkit' => 'divkit@yandex-team.ru' } + s.source = { :git => 'https://github.com/divkit/divkit-ios.git', :tag => s.version.to_s } + + s.swift_version = '5.9' + s.requires_arc = true + s.prefix_header_file = false + s.platforms = { :ios => '13.0' } + + s.dependency 'VGSL', '~> 6.0' + + s.source_files = [ + 'Serialization/**/*' + ] +end