mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
Removed unused code from playground.
This commit is contained in:
@@ -56,7 +56,6 @@
|
||||
8C1A377C28B4E3E700A047C8 /* UIStatePayloadFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C1A377528B4E3E700A047C8 /* UIStatePayloadFactory.swift */; };
|
||||
8C1A377D28B4E3E700A047C8 /* JSONPayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C1A377628B4E3E700A047C8 /* JSONPayload.swift */; };
|
||||
8C1A378028B4E47900A047C8 /* WebPreviewSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C1A377F28B4E47900A047C8 /* WebPreviewSocket.swift */; };
|
||||
8C1A378828B5143200A047C8 /* VisibilityTrackingCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C1A378428B5143200A047C8 /* VisibilityTrackingCardView.swift */; };
|
||||
8C1A378928B5143200A047C8 /* VisibilityTrackingScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C1A378528B5143200A047C8 /* VisibilityTrackingScrollView.swift */; };
|
||||
8C1A378A28B5143200A047C8 /* DivViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C1A378628B5143200A047C8 /* DivViewController.swift */; };
|
||||
8C1A378B28B5143200A047C8 /* DivViewProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C1A378728B5143200A047C8 /* DivViewProvider.swift */; };
|
||||
@@ -294,7 +293,6 @@
|
||||
8C1A377528B4E3E700A047C8 /* UIStatePayloadFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIStatePayloadFactory.swift; sourceTree = "<group>"; };
|
||||
8C1A377628B4E3E700A047C8 /* JSONPayload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONPayload.swift; sourceTree = "<group>"; };
|
||||
8C1A377F28B4E47900A047C8 /* WebPreviewSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebPreviewSocket.swift; sourceTree = "<group>"; };
|
||||
8C1A378428B5143200A047C8 /* VisibilityTrackingCardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VisibilityTrackingCardView.swift; sourceTree = "<group>"; };
|
||||
8C1A378528B5143200A047C8 /* VisibilityTrackingScrollView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VisibilityTrackingScrollView.swift; sourceTree = "<group>"; };
|
||||
8C1A378628B5143200A047C8 /* DivViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DivViewController.swift; sourceTree = "<group>"; };
|
||||
8C1A378728B5143200A047C8 /* DivViewProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DivViewProvider.swift; sourceTree = "<group>"; };
|
||||
@@ -612,7 +610,6 @@
|
||||
8C1A378628B5143200A047C8 /* DivViewController.swift */,
|
||||
8C1A378728B5143200A047C8 /* DivViewProvider.swift */,
|
||||
8C1A382F28B61A0300A047C8 /* SimpleDivView.swift */,
|
||||
8C1A378428B5143200A047C8 /* VisibilityTrackingCardView.swift */,
|
||||
8C1A378528B5143200A047C8 /* VisibilityTrackingScrollView.swift */,
|
||||
);
|
||||
path = DivView;
|
||||
@@ -1465,7 +1462,6 @@
|
||||
8CB03C1F2A66A07300847A65 /* PlaygroundUrlHandler.swift in Sources */,
|
||||
8C1A378B28B5143200A047C8 /* DivViewProvider.swift in Sources */,
|
||||
8C7B18952864CA380036EF4C /* Alert.swift in Sources */,
|
||||
8C1A378828B5143200A047C8 /* VisibilityTrackingCardView.swift in Sources */,
|
||||
8C2BFA5428C10EA000A16E9B /* RegressionTestModel.swift in Sources */,
|
||||
8C440A042864C55400EF4175 /* DivKitPlaygroundApp.swift in Sources */,
|
||||
8C1A374928B4187B00A047C8 /* DeviceInfo.swift in Sources */,
|
||||
|
||||
@@ -24,19 +24,9 @@ open class DivViewController: UIViewController {
|
||||
private let blockProvider: DivBlockProvider
|
||||
private let divKitComponents: DivKitComponents
|
||||
private let disposePool = AutodisposePool()
|
||||
|
||||
private let cardView = VisibilityTrackingCardView()
|
||||
private let scrollView = VisibilityTrackingScrollView()
|
||||
|
||||
private var lastBounds = CGRect.zero
|
||||
|
||||
private var blockView: BlockView! {
|
||||
didSet {
|
||||
oldValue?.removeFromSuperview()
|
||||
scrollView.addSubview(blockView)
|
||||
}
|
||||
}
|
||||
|
||||
init(
|
||||
blockProvider: DivBlockProvider,
|
||||
divKitComponents: DivKitComponents
|
||||
@@ -54,7 +44,6 @@ open class DivViewController: UIViewController {
|
||||
|
||||
public override func loadView() {
|
||||
scrollView.backgroundColor = .white
|
||||
scrollView.cardView = cardView
|
||||
|
||||
blockProvider.parentScrollView = scrollView
|
||||
|
||||
@@ -86,11 +75,9 @@ open class DivViewController: UIViewController {
|
||||
super.viewWillLayoutSubviews()
|
||||
|
||||
let blockSize = blockProvider.block.size(forResizableBlockSize: view.bounds.size)
|
||||
cardView.frame = CGRect(origin: .zero, size: blockSize)
|
||||
scrollView.cardView?.frame = CGRect(origin: .zero, size: blockSize)
|
||||
scrollView.contentSize = blockSize
|
||||
|
||||
blockView.frame = cardView.bounds
|
||||
blockView.layoutIfNeeded()
|
||||
scrollView.cardView?.layoutIfNeeded()
|
||||
}
|
||||
|
||||
public override func viewDidLayoutSubviews() {
|
||||
@@ -108,7 +95,7 @@ open class DivViewController: UIViewController {
|
||||
private func updateBlockView(block: Block) {
|
||||
let elementStateObserver = self
|
||||
let renderingDelegate = divKitComponents.tooltipManager
|
||||
if let blockView = blockView, block.canConfigureBlockView(blockView) {
|
||||
if let blockView = scrollView.cardView, block.canConfigureBlockView(blockView) {
|
||||
block.configureBlockView(
|
||||
blockView,
|
||||
observer: elementStateObserver,
|
||||
@@ -116,11 +103,10 @@ open class DivViewController: UIViewController {
|
||||
renderingDelegate: renderingDelegate
|
||||
)
|
||||
} else {
|
||||
blockView = block.makeBlockView(
|
||||
scrollView.cardView = block.makeBlockView(
|
||||
observer: elementStateObserver,
|
||||
renderingDelegate: renderingDelegate
|
||||
)
|
||||
cardView.blockView = blockView
|
||||
}
|
||||
|
||||
view.setNeedsLayout()
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import UIKit
|
||||
|
||||
import CommonCorePublic
|
||||
|
||||
final class VisibilityTrackingCardView: UIView, VisibleBoundsTrackingContainer {
|
||||
var blockView: VisibleBoundsTrackingView? {
|
||||
didSet {
|
||||
oldValue?.removeFromSuperview()
|
||||
blockView.map { addSubview($0) }
|
||||
}
|
||||
}
|
||||
|
||||
var visibleBoundsTrackingSubviews: [VisibleBoundsTrackingView] { blockView.asArray() }
|
||||
}
|
||||
@@ -2,15 +2,18 @@ import UIKit
|
||||
|
||||
import BaseUIPublic
|
||||
import CommonCorePublic
|
||||
import LayoutKit
|
||||
|
||||
final class VisibilityTrackingScrollView: UIScrollView, VisibleBoundsTrackingContainer {
|
||||
typealias CardView = VisibleBoundsTrackingView & BlockViewProtocol
|
||||
|
||||
private var previousVisibleBounds = CGRect.zero
|
||||
private var currentVisibleBounds = CGRect.zero
|
||||
var visibleBoundsTrackingSubviews: [VisibleBoundsTrackingView] {
|
||||
cardView.asArray()
|
||||
}
|
||||
|
||||
var cardView: VisibilityTrackingCardView? {
|
||||
var cardView: CardView? {
|
||||
didSet {
|
||||
oldValue?.removeFromSuperview()
|
||||
cardView.map { addSubview($0) }
|
||||
|
||||
Reference in New Issue
Block a user