diff --git a/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift b/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift index 9bcb72df..2647077e 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/FallingUserCollectionViewCell.swift @@ -21,11 +21,14 @@ final class FallingUserCollectionViewCell: UserCardViewCollectionViewCell { lazy var cardTimeView = CardTimeView() + private lazy var pauseView = PauseView(frame: cellFrame) + override func makeUI() { self.layer.cornerRadius = 20 self.contentView.addSubview(profileCarouselView) self.profileCarouselView.addSubview(cardTimeView) + self.profileCarouselView.addSubview(pauseView) self.profileCarouselView.snp.makeConstraints { $0.edges.equalToSuperview() @@ -36,6 +39,10 @@ final class FallingUserCollectionViewCell: UserCardViewCollectionViewCell { $0.height.equalTo(32) } + self.pauseView.snp.makeConstraints { + $0.edges.equalToSuperview() + } + self.showDimView() } @@ -75,13 +82,7 @@ final class FallingUserCollectionViewCell: UserCardViewCollectionViewCell { .disposed(by: disposeBag) output.isTimerActive - .drive(with: self) { owner, value in - if value { - owner.hiddenPauseView() - } else { - owner.showPauseView() - } - } + .drive(pauseView.rx.isHidden) .disposed(by: disposeBag) profileCarouselView.infoButton.rx.tap.asDriver() diff --git a/Projects/Features/Falling/Src/Subviews/Cell/UserCardViewCollectionViewCell.swift b/Projects/Features/Falling/Src/Subviews/Cell/UserCardViewCollectionViewCell.swift index 9fdeeded..bd65e747 100644 --- a/Projects/Features/Falling/Src/Subviews/Cell/UserCardViewCollectionViewCell.swift +++ b/Projects/Features/Falling/Src/Subviews/Cell/UserCardViewCollectionViewCell.swift @@ -10,7 +10,7 @@ import UIKit import DSKit open class UserCardViewCollectionViewCell: TFBaseCollectionViewCell { - private let cellFrame = CGRect( + let cellFrame = CGRect( x: 0, y: 0, width: (UIWindow.keyWindow?.bounds.width ?? .zero) - 32, @@ -19,8 +19,6 @@ open class UserCardViewCollectionViewCell: TFBaseCollectionViewCell { private lazy var dimView = UIView(frame: cellFrame) - private lazy var pauseView = PauseView(frame: cellFrame) - public func showDimView() { DispatchQueue.main.async { [weak self] in guard let self = self else { return } @@ -42,26 +40,4 @@ open class UserCardViewCollectionViewCell: TFBaseCollectionViewCell { } } } - - public func showPauseView() { - DispatchQueue.main.async { [weak self] in - guard let self = self else { return } - self.addSubview(pauseView) - UIView.animate(withDuration: 0.0) { - self.pauseView.backgroundColor = DSKitAsset.Color.blur.color - } - } - } - - public func hiddenPauseView() { - DispatchQueue.main.async { [weak self] in - guard let self = self else { return } - UIView.animate(withDuration: 0.0) { - self.pauseView.backgroundColor = DSKitAsset.Color.clear.color - } completion: { [weak self] _ in - guard let self = self else { return } - self.pauseView.removeFromSuperview() - } - } - } } diff --git a/Projects/Features/Falling/Src/Subviews/PauseView.swift b/Projects/Features/Falling/Src/Subviews/PauseView.swift index 8e16bd80..cabb03a7 100644 --- a/Projects/Features/Falling/Src/Subviews/PauseView.swift +++ b/Projects/Features/Falling/Src/Subviews/PauseView.swift @@ -73,6 +73,8 @@ open class PauseView: TFBaseView { }() open override func makeUI() { + self.isHidden = true + self.addSubview(blurView) self.blurView.contentView.addSubview(stackView) self.blurView.contentView.addSubview(resumeLabel) @@ -99,4 +101,18 @@ open class PauseView: TFBaseView { $0.centerX.centerY.equalToSuperview() } } + +// public func show() { +// UIView.animate(withDuration: 0.2) { [weak self] in +// guard let self = self else { return } +// self.isHidden = false +// } +// } +// +// public func hidden() { +// UIView.animate(withDuration: 0.2) { [weak self] in +// guard let self = self else { return } +// self.isHidden = true +// } +// } }