From d8ec12f18019570d3e184cfecca8beacc4a0271c Mon Sep 17 00:00:00 2001 From: 0Hooni Date: Tue, 3 Dec 2024 16:24:43 +0900 Subject: [PATCH 01/10] =?UTF-8?q?feat/#176=20::=20hex=20code=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=20UIColor=20initializer=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: seuhong <66902876+hsw1920@users.noreply.github.com> --- .../DesignSystem/Source/UIColor+.swift | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 PhotoGether/PresentationLayer/DesignSystem/DesignSystem/Source/UIColor+.swift diff --git a/PhotoGether/PresentationLayer/DesignSystem/DesignSystem/Source/UIColor+.swift b/PhotoGether/PresentationLayer/DesignSystem/DesignSystem/Source/UIColor+.swift new file mode 100644 index 00000000..0a33963c --- /dev/null +++ b/PhotoGether/PresentationLayer/DesignSystem/DesignSystem/Source/UIColor+.swift @@ -0,0 +1,26 @@ +import UIKit + +public extension UIColor { + convenience init(hex: String) { + let hexString = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted) + var int = UInt64() + Scanner(string: hexString).scanHexInt64(&int) + + let red, green, blue, alpha: UInt64 + switch hexString.count { + case 6: // 6자리 (RGB) + (red, green, blue, alpha) = ((int >> 16) & 0xFF, (int >> 8) & 0xFF, int & 0xFF, 0xFF) + case 8: // 8자리 (RGBA) + (red, green, blue, alpha) = ((int >> 24) & 0xFF, (int >> 16) & 0xFF, (int >> 8) & 0xFF, int & 0xFF) + default: + (red, green, blue, alpha) = (0, 0, 0, 0xFF) // 유효하지 않은 경우 기본값 + } + + self.init( + red: CGFloat(red) / 255.0, + green: CGFloat(green) / 255.0, + blue: CGFloat(blue) / 255.0, + alpha: CGFloat(alpha) / 255.0 + ) + } +} From f8089da78ea35817cdf3083d86d31bdec36c2ddc Mon Sep 17 00:00:00 2001 From: 0Hooni Date: Tue, 3 Dec 2024 16:25:15 +0900 Subject: [PATCH 02/10] =?UTF-8?q?feat/#176=20::=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=EC=BB=AC=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: seuhong <66902876+hsw1920@users.noreply.github.com> --- .../Entity/UserInfo.swift | 16 ++++++++++++++++ .../Source/View/StickerView.swift | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomainInterface/Entity/UserInfo.swift b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomainInterface/Entity/UserInfo.swift index 09d63890..1b0ccb52 100644 --- a/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomainInterface/Entity/UserInfo.swift +++ b/PhotoGether/DomainLayer/PhotoGetherDomain/PhotoGetherDomainInterface/Entity/UserInfo.swift @@ -16,6 +16,15 @@ public struct UserInfo: Identifiable, Equatable, Codable { case bottomTrailing case topTrailing case bottomLeading + + public var color: UserColor { + switch self { + case .topLeading: return .orange + case .bottomTrailing: return .brown + case .topTrailing: return .blue + case .bottomLeading: return .gray + } + } } public init( @@ -31,4 +40,11 @@ public struct UserInfo: Identifiable, Equatable, Codable { self.viewPosition = viewPosition self.roomID = roomID } + + public enum UserColor: String, Codable { + case orange = "#FF7561" + case brown = "#E7C892" + case blue = "#82BBE6" + case gray = "#7D7C84" + } } diff --git a/PhotoGether/PresentationLayer/EditPhotoRoomFeature/EditPhotoRoomFeature/Source/View/StickerView.swift b/PhotoGether/PresentationLayer/EditPhotoRoomFeature/EditPhotoRoomFeature/Source/View/StickerView.swift index 42853ffc..c6027dd2 100644 --- a/PhotoGether/PresentationLayer/EditPhotoRoomFeature/EditPhotoRoomFeature/Source/View/StickerView.swift +++ b/PhotoGether/PresentationLayer/EditPhotoRoomFeature/EditPhotoRoomFeature/Source/View/StickerView.swift @@ -206,8 +206,11 @@ final class StickerView: UIView { if owner == user { layerView.layer.borderColor = PTGColor.primaryGreen.color.cgColor + nicknameLabel.backgroundColor = PTGColor.primaryGreen.color } else { - layerView.layer.borderColor = PTGColor.gray70.color.cgColor + guard let hexColor = owner?.viewPosition.color.rawValue else { return } + layerView.layer.borderColor = UIColor(hex: hexColor).cgColor + nicknameLabel.backgroundColor = UIColor(hex: hexColor) } } 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 03/10] =?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 04/10] =?UTF-8?q?chore/#177=20::=20localImage=20nil?= =?UTF-8?q?=EC=9D=BC=20=EA=B2=BD=EC=9A=B0=20=EB=B9=88=20UIImage=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=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 05/10] =?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 06/10] =?UTF-8?q?chore/#177=20::=20=EC=A3=BC=EC=84=9D=20de?= =?UTF-8?q?scription=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 12406ecdfd2d6bf03eaa58213e006196e625c6dc Mon Sep 17 00:00:00 2001 From: youn9k Date: Tue, 3 Dec 2024 18:42:43 +0900 Subject: [PATCH 07/10] =?UTF-8?q?feat/#175=20::=20=EC=B9=B4=EB=A9=94?= =?UTF-8?q?=EB=9D=BC=EC=A0=84=ED=99=98=EB=B2=84=ED=8A=BC,=20=ED=95=84?= =?UTF-8?q?=ED=84=B0=EB=B2=84=ED=8A=BC=20=ED=9E=88=EB=93=A0=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift b/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift index e5fa1632..eb766dee 100644 --- a/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift +++ b/PhotoGether/PresentationLayer/PhotoRoomFeature/PhotoRoomFeature/Source/View/PhotoRoomBottomView.swift @@ -59,6 +59,9 @@ final class PhotoRoomBottomView: UIView { filterButton.imageView?.tintColor = isHost ? .white : PTGColor.gray85.color switchCameraButton.setImage(PTGImage.switchIcon.image, for: .normal) + + switchCameraButton.isHidden = true + filterButton.isHidden = true } func setCameraButtonTimer(_ count: Int) { 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 08/10] =?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() From 017de5bfa4bf8bf1bdf5ee6246d88c19bf7503f4 Mon Sep 17 00:00:00 2001 From: youn9k Date: Tue, 3 Dec 2024 20:11:58 +0900 Subject: [PATCH 09/10] =?UTF-8?q?feat/#175=20::=20=EB=B0=A9=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EC=9D=84=20=EC=95=88=ED=95=98=EB=A9=B4=20=EC=8B=9C?= =?UTF-8?q?=EC=9E=91=ED=95=98=EC=A7=80=20=EB=AA=BB=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WaitingRoomFeature/Source/View/WaitingRoomView.swift | 7 +++++++ .../Source/ViewController/WaitingRoomViewController.swift | 3 +++ .../Source/ViewModel/WaitingRoomViewModel.swift | 2 ++ 3 files changed, 12 insertions(+) diff --git a/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/View/WaitingRoomView.swift b/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/View/WaitingRoomView.swift index f2a63627..ebb91427 100644 --- a/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/View/WaitingRoomView.swift +++ b/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/View/WaitingRoomView.swift @@ -30,6 +30,11 @@ final class WaitingRoomView: UIView { guard let title = StartButtonTitle(from: count) else { return } startButton.setTitle(to: title.rawValue) } + + func enableStartButton() { + self.startButton.isEnabled = true + self.startButton.backgroundColor = PTGColor.primaryGreen.color + } } private extension WaitingRoomView { @@ -81,6 +86,8 @@ private extension WaitingRoomView { func configureUI() { self.backgroundColor = PTGColor.gray90.color startButton.setTitle(to: "촬영시작") + startButton.isEnabled = false + startButton.backgroundColor = .gray } } diff --git a/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewController/WaitingRoomViewController.swift b/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewController/WaitingRoomViewController.swift index be6eff36..fe68a011 100644 --- a/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewController/WaitingRoomViewController.swift +++ b/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewController/WaitingRoomViewController.swift @@ -112,6 +112,9 @@ public final class WaitingRoomViewController: BaseViewController { // MARK: 토스트 메시지 노출 case .shouldShowToast(let message): self.showToast(message: message, duration: 3.0) + + case .readyToStart: + self.waitingRoomView.enableStartButton() } }.store(in: &cancellables) } diff --git a/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewModel/WaitingRoomViewModel.swift b/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewModel/WaitingRoomViewModel.swift index 0c1061b4..cf3381a5 100644 --- a/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewModel/WaitingRoomViewModel.swift +++ b/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewModel/WaitingRoomViewModel.swift @@ -18,6 +18,7 @@ public final class WaitingRoomViewModel { case shouldShowShareSheet(String) case navigateToPhotoRoom case shouldShowToast(String) + case readyToStart } private let sendOfferUseCase: SendOfferUseCase @@ -139,6 +140,7 @@ public final class WaitingRoomViewModel { } }, receiveValue: { [weak self] roomLink in self?.output.send(.shouldShowShareSheet(roomLink)) + self?.output.send(.readyToStart) }) .store(in: &cancellables) } From ba4860953ad697dbb23ad3228f8dccb55b0f3554 Mon Sep 17 00:00:00 2001 From: youn9k Date: Wed, 4 Dec 2024 00:20:30 +0900 Subject: [PATCH 10/10] =?UTF-8?q?feat/#175=20::=20=EB=B0=A9=EC=9D=80=20?= =?UTF-8?q?=ED=95=9C=EB=B2=88=EB=A7=8C=20=EC=83=9D=EC=84=B1=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/ViewModel/WaitingRoomViewModel.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewModel/WaitingRoomViewModel.swift b/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewModel/WaitingRoomViewModel.swift index cf3381a5..505b746a 100644 --- a/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewModel/WaitingRoomViewModel.swift +++ b/PhotoGether/PresentationLayer/WaitingRoomFeature/WaitingRoomFeature/Source/ViewModel/WaitingRoomViewModel.swift @@ -29,6 +29,7 @@ public final class WaitingRoomViewModel { private let toggleLocalMicStateUseCase: ToggleLocalMicStateUseCase private var isHost: Bool + private var inviteLinkMessage: String? private var cancellables = Set() private let output = PassthroughSubject() @@ -131,6 +132,10 @@ public final class WaitingRoomViewModel { } private func handleLinkButtonDidTap() { + if let inviteLinkMessage { + self.output.send(.shouldShowShareSheet(inviteLinkMessage)) + return + } createRoomUseCase.execute() .receive(on: RunLoop.main) .sink(receiveCompletion: { [weak self] completion in @@ -138,8 +143,9 @@ public final class WaitingRoomViewModel { debugPrint(error.localizedDescription) self?.output.send(.shouldShowToast("Failed to create room")) } - }, receiveValue: { [weak self] roomLink in - self?.output.send(.shouldShowShareSheet(roomLink)) + }, receiveValue: { [weak self] inviteLinkMessage in + self?.inviteLinkMessage = inviteLinkMessage + self?.output.send(.shouldShowShareSheet(inviteLinkMessage)) self?.output.send(.readyToStart) }) .store(in: &cancellables)