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 1c33b88..b021f4f 100644 --- a/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift +++ b/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift @@ -28,7 +28,7 @@ protocol PlaybackBusinessLogic { protocol PlaybackDataStore: AnyObject { var parentView: PlaybackModels.ParentView? { get set } - var prevCell: PlaybackCell? { get set } + var previousCell: PlaybackCell? { get set } var index: Int? { get set } var isTeleport: Bool? { get set } var isDelete: Bool? { get set } @@ -46,7 +46,7 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { var parentView: Models.ParentView? - var prevCell: PlaybackCell? + var previousCell: PlaybackCell? var index: Int? @@ -98,16 +98,16 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { // MARK: - UseCase Playback Video func playInitialPlaybackCell(with request: PlaybackModels.DisplayPlaybackVideo.Request) { - prevCell = request.curCell - let response: Models.DisplayPlaybackVideo.Response = Models.DisplayPlaybackVideo.Response(prevCell: nil, curCell: request.curCell) + previousCell = request.currentCell + let response: Models.DisplayPlaybackVideo.Response = Models.DisplayPlaybackVideo.Response(previousCell: nil, currentCell: request.currentCell) presenter?.presentPlayInitialPlaybackCell(with: response) } func playVideo(with request: PlaybackModels.DisplayPlaybackVideo.Request) { guard let posts else { return } var response: Models.DisplayPlaybackVideo.Response - if prevCell == request.curCell { - response = Models.DisplayPlaybackVideo.Response(prevCell: nil, curCell: prevCell) + if previousCell == request.currentCell { + response = Models.DisplayPlaybackVideo.Response(previousCell: nil, currentCell: previousCell) presenter?.presentShowPlayerSlider(with: response) isTeleport = false return @@ -115,12 +115,12 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { // Home이 아닌 다른 뷰에서 왔을 경우(로드한 목록 무한 반복) if parentView == .other { if request.indexPathRow == (posts.count - 1) { - response = Models.DisplayPlaybackVideo.Response(indexPathRow: 1, prevCell: prevCell, curCell: nil) + response = Models.DisplayPlaybackVideo.Response(indexPathRow: 1, previousCell: previousCell, currentCell: nil) } else if request.indexPathRow == 0 { - response = Models.DisplayPlaybackVideo.Response(indexPathRow: posts.count - 2, prevCell: prevCell, curCell: nil) + response = Models.DisplayPlaybackVideo.Response(indexPathRow: posts.count - 2, previousCell: previousCell, currentCell: nil) } else { - response = Models.DisplayPlaybackVideo.Response(prevCell: prevCell, curCell: request.curCell) - prevCell = request.curCell + response = Models.DisplayPlaybackVideo.Response(previousCell: previousCell, currentCell: request.currentCell) + previousCell = request.currentCell presenter?.presentMoveCellNext(with: response) isTeleport = false return @@ -131,8 +131,8 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { } // Home이면 다음 셀로 이동(추가적인 비디오 로드) isTeleport = false - response = Models.DisplayPlaybackVideo.Response(prevCell: prevCell, curCell: request.curCell) - prevCell = request.curCell + response = Models.DisplayPlaybackVideo.Response(previousCell: previousCell, currentCell: request.currentCell) + previousCell = request.currentCell presenter?.presentMoveCellNext(with: response) } @@ -140,27 +140,27 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { guard let posts else { return } var response: Models.DisplayPlaybackVideo.Response if let isTeleport, isTeleport == true, (request.indexPathRow == 1 || request.indexPathRow == (posts.count - 2)) { - response = Models.DisplayPlaybackVideo.Response(prevCell: prevCell, curCell: request.curCell) - prevCell = request.curCell + response = Models.DisplayPlaybackVideo.Response(previousCell: previousCell, currentCell: request.currentCell) + previousCell = request.currentCell presenter?.presentMoveCellNext(with: response) self.isTeleport = false } if let isDelete, isDelete == true { - response = Models.DisplayPlaybackVideo.Response(prevCell: nil, curCell: request.curCell) - prevCell = request.curCell + response = Models.DisplayPlaybackVideo.Response(previousCell: nil, currentCell: request.currentCell) + previousCell = request.currentCell presenter?.presentMoveCellNext(with: response) self.isDelete = false } } func leavePlaybackView() { - let response: Models.DisplayPlaybackVideo.Response = Models.DisplayPlaybackVideo.Response(prevCell: prevCell, curCell: nil) + let response: Models.DisplayPlaybackVideo.Response = Models.DisplayPlaybackVideo.Response(previousCell: previousCell, currentCell: nil) presenter?.presentLeavePlaybackView(with: response) } func resetVideo() { - let response: Models.DisplayPlaybackVideo.Response = Models.DisplayPlaybackVideo.Response(prevCell: nil, curCell: prevCell) + let response: Models.DisplayPlaybackVideo.Response = Models.DisplayPlaybackVideo.Response(previousCell: nil, currentCell: previousCell) presenter?.presentResetPlaybackCell(with: response) } @@ -169,26 +169,24 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { let parentView else { return } let response: Models.ConfigurePlaybackCell.Response switch parentView { - case .home: + case .home, .myProfile: response = Models.ConfigurePlaybackCell.Response(teleportIndex: nil) - case .other, .myProfile: + case .other: response = Models.ConfigurePlaybackCell.Response(teleportIndex: posts.count + 1) } presenter?.presentConfigureCell(with: response) } func controlPlaybackMovie(with request: PlaybackModels.SeekVideo.Request) { - guard let prevCell, - let playbackView = prevCell.playbackView - else { return } - let willMoveLocation: Float64 = request.currentLocation * playbackView.getDuration() - let response: Models.SeekVideo.Response = Models.SeekVideo.Response(willMoveLocation: willMoveLocation, curCell: prevCell) + guard let previousCell else { return } + let willMoveLocation: Float64 = request.currentLocation * previousCell.playbackView.getDuration() + let response: Models.SeekVideo.Response = Models.SeekVideo.Response(willMoveLocation: willMoveLocation, currentCell: previousCell) presenter?.presentSeekVideo(with: response) } func hidePlayerSlider() { - guard let prevCell else { return } - prevCell.playbackView?.playerSlider?.isHidden = true + guard let previousCell else { return } + previousCell.playbackView.playerSlider?.isHidden = true } func setSeeMoreButton() { @@ -201,10 +199,10 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { func deleteVideo(with request: PlaybackModels.DeletePlaybackVideo.Request) -> Task { isDelete = true - guard let prevCell, + guard let previousCell, let worker else { return Task { false } } - guard let boardID = prevCell.boardID else { return Task { false } } + guard let boardID = previousCell.boardID else { return Task { false } } return Task { let result: Bool = await worker.deletePlaybackVideo(boardID: boardID) let response: Models.DeletePlaybackVideo.Response = Models.DeletePlaybackVideo.Response(result: result, playbackVideo: request.playbackVideo) @@ -216,7 +214,7 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { } func resumeVideo() { - guard let prevCell else { return } - prevCell.playbackView?.playPlayer() + guard let previousCell else { return } + previousCell.playbackView.playPlayer() } } diff --git a/iOS/Layover/Layover/Scenes/Playback/PlaybackModels.swift b/iOS/Layover/Layover/Scenes/Playback/PlaybackModels.swift index 3b08ee9..6e49622 100644 --- a/iOS/Layover/Layover/Scenes/Playback/PlaybackModels.swift +++ b/iOS/Layover/Layover/Scenes/Playback/PlaybackModels.swift @@ -69,30 +69,30 @@ enum PlaybackModels { enum DisplayPlaybackVideo { struct Request { let indexPathRow: Int? - let curCell: PlaybackCell? + let currentCell: PlaybackCell? } struct Response { let indexPathRow: Int? - let prevCell: PlaybackCell? - let curCell: PlaybackCell? + let previousCell: PlaybackCell? + let currentCell: PlaybackCell? - init(indexPathRow: Int? = nil, prevCell: PlaybackCell?, curCell: PlaybackCell?) { + init(indexPathRow: Int? = nil, previousCell: PlaybackCell?, currentCell: PlaybackCell?) { self.indexPathRow = indexPathRow - self.prevCell = prevCell - self.curCell = curCell + self.previousCell = previousCell + self.currentCell = currentCell } } struct ViewModel { let indexPathRow: Int? - var prevCell: PlaybackCell? - let curCell: PlaybackCell? + var previousCell: PlaybackCell? + let currentCell: PlaybackCell? - init(indexPathRow: Int? = nil, prevCell: PlaybackCell?, curCell: PlaybackCell?) { + init(indexPathRow: Int? = nil, previousCell: PlaybackCell?, currentCell: PlaybackCell?) { self.indexPathRow = indexPathRow - self.prevCell = prevCell - self.curCell = curCell + self.previousCell = previousCell + self.currentCell = currentCell } } } @@ -121,12 +121,12 @@ enum PlaybackModels { struct Response { let willMoveLocation: Float64 - let curCell: PlaybackCell + let currentCell: PlaybackCell } struct ViewModel { let willMoveLocation: Float64 - let curCell: PlaybackCell + let currentCell: PlaybackCell } } diff --git a/iOS/Layover/Layover/Scenes/Playback/PlaybackPresenter.swift b/iOS/Layover/Layover/Scenes/Playback/PlaybackPresenter.swift index 800816c..f441c8c 100644 --- a/iOS/Layover/Layover/Scenes/Playback/PlaybackPresenter.swift +++ b/iOS/Layover/Layover/Scenes/Playback/PlaybackPresenter.swift @@ -73,32 +73,32 @@ final class PlaybackPresenter: PlaybackPresentationLogic { // MARK: - UseCase Playback Video func presentMoveCellNext(with response: PlaybackModels.DisplayPlaybackVideo.Response) { - let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(prevCell: response.prevCell, curCell: response.curCell) + let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(previousCell: response.previousCell, currentCell: response.currentCell) viewController?.stopPrevPlayerAndPlayCurPlayer(viewModel: viewModel) } func presentPlayInitialPlaybackCell(with response: PlaybackModels.DisplayPlaybackVideo.Response) { - let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(prevCell: nil, curCell: response.curCell) + let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(previousCell: nil, currentCell: response.currentCell) viewController?.stopPrevPlayerAndPlayCurPlayer(viewModel: viewModel) } func presentShowPlayerSlider(with response: PlaybackModels.DisplayPlaybackVideo.Response) { - let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(prevCell: nil, curCell: response.curCell) + let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(previousCell: nil, currentCell: response.currentCell) viewController?.showPlayerSlider(viewModel: viewModel) } func presentTeleportCell(with response: PlaybackModels.DisplayPlaybackVideo.Response) { - let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(indexPathRow: response.indexPathRow, prevCell: nil, curCell: nil) + let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(indexPathRow: response.indexPathRow, previousCell: nil, currentCell: nil) viewController?.teleportPlaybackCell(viewModel: viewModel) } func presentLeavePlaybackView(with response: PlaybackModels.DisplayPlaybackVideo.Response) { - let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(prevCell: response.prevCell, curCell: nil) + let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(previousCell: response.previousCell, currentCell: nil) viewController?.leavePlaybackView(viewModel: viewModel) } func presentResetPlaybackCell(with response: PlaybackModels.DisplayPlaybackVideo.Response) { - let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(prevCell: nil, curCell: response.curCell) + let viewModel: Models.DisplayPlaybackVideo.ViewModel = Models.DisplayPlaybackVideo.ViewModel(previousCell: nil, currentCell: response.currentCell) viewController?.resetVideo(viewModel: viewModel) } @@ -112,7 +112,7 @@ final class PlaybackPresenter: PlaybackPresentationLogic { // MARK: - UseCase Seek Video func presentSeekVideo(with response: PlaybackModels.SeekVideo.Response) { - let viewModel: Models.SeekVideo.ViewModel = Models.SeekVideo.ViewModel(willMoveLocation: response.willMoveLocation, curCell: response.curCell) + let viewModel: Models.SeekVideo.ViewModel = Models.SeekVideo.ViewModel(willMoveLocation: response.willMoveLocation, currentCell: response.currentCell) viewController?.seekVideo(viewModel: viewModel) } diff --git a/iOS/Layover/Layover/Scenes/Playback/PlaybackRouter.swift b/iOS/Layover/Layover/Scenes/Playback/PlaybackRouter.swift index f5f6749..b927757 100644 --- a/iOS/Layover/Layover/Scenes/Playback/PlaybackRouter.swift +++ b/iOS/Layover/Layover/Scenes/Playback/PlaybackRouter.swift @@ -35,7 +35,7 @@ final class PlaybackRouter: NSObject, PlaybackRoutingLogic, PlaybackDataPassing guard let source = dataStore, var destination = reportViewController.router?.dataStore else { return } - destination.boardID = source.prevCell?.boardID + destination.boardID = source.previousCell?.boardID reportViewController.modalPresentationStyle = .fullScreen viewController?.present(reportViewController, animated: false) } diff --git a/iOS/Layover/Layover/Scenes/Playback/PlaybackView.swift b/iOS/Layover/Layover/Scenes/Playback/PlaybackView.swift index 49c8af3..19778ce 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,19 +90,15 @@ 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() setPlayerView() } required init?(coder: NSCoder) { - self.descriptionContent = "" super.init(coder: coder) setUI() -// addDescriptionAnimateGesture() setPlayerView() } @@ -181,6 +175,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 +219,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 +254,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 3237fb1..bad5373 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() } @@ -185,15 +186,15 @@ 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() + if let previousCell = viewModel.previousCell { + previousCell.playbackView.removePlayerSlider() + previousCell.playbackView.stopPlayer() + previousCell.playbackView.replayPlayer() } - if let curCell = viewModel.curCell { - curCell.addPlayerSlider(tabBarHeight: tabBarHeight) - curCell.playbackView?.addTargetPlayerSlider() - curCell.playbackView?.playPlayer() + if let currentCell = viewModel.currentCell { + currentCell.addPlayerSlider(tabBarHeight: tabBarHeight) + currentCell.playbackView.addTargetPlayerSlider() + currentCell.playbackView.playPlayer() } } @@ -201,12 +202,12 @@ extension PlaybackViewController: PlaybackDisplayLogic { guard let currentPlaybackCell: PlaybackCell = playbackCollectionView.cellForItem(at: IndexPath(row: viewModel.indexPathRow, section: 0)) as? PlaybackCell else { return } - let request: Models.DisplayPlaybackVideo.Request = Models.DisplayPlaybackVideo.Request(indexPathRow: nil, curCell: currentPlaybackCell) + let request: Models.DisplayPlaybackVideo.Request = Models.DisplayPlaybackVideo.Request(indexPathRow: nil, currentCell: currentPlaybackCell) interactor?.playInitialPlaybackCell(with: request) } func showPlayerSlider(viewModel: PlaybackModels.DisplayPlaybackVideo.ViewModel) { - viewModel.curCell?.playbackView?.playerSlider?.isHidden = false + viewModel.currentCell?.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.previousCell?.playbackView.stopPlayer() } func configureDataSource(viewModel: PlaybackModels.ConfigurePlaybackCell.ViewModel) { @@ -241,15 +242,15 @@ 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.currentCell.playbackView.seekPlayer(seekTime: seekTime) + viewModel.currentCell.playbackView.playPlayer() } func resetVideo(viewModel: PlaybackModels.DisplayPlaybackVideo.ViewModel) { - var curCell = viewModel.curCell - curCell?.resetObserver() - curCell?.playbackView?.resetPlayer() - curCell = nil + var currentCell = viewModel.currentCell + currentCell?.resetObserver() + currentCell?.playbackView.resetPlayer() + currentCell = nil } func setSeemoreButton(viewModel: Models.SetSeemoreButton.ViewModel) { @@ -296,7 +297,7 @@ extension PlaybackViewController: UICollectionViewDelegate { guard let currentPlaybackCell: PlaybackCell = playbackCollectionView.cellForItem(at: IndexPath(row: indexPathRow, section: 0)) as? PlaybackCell else { return } - let request: Models.DisplayPlaybackVideo.Request = Models.DisplayPlaybackVideo.Request(indexPathRow: indexPathRow, curCell: currentPlaybackCell) + let request: Models.DisplayPlaybackVideo.Request = Models.DisplayPlaybackVideo.Request(indexPathRow: indexPathRow, currentCell: currentPlaybackCell) interactor?.playVideo(with: request) } @@ -309,7 +310,7 @@ extension PlaybackViewController: UICollectionViewDelegate { return } - let request: Models.DisplayPlaybackVideo.Request = Models.DisplayPlaybackVideo.Request(indexPathRow: indexPath.row, curCell: currentPlaybackCell) + let request: Models.DisplayPlaybackVideo.Request = Models.DisplayPlaybackVideo.Request(indexPathRow: indexPath.row, currentCell: currentPlaybackCell) interactor?.playTeleportVideo(with: request) } } diff --git a/iOS/Layover/Layover/Scenes/Profile/ProfileConfigurator.swift b/iOS/Layover/Layover/Scenes/Profile/ProfileConfigurator.swift index a0c7714..4f12272 100644 --- a/iOS/Layover/Layover/Scenes/Profile/ProfileConfigurator.swift +++ b/iOS/Layover/Layover/Scenes/Profile/ProfileConfigurator.swift @@ -19,7 +19,8 @@ final class ProfileConfigurator: Configurator { func configure(_ viewController: ViewController) { let viewController = viewController let interactor = ProfileInteractor() - let worker = MockUserWorker() +// let worker = MockUserWorker() + let worker = UserWorker() let presenter = ProfilePresenter() let router = ProfileRouter()