From 7f165e1cfdeb5f11eef3955d67ac0057cd168547 Mon Sep 17 00:00:00 2001 From: chopmozzi <44396392+chopmozzi@users.noreply.github.com> Date: Fri, 8 Dec 2023 02:29:16 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20=EC=9E=AC=EC=83=9D=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=9E=AC=EC=82=AC=EC=9A=A9=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Layover/Network/DTOs/BoardDTO.swift | 3 +- .../Network/Mock/MockData/PostList.json | 16 ++++---- .../Network/Mock/MockData/PostListMore.json | 16 ++++---- .../Scenes/Home/HomeConfigurator.swift | 3 +- .../Scenes/Playback/Cell/PlaybackCell.swift | 31 +++++++-------- .../Scenes/Playback/PlaybackInteractor.swift | 10 ++--- .../Scenes/Playback/PlaybackView.swift | 39 ++++++++----------- .../Playback/PlaybackViewController.swift | 21 +++++----- 8 files changed, 67 insertions(+), 72 deletions(-) diff --git a/iOS/Layover/Layover/Network/DTOs/BoardDTO.swift b/iOS/Layover/Layover/Network/DTOs/BoardDTO.swift index 0eca599..e0ce86e 100644 --- a/iOS/Layover/Layover/Network/DTOs/BoardDTO.swift +++ b/iOS/Layover/Layover/Network/DTOs/BoardDTO.swift @@ -12,7 +12,8 @@ struct BoardDTO: Decodable { let id: Int let encodedVideoURL: String let videoThumbnailURL: String - let latitude, longitude, title, content: String + let latitude, longitude: Double + let title, content: String enum CodingKeys: String, CodingKey { case id diff --git a/iOS/Layover/Layover/Network/Mock/MockData/PostList.json b/iOS/Layover/Layover/Network/Mock/MockData/PostList.json index 4c187da..1d73645 100644 --- a/iOS/Layover/Layover/Network/Mock/MockData/PostList.json +++ b/iOS/Layover/Layover/Network/Mock/MockData/PostList.json @@ -14,8 +14,8 @@ "id" : 1, "encoded_video_url" : "https://assets.afcdn.com/video49/20210722/v_645516.m3u8", "video_thumbnail_url" : "https://think-note.com/wp-content/uploads/2023/07/eta_3.jpg", - "longitude" : "37.0532156213", - "latitude" : "127.060123123", + "longitude" : 37.0532156213, + "latitude" : 127.060123123, "title" : "최강 아이돌", "content" : "게시글 설명" }, @@ -32,8 +32,8 @@ "id" : 2, "encoded_video_url" : "https://qc66zhsq1708.edge.naverncp.com/hls/fMG98EEU8c1UirV-awtm4qKJyhaHRcnDymRFlPLZbTs_/layover-station/IMG_0136_AVC_,HD,SD,_1Pass_30fps.mp4.smil/master.m3u8", "video_thumbnail_url" : "video_thumbnail_link", - "longitude" : "37.0532156213", - "latitude" : "127.060123123", + "longitude" : 37.0532156213, + "latitude" : 127.060123123, "title" : "프로듀스 101", "content" : "게시글 설명" }, @@ -50,8 +50,8 @@ "id" : 3, "encoded_video_url" : "https://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8", "video_thumbnail_url" : "https://cdnimg.melon.co.kr/resource/image/cds/musicstory/imgUrl20210831030133473.jpg/melon/quality/90/optimize", - "longitude" : "37.0532156213", - "latitude" : "127.060123123", + "longitude" : 37.0532156213, + "latitude" : 127.060123123, "title" : "프로미스 나인", "content" : "게시글 설명" }, @@ -68,8 +68,8 @@ "id" : 4, "encoded_video_url" : "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8", "video_thumbnail_url" : "https://res.heraldm.com/content/image/2023/04/16/20230416000040_0.jpg", - "longitude" : "37.0532156213", - "latitude" : "127.060123123", + "longitude" : 37.0532156213, + "latitude" : 127.060123123, "title" : "아이즈원", "content" : "게시글 설명2" }, diff --git a/iOS/Layover/Layover/Network/Mock/MockData/PostListMore.json b/iOS/Layover/Layover/Network/Mock/MockData/PostListMore.json index 4208a6f..4337f2c 100644 --- a/iOS/Layover/Layover/Network/Mock/MockData/PostListMore.json +++ b/iOS/Layover/Layover/Network/Mock/MockData/PostListMore.json @@ -14,8 +14,8 @@ "id" : 5, "encoded_video_url" : "https://assets.afcdn.com/video49/20210722/v_645516.m3u8", "video_thumbnail_url" : "https://think-note.com/wp-content/uploads/2023/07/eta_3.jpg", - "longitude" : "37.0532156213", - "latitude" : "127.060123123", + "longitude" : 37.0532156213, + "latitude" : 127.060123123, "title" : "최강 아이돌", "content" : "게시글 설명" }, @@ -32,8 +32,8 @@ "id" : 6, "encoded_video_url" : "https://qc66zhsq1708.edge.naverncp.com/hls/fMG98EEU8c1UirV-awtm4qKJyhaHRcnDymRFlPLZbTs_/layover-station/IMG_0136_AVC_,HD,SD,_1Pass_30fps.mp4.smil/master.m3u8", "video_thumbnail_url" : "video_thumbnail_link", - "longitude" : "37.0532156213", - "latitude" : "127.060123123", + "longitude" : 37.0532156213, + "latitude" : 127.060123123, "title" : "프로듀스 101", "content" : "게시글 설명" }, @@ -50,8 +50,8 @@ "id" : 7, "encoded_video_url" : "https://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8", "video_thumbnail_url" : "https://cdnimg.melon.co.kr/resource/image/cds/musicstory/imgUrl20210831030133473.jpg/melon/quality/90/optimize", - "longitude" : "37.0532156213", - "latitude" : "127.060123123", + "longitude" : 37.0532156213, + "latitude" : 127.060123123, "title" : "프로미스 나인", "content" : "게시글 설명" }, @@ -68,8 +68,8 @@ "id" : 8, "encoded_video_url" : "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8", "video_thumbnail_url" : "https://res.heraldm.com/content/image/2023/04/16/20230416000040_0.jpg", - "longitude" : "37.0532156213", - "latitude" : "127.060123123", + "longitude" : 37.0532156213, + "latitude" : 127.060123123, "title" : "아이즈원", "content" : "게시글 설명2" }, diff --git a/iOS/Layover/Layover/Scenes/Home/HomeConfigurator.swift b/iOS/Layover/Layover/Scenes/Home/HomeConfigurator.swift index 4ecc766..b020c91 100644 --- a/iOS/Layover/Layover/Scenes/Home/HomeConfigurator.swift +++ b/iOS/Layover/Layover/Scenes/Home/HomeConfigurator.swift @@ -18,7 +18,8 @@ final class HomeConfigurator: Configurator { let router = HomeRouter() let presenter = HomePresenter() let interactor = HomeInteractor() - let homeWorker = MockHomeWorker() +// let homeWorker = MockHomeWorker() + let homeWorker = HomeWorker() let videoFileWorker = VideoFileWorker() router.viewController = viewController diff --git a/iOS/Layover/Layover/Scenes/Playback/Cell/PlaybackCell.swift b/iOS/Layover/Layover/Scenes/Playback/Cell/PlaybackCell.swift index 84aea64..bffd8f3 100644 --- a/iOS/Layover/Layover/Scenes/Playback/Cell/PlaybackCell.swift +++ b/iOS/Layover/Layover/Scenes/Playback/Cell/PlaybackCell.swift @@ -13,14 +13,16 @@ final class PlaybackCell: UICollectionViewCell { var boardID: Int? - var playbackView: PlaybackView? + let playbackView: PlaybackView = PlaybackView() override init(frame: CGRect) { super.init(frame: frame) + configure() } required init?(coder: NSCoder) { super.init(coder: coder) + configure() } override func prepareForReuse() { @@ -28,37 +30,34 @@ final class PlaybackCell: UICollectionViewCell { } func setPlaybackContents(info: PlaybackModels.PlaybackInfo) { - playbackView = nil boardID = info.boardID - playbackView = PlaybackView(frame: .zero, content: info.content) - playbackView?.descriptionView.titleLabel.text = info.title - configure() - playbackView?.descriptionView.setText(info.content) - playbackView?.profileLabel.text = info.profileName - playbackView?.tagStackView.resetTagStackView() + playbackView.descriptionView.titleLabel.text = info.title + playbackView.descriptionView.setText(info.content) + playbackView.setDescriptionViewUI() + playbackView.profileLabel.text = info.profileName + playbackView.tagStackView.resetTagStackView() info.tag.forEach { tag in - playbackView?.tagStackView.addTag(tag) + playbackView.tagStackView.addTag(tag) } } func addAVPlayer(url: URL) { - playbackView?.resetPlayer() - playbackView?.addAVPlayer(url: url) - playbackView?.setPlayerSlider() + playbackView.resetPlayer() + playbackView.addAVPlayer(url: url) + playbackView.setPlayerSlider() } func addPlayerSlider(tabBarHeight: CGFloat) { - playbackView?.addWindowPlayerSlider(tabBarHeight) + playbackView.addWindowPlayerSlider(tabBarHeight) } func resetObserver() { - playbackView?.removeTimeObserver() - playbackView?.removePlayerSlider() + playbackView.removeTimeObserver() + playbackView.removePlayerSlider() } private func configure() { - guard let playbackView else { return } playbackView.translatesAutoresizingMaskIntoConstraints = false contentView.addSubview(playbackView) NSLayoutConstraint.activate([ diff --git a/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift b/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift index 7a4e746..7277d5c 100644 --- a/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift +++ b/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift @@ -177,17 +177,15 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { } func controlPlaybackMovie(with request: PlaybackModels.SeekVideo.Request) { - guard let prevCell, - let playbackView = prevCell.playbackView - else { return } - let willMoveLocation: Float64 = request.currentLocation * playbackView.getDuration() + guard let prevCell else { return } + let willMoveLocation: Float64 = request.currentLocation * prevCell.playbackView.getDuration() let response: Models.SeekVideo.Response = Models.SeekVideo.Response(willMoveLocation: willMoveLocation, curCell: prevCell) presenter?.presentSeekVideo(with: response) } func hidePlayerSlider() { guard let prevCell else { return } - prevCell.playbackView?.playerSlider?.isHidden = true + prevCell.playbackView.playerSlider?.isHidden = true } func setSeeMoreButton() { @@ -216,6 +214,6 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { func resumeVideo() { guard let prevCell else { return } - prevCell.playbackView?.playPlayer() + prevCell.playbackView.playPlayer() } } diff --git a/iOS/Layover/Layover/Scenes/Playback/PlaybackView.swift b/iOS/Layover/Layover/Scenes/Playback/PlaybackView.swift index 49c8af3..9514324 100644 --- a/iOS/Layover/Layover/Scenes/Playback/PlaybackView.swift +++ b/iOS/Layover/Layover/Scenes/Playback/PlaybackView.swift @@ -13,8 +13,6 @@ final class PlaybackView: UIView { // MARK: - Properties - var descriptionContent: String - private var timeObserverToken: Any? private var playerObserverToken: Any? @@ -23,7 +21,7 @@ final class PlaybackView: UIView { // TODO: private 다시 붙이고 Method 처리 lazy var descriptionView: LODescriptionView = { let descriptionView: LODescriptionView = LODescriptionView() - descriptionView.setText(descriptionContent) + descriptionView.setText("임시내용임") descriptionView.clipsToBounds = true return descriptionView }() @@ -92,8 +90,7 @@ final class PlaybackView: UIView { // MARK: - View Life Cycle - init(frame: CGRect, content: String) { - self.descriptionContent = content + override init(frame: CGRect) { super.init(frame: frame) setUI() // addDescriptionAnimateGesture() @@ -101,7 +98,6 @@ final class PlaybackView: UIView { } required init?(coder: NSCoder) { - self.descriptionContent = "" super.init(coder: coder) setUI() // addDescriptionAnimateGesture() @@ -181,6 +177,21 @@ final class PlaybackView: UIView { playerView.player?.removeTimeObserver(timeObserverToken) } } + + func setDescriptionViewUI() { + if descriptionView.checkLabelOverflow() { + let size: CGSize = CGSize(width: LODescriptionView.descriptionWidth, height: .infinity) + let estimatedSize: CGSize = descriptionView.descriptionLabel.sizeThatFits(size) + let totalHeight: CGFloat = estimatedSize.height + descriptionView.titleLabel.intrinsicContentSize.height + descriptionView.heightAnchor.constraint(equalToConstant: totalHeight).isActive = true + descriptionView.titleLabel.topAnchor.constraint(equalTo: descriptionView.topAnchor, constant: totalHeight - LODescriptionView.descriptionHeight).isActive = true + descriptionView.descriptionLabel.layer.addSublayer(gradientLayer) + addDescriptionAnimateGesture() + } else { + descriptionView.heightAnchor.constraint(equalToConstant: LODescriptionView.descriptionHeight).isActive = true + descriptionView.titleLabel.topAnchor.constraint(equalTo: descriptionView.topAnchor).isActive = true + } + } } // MARK: PlaybackView 내부에서만 쓰이는 Method @@ -210,21 +221,6 @@ private extension PlaybackView { // MARK: - UI Method - func setDescriptionViewUI() { - if descriptionView.checkLabelOverflow() { - let size: CGSize = CGSize(width: LODescriptionView.descriptionWidth, height: .infinity) - let estimatedSize: CGSize = descriptionView.descriptionLabel.sizeThatFits(size) - let totalHeight: CGFloat = estimatedSize.height + descriptionView.titleLabel.intrinsicContentSize.height - descriptionView.heightAnchor.constraint(equalToConstant: totalHeight).isActive = true - descriptionView.titleLabel.topAnchor.constraint(equalTo: descriptionView.topAnchor, constant: totalHeight - LODescriptionView.descriptionHeight).isActive = true - descriptionView.descriptionLabel.layer.addSublayer(gradientLayer) - addDescriptionAnimateGesture() - } else { - descriptionView.heightAnchor.constraint(equalToConstant: LODescriptionView.descriptionHeight).isActive = true - descriptionView.titleLabel.topAnchor.constraint(equalTo: descriptionView.topAnchor).isActive = true - } - } - func setSubViewsInPlayerViewConstraints() { [descriptionView, tagStackView, profileButton, profileLabel, locationLabel, pauseImage, playImage].forEach { subView in subView.translatesAutoresizingMaskIntoConstraints = false @@ -260,7 +256,6 @@ private extension PlaybackView { playImage.widthAnchor.constraint(equalToConstant: 65), playImage.heightAnchor.constraint(equalToConstant: 65) ]) - setDescriptionViewUI() } func setUI() { diff --git a/iOS/Layover/Layover/Scenes/Playback/PlaybackViewController.swift b/iOS/Layover/Layover/Scenes/Playback/PlaybackViewController.swift index 38e7a43..8e5b88b 100644 --- a/iOS/Layover/Layover/Scenes/Playback/PlaybackViewController.swift +++ b/iOS/Layover/Layover/Scenes/Playback/PlaybackViewController.swift @@ -101,6 +101,7 @@ final class PlaybackViewController: BaseViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) interactor?.leavePlaybackView() + interactor?.hidePlayerSlider() if isMovingFromParent { interactor?.resetVideo() } @@ -186,14 +187,14 @@ extension PlaybackViewController: PlaybackDisplayLogic { func stopPrevPlayerAndPlayCurPlayer(viewModel: PlaybackModels.DisplayPlaybackVideo.ViewModel) { guard let tabBarHeight: CGFloat = self.tabBarController?.tabBar.frame.height else { return } if let prevCell = viewModel.prevCell { - prevCell.playbackView?.removePlayerSlider() - prevCell.playbackView?.stopPlayer() - prevCell.playbackView?.replayPlayer() + prevCell.playbackView.removePlayerSlider() + prevCell.playbackView.stopPlayer() + prevCell.playbackView.replayPlayer() } if let curCell = viewModel.curCell { curCell.addPlayerSlider(tabBarHeight: tabBarHeight) - curCell.playbackView?.addTargetPlayerSlider() - curCell.playbackView?.playPlayer() + curCell.playbackView.addTargetPlayerSlider() + curCell.playbackView.playPlayer() } } @@ -206,7 +207,7 @@ extension PlaybackViewController: PlaybackDisplayLogic { } func showPlayerSlider(viewModel: PlaybackModels.DisplayPlaybackVideo.ViewModel) { - viewModel.curCell?.playbackView?.playerSlider?.isHidden = false + viewModel.curCell?.playbackView.playerSlider?.isHidden = false } func moveInitialPlaybackCell(viewModel: PlaybackModels.SetInitialPlaybackCell.ViewModel) { @@ -221,7 +222,7 @@ extension PlaybackViewController: PlaybackDisplayLogic { } func leavePlaybackView(viewModel: PlaybackModels.DisplayPlaybackVideo.ViewModel) { - viewModel.prevCell?.playbackView?.stopPlayer() + viewModel.prevCell?.playbackView.stopPlayer() } func configureDataSource(viewModel: PlaybackModels.ConfigurePlaybackCell.ViewModel) { @@ -241,14 +242,14 @@ extension PlaybackViewController: PlaybackDisplayLogic { func seekVideo(viewModel: PlaybackModels.SeekVideo.ViewModel) { let seekTime: CMTime = CMTime(value: CMTimeValue(viewModel.willMoveLocation), timescale: 1) - viewModel.curCell.playbackView?.seekPlayer(seekTime: seekTime) - viewModel.curCell.playbackView?.playPlayer() + viewModel.curCell.playbackView.seekPlayer(seekTime: seekTime) + viewModel.curCell.playbackView.playPlayer() } func resetVideo(viewModel: PlaybackModels.DisplayPlaybackVideo.ViewModel) { var curCell = viewModel.curCell curCell?.resetObserver() - curCell?.playbackView?.resetPlayer() + curCell?.playbackView.resetPlayer() curCell = nil }