diff --git a/iOS/Layover/Layover/Scenes/Playback/PlaybackViewController.swift b/iOS/Layover/Layover/Scenes/Playback/PlaybackViewController.swift index a4ae556..cf9fc93 100644 --- a/iOS/Layover/Layover/Scenes/Playback/PlaybackViewController.swift +++ b/iOS/Layover/Layover/Scenes/Playback/PlaybackViewController.swift @@ -42,14 +42,6 @@ final class PlaybackViewController: BaseViewController { return collectionView }() - private let reportButton: UIBarButtonItem = { - let button: UIButton = UIButton() - button.setImage(UIImage(systemName: "ellipsis"), for: .normal) - let barButtonItem: UIBarButtonItem = UIBarButtonItem(customView: button) - barButtonItem.customView?.transform = CGAffineTransform(rotationAngle: .pi / 2) - return barButtonItem - }() - // MARK: - Properties private var dataSource: UICollectionViewDiffableDataSource? @@ -125,47 +117,6 @@ final class PlaybackViewController: BaseViewController { override func setUI() { super.setUI() - addWindowPlayerSlider() - guard let button = reportButton.customView as? UIButton else { return } - button.addTarget(self, action: #selector(reportButtonDidTap), for: .touchUpInside) - self.navigationItem.rightBarButtonItem = reportButton - self.navigationController?.navigationBar.tintColor = .layoverWhite - } - - private func addWindowPlayerSlider() { - let scenes = UIApplication.shared.connectedScenes - let windowScene = scenes.first as? UIWindowScene - let window = windowScene?.windows.first - guard let playerSliderWidth: CGFloat = windowScene?.screen.bounds.width else { return } - guard let windowHeight: CGFloat = windowScene?.screen.bounds.height else { return } - guard let tabBarHeight: CGFloat = self.tabBarController?.tabBar.frame.height else { return } - playerSlider.frame = CGRect(x: 0, y: (windowHeight - tabBarHeight - LOSlider.loSliderHeight / 2), width: playerSliderWidth, height: LOSlider.loSliderHeight) - window?.addSubview(playerSlider) - playerSlider.window?.windowLevel = UIWindow.Level.normal + 1 - } - - private func setPlayerSlider(at playbackView: PlaybackView) { - let interval: CMTime = CMTimeMakeWithSeconds(1, preferredTimescale: Int32(NSEC_PER_SEC)) - playbackView.playerView.player?.addPeriodicTimeObserver(forInterval: interval, queue: .main, using: { [weak self] currentTime in - self?.updateSlider(currentTime: currentTime, playerView: playbackView.playerView) - }) - playerSlider.addTarget(self, action: #selector(didChangedSliderValue(_:)), for: .valueChanged) - } - - private func updateSlider(currentTime: CMTime, playerView: PlayerView) { - guard let currentItem: AVPlayerItem = playerView.player?.currentItem else { return } - let duration: CMTime = currentItem.duration - if CMTIME_IS_INVALID(duration) { return } - playerSlider.value = Float(CMTimeGetSeconds(currentTime) / CMTimeGetSeconds(duration)) - } - - private func slowShowPlayerSlider() async { - do { - try await Task.sleep(nanoseconds: 1_000_000_00) - playerSlider.isHidden = false - } catch { - os_log("Fail Waiting show Player Slider") - } } @objc private func didChangedSliderValue(_ sender: LOSlider) { @@ -176,20 +127,6 @@ final class PlaybackViewController: BaseViewController { private func moveToBackViewController() { interactor?.moveToBack() } - - @objc private func reportButtonDidTap() { - let alert: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) - let reportAction: UIAlertAction = UIAlertAction(title: "신고", style: .destructive, handler: { - [weak self] _ in - self?.router?.routeToReport() - }) - let cancelAction: UIAlertAction = UIAlertAction(title: "취소", style: .cancel) - alert.addAction(reportAction) - alert.addAction(cancelAction) - self.present(alert, animated: true, completion: { - self.interactor?.leavePlaybackView() - }) - } } extension PlaybackViewController: PlaybackDisplayLogic { @@ -215,11 +152,6 @@ extension PlaybackViewController: PlaybackDisplayLogic { curCell.addPlayerSlider(tabBarHeight: tabBarHeight) curCell.playbackView.addTargetPlayerSlider() curCell.playbackView.playPlayer() - setPlayerSlider(at: curCell.playbackView) - // Slider가 원점으로 돌아가는 시간 필요 - Task { - await slowShowPlayerSlider() - } } }