From ef883eebc3cf4d8b87618ebc59f2fe664419eb2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8E=E1=85=AC=E1=84=8C=E1=85=A5=E1=86=BC=E1=84=8B?= =?UTF-8?q?=E1=85=B5=E1=86=AB?= Date: Mon, 2 Dec 2024 23:02:10 +0900 Subject: [PATCH] =?UTF-8?q?feature:=20GameRepository=20=EC=A3=BC=EC=9E=85?= =?UTF-8?q?=20=EC=8B=9C=EC=A0=90=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirplaIN/AirplaIN/SceneDelegate.swift | 4 +++- .../Interface/Repository/GameRepositoryInterface.swift | 3 +-- .../Whiteboard/View/WhiteboardViewController.swift | 6 ++++-- .../View/WhiteboardListViewController.swift | 10 ++++++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/AirplaIN/AirplaIN/SceneDelegate.swift b/AirplaIN/AirplaIN/SceneDelegate.swift index 53f154a..7ef567a 100644 --- a/AirplaIN/AirplaIN/SceneDelegate.swift +++ b/AirplaIN/AirplaIN/SceneDelegate.swift @@ -53,7 +53,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { whiteboardObjectSet: whiteboardObjectSet, textFieldDefaultSize: CGSize(width: 200, height: 50)) let drawObjectUseCase = DrawObjectUseCase() - let gameObjectUseCase = GameObjectUseCase(repository: GameRepository(persistenceService: PersistenceService())) + let gameRepository = GameRepository(persistenceService: PersistenceService()) + let gameObjectUseCase = GameObjectUseCase(repository: gameRepository) let photoUseCase = PhotoUseCase(photoRepository: photoRepository) let chatUseCase = ChatUseCase(chatRepository: chatRepository) @@ -72,6 +73,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { drawObjectUseCase: drawObjectUseCase, textObjectUseCase: textObjectUseCase, chatUseCase: chatUseCase, + gameRepository: gameRepository, gameObjectUseCase: gameObjectUseCase, manageWhiteboardToolUseCase: manageWhiteboardToolUseCase, manageWhiteboardObjectUseCase: manageWhiteboardObjectUseCase) diff --git a/Domain/Domain/Sources/Interface/Repository/GameRepositoryInterface.swift b/Domain/Domain/Sources/Interface/Repository/GameRepositoryInterface.swift index 77cc517..4be3bcb 100644 --- a/Domain/Domain/Sources/Interface/Repository/GameRepositoryInterface.swift +++ b/Domain/Domain/Sources/Interface/Repository/GameRepositoryInterface.swift @@ -13,8 +13,7 @@ public protocol GameRepositoryInterface { func randomGameAnswer() -> String /// 게임 정답 Set을 저장합니다. - /// - Parameter wordleAnswerSet: 게임 정답 Set - func saveWordleAnswerSet(wordleAnswerSet: [String]) + func saveWordleAnswerSet() /// 입력한 단어가 게임 정답 Set에 포함되어 있는지 여부를 판단합니다. /// - Parameter word: 입력한 단어 diff --git a/Presentation/Presentation/Sources/Whiteboard/View/WhiteboardViewController.swift b/Presentation/Presentation/Sources/Whiteboard/View/WhiteboardViewController.swift index 3171a0b..b867f87 100644 --- a/Presentation/Presentation/Sources/Whiteboard/View/WhiteboardViewController.swift +++ b/Presentation/Presentation/Sources/Whiteboard/View/WhiteboardViewController.swift @@ -36,17 +36,20 @@ public final class WhiteboardViewController: UIViewController { } private let profileRepository: ProfileRepositoryInterface private let chatUseCase: ChatUseCaseInterface + private let gameRepository: GameRepositoryInterface public init( viewModel: WhiteboardViewModel, objectViewFactory: WhiteboardObjectViewFactoryable, profileRepository: ProfileRepositoryInterface, - chatUseCase: ChatUseCaseInterface + chatUseCase: ChatUseCaseInterface, + gameRepository: GameRepositoryInterface ) { self.viewModel = viewModel self.objectViewFactory = objectViewFactory self.profileRepository = profileRepository self.chatUseCase = chatUseCase + self.gameRepository = gameRepository cancellables = [] whiteboardObjectViews = [:] super.init(nibName: nil, bundle: nil) @@ -363,7 +366,6 @@ extension WhiteboardViewController: UITextViewDelegate { extension WhiteboardViewController: GameObjectViewDelegate { public func gameObjectViewDidDoubleTap(_ sender: GameObjectView, gameObject: GameObject) { viewModel.action(input: .deselectObject) - let gameRepository = GameRepository(persistenceService: PersistenceService()) let wordelViewModel = WordleViewModel(gameRepository: gameRepository, gameObject: gameObject) let wordleView = WordleView(viewModel: wordelViewModel) let hostingController = UIHostingController(rootView: NavigationStack { wordleView }) diff --git a/Presentation/Presentation/Sources/WhiteboardList/View/WhiteboardListViewController.swift b/Presentation/Presentation/Sources/WhiteboardList/View/WhiteboardListViewController.swift index 28edaf0..4e63780 100644 --- a/Presentation/Presentation/Sources/WhiteboardList/View/WhiteboardListViewController.swift +++ b/Presentation/Presentation/Sources/WhiteboardList/View/WhiteboardListViewController.swift @@ -69,6 +69,7 @@ public final class WhiteboardListViewController: UIViewController { private let drawObjectUseCase: DrawObjectUseCaseInterface private let textObjectUseCase: TextObjectUseCaseInterface private let chatUseCase: ChatUseCaseInterface + private let gameRepository: GameRepositoryInterface private let gameObjectUseCase: GameObjectUseCaseInterface private let manageWhiteboardToolUseCase: ManageWhiteboardToolUseCaseInterface private let manageWhiteboardObjectUseCase: ManageWhiteboardObjectUseCaseInterface @@ -83,6 +84,7 @@ public final class WhiteboardListViewController: UIViewController { drawObjectUseCase: DrawObjectUseCaseInterface, textObjectUseCase: TextObjectUseCaseInterface, chatUseCase: ChatUseCaseInterface, + gameRepository: GameRepositoryInterface, gameObjectUseCase: GameObjectUseCaseInterface, manageWhiteboardToolUseCase: ManageWhiteboardToolUseCaseInterface, manageWhiteboardObjectUseCase: ManageWhiteboardObjectUseCaseInterface @@ -96,6 +98,7 @@ public final class WhiteboardListViewController: UIViewController { self.drawObjectUseCase = drawObjectUseCase self.textObjectUseCase = textObjectUseCase self.chatUseCase = chatUseCase + self.gameRepository = gameRepository self.gameObjectUseCase = gameObjectUseCase self.manageWhiteboardToolUseCase = manageWhiteboardToolUseCase self.manageWhiteboardObjectUseCase = manageWhiteboardObjectUseCase @@ -138,6 +141,7 @@ public final class WhiteboardListViewController: UIViewController { let drawObjectUseCase = self?.drawObjectUseCase, let textObjectUseCase = self?.textObjectUseCase, let chatUseCase = self?.chatUseCase, + let gameRepository = self?.gameRepository, let gameObjectUseCase = self?.gameObjectUseCase, let manageWhiteboardToolUseCase = self?.manageWhiteboardToolUseCase, let manageWhiteboardObjectUseCase = self?.manageWhiteboardObjectUseCase @@ -156,7 +160,8 @@ public final class WhiteboardListViewController: UIViewController { viewModel: whiteboardViewModel, objectViewFactory: whiteboardObjectViewFactory, profileRepository: profileRepository, - chatUseCase: chatUseCase) + chatUseCase: chatUseCase, + gameRepository: gameRepository) self?.navigationController?.isNavigationBarHidden = false self?.navigationController?.pushViewController(whiteboardViewController, animated: true) } @@ -326,7 +331,8 @@ extension WhiteboardListViewController: UICollectionViewDelegate { viewModel: whiteboardViewModel, objectViewFactory: whiteboardObjectViewFactory, profileRepository: profileRepository, - chatUseCase: chatUseCase) + chatUseCase: chatUseCase, + gameRepository: gameRepository) self.navigationController?.isNavigationBarHidden = false self.navigationController?.pushViewController(whiteboardViewController, animated: true) }