From 0b1bda52c713531e766617c593e9d0888ed1d4e8 Mon Sep 17 00:00:00 2001 From: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:52:55 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix/#177=20::=20=EC=82=AC=EC=A7=84=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=EB=90=98=EB=8A=94=20=EC=88=9C=EC=84=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC=ED=95=B4=EC=84=9C=20=EB=B3=B4=EB=82=B4?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - viewPosition에 따라 적당한 순서로 이미지 배열을 정렬해서 보냅니다. - PositionOrder는 참가자순서로 나열된 ViewPosition을 배열에 담길 순서로 바꿔줍니다 - userInfo가 nil일 경우 PositionOder의 sequence를 2로 처리합니다.(배열의 2번 인덱스가 마지막 자리) --- .../CaptureVideosUseCaseImpl.swift | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift index 8be35bff..f221cf4c 100644 --- a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift +++ b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift @@ -11,9 +11,12 @@ public final class CaptureVideosUseCaseImpl: CaptureVideosUseCase { PTGImage.temp3.image, PTGImage.temp4.image] } - let remoteImages = connectionRepository.clients.map { $0.captureVideo() } - return [localImage] + remoteImages + let localUserImageInfo = [(connectionRepository.localUserInfo, localImage)] + let remoteUserImagesInfo = connectionRepository.clients + .map { ($0.remoteUserInfo, $0.captureVideo()) } + + return sortImages(localUserImageInfo + remoteUserImagesInfo) } private let connectionRepository: ConnectionRepository @@ -21,4 +24,38 @@ public final class CaptureVideosUseCaseImpl: CaptureVideosUseCase { public init(connectionRepository: ConnectionRepository) { self.connectionRepository = connectionRepository } + + private func sortImages(_ images: [(user: UserInfo?, image: UIImage)]) -> [UIImage] { + let convertedArray = images.map { + (position: PositionOder(rawValue: $0.user?.viewPosition.rawValue ?? -1), + image: $0.image) + } + + // 배열의 2번 인덱스가 마지막 자리이기 때문에 nil일 경우 2로 설정했습니다 + let sortedByViewPosition = convertedArray.sorted { + let lhs = $0.position?.sequence ?? 2 + let rhs = $1.position?.sequence ?? 2 + return lhs < rhs + } + + return sortedByViewPosition.map { $0.image } + } +} + + +// case의 순서는 참가자의 참가 순서에 따른 화면 배치이고 sequence는 이미지 데이터 전달할 때의 배열 순서입니다 +private enum PositionOder: Int { + case topLeading + case bottomTrailing + case topTrailing + case bottomLeading + + var sequence: Int { + switch self { + case .topLeading: 0 + case .topTrailing: 1 + case .bottomLeading: 2 + case .bottomTrailing: 3 + } + } } From 4568f237f838a54534b83c69eeaa22f4c8c41b77 Mon Sep 17 00:00:00 2001 From: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:01:46 +0900 Subject: [PATCH 2/5] =?UTF-8?q?chore/#177=20::=20localImage=20nil=EC=9D=BC?= =?UTF-8?q?=20=EA=B2=BD=EC=9A=B0=20=EB=B9=88=20UIImage=20=EC=A0=84?= =?UTF-8?q?=EB=8B=AC=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - localImage nil일 경우 빈 UIImage 전달하도록 변경 - UserInfo를 보내는 곳에 ViewPosition만 전달 --- .../UseCaseImpl/CaptureVideosUseCaseImpl.swift | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift index f221cf4c..b061a25d 100644 --- a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift +++ b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift @@ -4,17 +4,11 @@ import DesignSystem public final class CaptureVideosUseCaseImpl: CaptureVideosUseCase { public func execute() -> [UIImage] { - guard let localImage = connectionRepository.capturedLocalVideo - else { return [ - PTGImage.temp1.image, - PTGImage.temp2.image, - PTGImage.temp3.image, - PTGImage.temp4.image] - } + let localImage = connectionRepository.capturedLocalVideo ?? UIImage() - let localUserImageInfo = [(connectionRepository.localUserInfo, localImage)] + let localUserImageInfo = [(connectionRepository.localUserInfo?.viewPosition, localImage)] let remoteUserImagesInfo = connectionRepository.clients - .map { ($0.remoteUserInfo, $0.captureVideo()) } + .map { ($0.remoteUserInfo?.viewPosition, $0.captureVideo()) } return sortImages(localUserImageInfo + remoteUserImagesInfo) } @@ -25,9 +19,9 @@ public final class CaptureVideosUseCaseImpl: CaptureVideosUseCase { self.connectionRepository = connectionRepository } - private func sortImages(_ images: [(user: UserInfo?, image: UIImage)]) -> [UIImage] { + private func sortImages(_ images: [(viewPosition: UserInfo.ViewPosition?, image: UIImage)]) -> [UIImage] { let convertedArray = images.map { - (position: PositionOder(rawValue: $0.user?.viewPosition.rawValue ?? -1), + (position: PositionOder(rawValue: $0.viewPosition?.rawValue ?? -1), image: $0.image) } @@ -42,7 +36,6 @@ public final class CaptureVideosUseCaseImpl: CaptureVideosUseCase { } } - // case의 순서는 참가자의 참가 순서에 따른 화면 배치이고 sequence는 이미지 데이터 전달할 때의 배열 순서입니다 private enum PositionOder: Int { case topLeading From 6b6d7f405bd23ea92f1ed2a22d44c56a0c8747e2 Mon Sep 17 00:00:00 2001 From: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:22:53 +0900 Subject: [PATCH 3/5] =?UTF-8?q?chore/#177=20::=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EB=AA=A8=EB=93=88=20import=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift index b061a25d..c613f8f1 100644 --- a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift +++ b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift @@ -1,6 +1,5 @@ import UIKit import PhotoGetherDomainInterface -import DesignSystem public final class CaptureVideosUseCaseImpl: CaptureVideosUseCase { public func execute() -> [UIImage] { From efea3619587cf44453cac9805561dd1bbe4193a5 Mon Sep 17 00:00:00 2001 From: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:24:14 +0900 Subject: [PATCH 4/5] =?UTF-8?q?chore/#177=20::=20=EC=A3=BC=EC=84=9D=20desc?= =?UTF-8?q?ription=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: YeongHoon Song --- .../UseCaseImpl/CaptureVideosUseCaseImpl.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift index c613f8f1..1e845b80 100644 --- a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift +++ b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomain/UseCaseImpl/CaptureVideosUseCaseImpl.swift @@ -35,7 +35,7 @@ public final class CaptureVideosUseCaseImpl: CaptureVideosUseCase { } } -// case의 순서는 참가자의 참가 순서에 따른 화면 배치이고 sequence는 이미지 데이터 전달할 때의 배열 순서입니다 +/// case의 순서는 참가자의 참가 순서에 따른 화면 배치이고 sequence는 이미지 데이터 전달할 때의 배열 순서입니다 private enum PositionOder: Int { case topLeading case bottomTrailing From 253f8b8d8ab4a59125763832df5eadd9b7cf33fd Mon Sep 17 00:00:00 2001 From: Kiyoung <121777185+Kiyoung-Kim-57@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:45:33 +0900 Subject: [PATCH 5/5] =?UTF-8?q?fix/#177=20::=20=EC=82=AC=EC=A7=84=20?= =?UTF-8?q?=EC=B4=AC=EC=98=81=20=EB=95=8C=20=EC=B9=B4=EB=A9=94=EB=9D=BC=20?= =?UTF-8?q?=ED=95=98=EC=9D=B4=EB=9D=BC=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 사진 촬영 때 카메라 링 하이라이트 --- .../PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift | 4 ++++ .../Source/ViewController/PhotoRoomViewController.swift | 1 + 2 files changed, 5 insertions(+) diff --git a/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift b/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift index e5fa1632..1430f4a4 100644 --- a/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift +++ b/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift @@ -68,6 +68,10 @@ final class PhotoRoomBottomView: UIView { func stopCameraButtonTimer() { cameraButton.stopTimer() } + + func highlightCameraButton() { + cameraButton.layer.borderColor = PTGColor.primaryGreen.color.cgColor + } } extension PhotoRoomBottomView { diff --git a/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/ViewController/PhotoRoomViewController.swift b/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/ViewController/PhotoRoomViewController.swift index 0c216c46..c677856d 100644 --- a/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/ViewController/PhotoRoomViewController.swift +++ b/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/ViewController/PhotoRoomViewController.swift @@ -120,6 +120,7 @@ public final class PhotoRoomViewController: BaseViewController, ViewControllerCo switch $0 { case .timer(let count): self.photoRoomBottomView.setCameraButtonTimer(count) + self.photoRoomBottomView.highlightCameraButton() case .timerCompleted(let images, let userInfo): self.photoRoomBottomView.stopCameraButtonTimer()