From 42619a7ff324cf2b386fcc8900ae68e66862e712 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:31:25 +0900 Subject: [PATCH 01/22] =?UTF-8?q?[fix]=20#49=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eSetupView.swift => ProfileCreateViewController.swift} | 8 ++++---- ...leInputView.swift => ProfileInputViewController.swift} | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) rename SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/{ProfileSetupView.swift => ProfileCreateViewController.swift} (96%) rename SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/{ProfileInputView.swift => ProfileInputViewController.swift} (98%) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileSetupView.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift similarity index 96% rename from SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileSetupView.swift rename to SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift index 8c00fcb..f21eea8 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileSetupView.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift @@ -8,7 +8,7 @@ import UIKit import PhotosUI -final class ProfileSetupView: UIViewController { +final class ProfileCreateViewController: UIViewController { private var titleLabel: UILabel = { let label = UILabel() label.text = Context.mainTitle @@ -61,7 +61,7 @@ final class ProfileSetupView: UIViewController { } } -private extension ProfileSetupView { +private extension ProfileCreateViewController { enum Context { static let submitBtnTitle: String = "등록 완료" static let placeholder: String = "닉네임을 입력해주세요." @@ -130,7 +130,7 @@ private extension ProfileSetupView { } } -extension ProfileSetupView: PHPickerViewControllerDelegate { +extension ProfileCreateViewController: PHPickerViewControllerDelegate { func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { picker.dismiss(animated: true, completion: nil) let itemProvider = results.first?.itemProvider @@ -146,7 +146,7 @@ extension ProfileSetupView: PHPickerViewControllerDelegate { } } -extension ProfileSetupView: UITextFieldDelegate { +extension ProfileCreateViewController: UITextFieldDelegate { func textFieldDidChangeSelection(_ textField: UITextField) { submitButton.isEnabled = (textField.text?.count ?? 0 > 1) } diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputView.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift similarity index 98% rename from SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputView.swift rename to SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift index 742d7ad..8a27ab1 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputView.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift @@ -7,7 +7,7 @@ import UIKit -final class ProfileInputView: UIViewController { +final class ProfileInputViewController: UIViewController { private var titleLabel: UILabel = { let label = UILabel() label.text = Context.titleLabel @@ -58,7 +58,7 @@ final class ProfileInputView: UIViewController { } } -private extension ProfileInputView { +private extension ProfileInputViewController { enum Context { static let nextBtnTitle: String = "다음으로" static let titleLabel: String = "반가워요!\n당신의 반려견을 소개해주세요." @@ -169,7 +169,7 @@ private extension ProfileInputView { } } -extension ProfileInputView: UITextFieldDelegate { +extension ProfileInputViewController: UITextFieldDelegate { @objc private func textFieldDidChange(_ textField: UITextField) { updateNextButtonState() } From 858af8230adcfe654fa704a05dfcc4e2ac997d0c Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:49:09 +0900 Subject: [PATCH 02/22] =?UTF-8?q?[feat]=20#49=20Scene=EC=97=90=20=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1번째 반려견 정보 입력화면과 2번쨰 반려견 정보 입력화면에 필요한 데이터가 달라 엔티티로 따로 구분했다. --- .../Auth/CreateProfile/Entity/Dog.swift | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift new file mode 100644 index 0000000..d5c6015 --- /dev/null +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift @@ -0,0 +1,40 @@ +// +// DogDTO.swift +// SniffMeet +// +// Created by 윤지성 on 11/14/24. +// +import Foundation + +//. dog(name, age, size, keyword, nickname, image) +struct DogDetailInfo { + let name: String + let age: UInt8 + let size: Size + let keywords: [Keyword] +} + +enum Size { + case superSmall + case small + case medium + case big +} + +enum Keyword: String { + case energetic = "활발한" + case smart = "똑똑한" + case active = "적극적인" + case shy = "소심한" + case independent = "독립적인" +} + + +struct Dog { + let name: String + let age: UInt8 + let size: Size + let keywords: [Keyword] + let nickname: String + let profileImage: Data +} From 63985ae8491dad46c871de33e9718e3b980dc70b Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:50:20 +0900 Subject: [PATCH 03/22] =?UTF-8?q?[feat]=20#49=20ProfileInputViewable=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=86=A0=EC=BD=9C=20=EC=83=9D=EC=84=B1,=20Pr?= =?UTF-8?q?ofileInputViewController=EC=9D=B4=20=ED=95=B4=EB=8B=B9=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=86=A0=EC=BD=9C=20=EC=B1=84=ED=83=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ProfileInputViewable 프로토콜은 presenter을 가지고 있습니다. --- .../CreateProfile/View/ProfileInputViewController.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift index 8a27ab1..046de16 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift @@ -7,7 +7,13 @@ import UIKit -final class ProfileInputViewController: UIViewController { +protocol ProfileInputViewable: AnyObject { + var presenter: ProfileInputPresentable? { get set } +} + +final class ProfileInputViewController: UIViewController, ProfileInputViewable { + var presenter: ProfileInputPresentable? + private var titleLabel: UILabel = { let label = UILabel() label.text = Context.titleLabel From 492e94dce8b7f6211f092931875adfdc65f0960b Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:51:22 +0900 Subject: [PATCH 04/22] =?UTF-8?q?[add]=20#49=20ProfileInputPresentable=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1,=20=ED=95=B4=EB=8B=B9=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=86=A0=EC=BD=9C=EC=9D=84=20=EC=B1=84=ED=83=9D=ED=95=98?= =?UTF-8?q?=EB=8A=94=20ProfileInputPresenter=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presenter/ProfileInputPresenter.swift | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileInputPresenter.swift diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileInputPresenter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileInputPresenter.swift new file mode 100644 index 0000000..d5d2534 --- /dev/null +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileInputPresenter.swift @@ -0,0 +1,22 @@ +// +// ProfileInputPresenter.swift +// SniffMeet +// +// Created by 윤지성 on 11/14/24. +// + +protocol ProfileInputPresentable { + var view: ProfileInputViewable? { get set } + var router: ProfileInputRoutable? { get set } + func moveToProfileCreateView() +} + + +final class ProfileInputPresenter: ProfileInputPresentable { + weak var view: ProfileInputViewable? + var router: ProfileInputRoutable? + + func moveToProfileCreateView() { + + } +} From 4d595c903df95eaa484efc0e9e58a86cefed0ac1 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:53:17 +0900 Subject: [PATCH 05/22] =?UTF-8?q?[feat]=20#49=20ProfileInputRoutable=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=86=A0=EC=BD=9C=20=EC=84=A0=EC=96=B8,=20?= =?UTF-8?q?=EB=B0=98=EB=A0=A4=EA=B2=AC=20=EC=A0=95=EB=B3=B4=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=20Scene=20=EB=AA=A8=EB=93=88=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20=EA=B5=AC=ED=98=84=20?= =?UTF-8?q?=EB=B0=8F=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - --- .../SniffMeet/Source/App/AppRouter.swift | 5 ++-- .../Router/ProfileInputRouter.swift | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift diff --git a/SniffMeet/SniffMeet/Source/App/AppRouter.swift b/SniffMeet/SniffMeet/Source/App/AppRouter.swift index 4b32492..721afcf 100644 --- a/SniffMeet/SniffMeet/Source/App/AppRouter.swift +++ b/SniffMeet/SniffMeet/Source/App/AppRouter.swift @@ -32,8 +32,9 @@ final class AppRouter { window?.makeKeyAndVisible() } private func displayProfileSetupView() { - let profileViewController = ProfileInputView() - window?.rootViewController = profileViewController + let navigationController = + UINavigationController(rootViewController: ProfileInputRouter.createProfileInputModule()) + window?.rootViewController = navigationController window?.makeKeyAndVisible() } } diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift new file mode 100644 index 0000000..89f2d10 --- /dev/null +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift @@ -0,0 +1,30 @@ +// +// Untitled.swift +// SniffMeet +// +// Created by 윤지성 on 11/14/24. +// +import UIKit + +protocol ProfileInputRoutable { + static func createProfileInputModule() -> UIViewController + func navigateToNextScreen() +} + +final class ProfileInputRouter: ProfileInputRoutable { + static func createProfileInputModule() -> UIViewController { + let view: ProfileInputViewable & UIViewController = ProfileInputViewController() + var presenter: ProfileInputPresentable = ProfileInputPresenter() + let router: ProfileInputRoutable = ProfileInputRouter() + + view.presenter = presenter + presenter.view = view + presenter.router = router + + return view + } + + func navigateToNextScreen() { + + } +} From c9c3d3e4e1c9257436c1c0c92b6126676cb4d5fa Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:53:53 +0900 Subject: [PATCH 06/22] =?UTF-8?q?[fix]=20#49=20viewcontroller=20extension?= =?UTF-8?q?=EC=97=90=20=EC=9E=91=EC=84=B1=EB=90=9C=20=EB=A7=8C=ED=81=BC=20?= =?UTF-8?q?=EC=9D=BC=EA=B4=84=20=EC=A0=81=EC=9A=A9=ED=95=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8F=84=EB=A1=9D=20self=EB=A1=9C=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 --- SniffMeet/SniffMeet/Source/Common/Extension + Keyboard.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SniffMeet/SniffMeet/Source/Common/Extension + Keyboard.swift b/SniffMeet/SniffMeet/Source/Common/Extension + Keyboard.swift index 878d7ca..2991ba9 100644 --- a/SniffMeet/SniffMeet/Source/Common/Extension + Keyboard.swift +++ b/SniffMeet/SniffMeet/Source/Common/Extension + Keyboard.swift @@ -10,7 +10,7 @@ import UIKit extension UIViewController { func hideKeyboardWhenTappedAround() { let tap = UITapGestureRecognizer(target: self, - action: #selector(ProfileInputView.dismissKeyboard)) + action: #selector(self.dismissKeyboard)) tap.cancelsTouchesInView = false view.addGestureRecognizer(tap) } From 1dc47d6a6f8b5afb4b02fde7f36c110d25f1319f Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:15:28 +0900 Subject: [PATCH 07/22] =?UTF-8?q?[feat]=20#49=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84,=20=EC=82=AC=EC=A7=84=20=EB=93=B1=EB=A1=9D=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20Viper=20=ED=8C=A8=ED=84=B4=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProfileCreateInteractable.swift | 14 +++++++++++ .../Presenter/ProfileSetupPresenter.swift | 24 +++++++++++++++++++ .../View/ProfileCreateViewController.swift | 10 ++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift create mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileSetupPresenter.swift diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift new file mode 100644 index 0000000..48c9cf6 --- /dev/null +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift @@ -0,0 +1,14 @@ +// +// ProfileCreateInteractable.swift +// SniffMeet +// +// Created by 윤지성 on 11/14/24. +// + +protocol ProfileCreateInteractable: AnyObject { + var presenter: ProfileCreatePresentable? { get set } +} + +final class ProfileCreateInteractor: ProfileCreateInteractable { + weak var presenter: ProfileCreatePresentable? +} diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileSetupPresenter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileSetupPresenter.swift new file mode 100644 index 0000000..1129d74 --- /dev/null +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileSetupPresenter.swift @@ -0,0 +1,24 @@ +// +// ProfileSetupPresenter.swift +// SniffMeet +// +// Created by 윤지성 on 11/14/24. +// + +protocol ProfileCreatePresentable : AnyObject{ + var view: ProfileCreateViewable? { get set } + var interactor: ProfileCreateInteractable? { get set } + var router: ProfileCreateRoutable? { get set } + + func saveDogInfo(newDog: Dog) +} + +final class ProfileCreatePresenter: ProfileCreatePresentable { + weak var view: ProfileCreateViewable? + var interactor: ProfileCreateInteractable? + var router: ProfileCreateRoutable? + + func saveDogInfo(newDog: Dog) { + + } +} diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift index f21eea8..d3e29fc 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift @@ -5,10 +5,16 @@ // Created by 윤지성 on 11/9/24. // -import UIKit import PhotosUI +import UIKit + +protocol ProfileCreateViewable: AnyObject { + var presenter: ProfileCreatePresentable? { get set } +} -final class ProfileCreateViewController: UIViewController { +final class ProfileCreateViewController: UIViewController, ProfileCreateViewable { + var presenter: ProfileCreatePresentable? + private var titleLabel: UILabel = { let label = UILabel() label.text = Context.mainTitle From 8b03fc387b40a0bcd382080c28ab4c2f1c8c08e8 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:17:59 +0900 Subject: [PATCH 08/22] =?UTF-8?q?[feat]=20#49=20ProfileCreateRouter=20?= =?UTF-8?q?=EC=84=B8=ED=8C=85=20=EB=B0=8F=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=82=AC=EC=A7=84=20=EB=B0=8F=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=ED=99=94=EB=A9=B4=20=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=ED=95=A8=EC=88=98=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Router/ProfileCreateRouter.swift | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift new file mode 100644 index 0000000..54a2391 --- /dev/null +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift @@ -0,0 +1,33 @@ +// +// ProfileCreateRouter.swift +// SniffMeet +// +// Created by 윤지성 on 11/14/24. +// +import UIKit + +protocol ProfileCreateRoutable { + static func createProfileCreateModule() -> UIViewController + func presentMainScreen(from view: ProfileCreateViewable) +} + +final class ProfileCreateRouter: ProfileCreateRoutable { + static func createProfileCreateModule() -> UIViewController { + let view: ProfileCreateViewable & UIViewController = ProfileCreateViewController() + var presenter: ProfileCreatePresentable = ProfileCreatePresenter() + let interactor: ProfileCreateInteractable = ProfileCreateInteractor() + let router: ProfileCreateRoutable = ProfileCreateRouter() + + view.presenter = presenter + presenter.view = view + presenter.router = router + presenter.interactor = interactor + interactor.presenter = presenter + + return view + } + + func presentMainScreen(from view: any ProfileCreateViewable) { + + } +} From b6fac464280bacae74ec3f327188c4d7f9a45446 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:31:45 +0900 Subject: [PATCH 09/22] =?UTF-8?q?[fix]=20#49=20=ED=8C=8C=EC=9D=BC=EB=AA=85?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{ProfileSetupPresenter.swift => ProfileCreatePresenter.swift} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/{ProfileSetupPresenter.swift => ProfileCreatePresenter.swift} (100%) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileSetupPresenter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileCreatePresenter.swift similarity index 100% rename from SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileSetupPresenter.swift rename to SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileCreatePresenter.swift From 0891b7d8254c1c79a9b1fdb5364b4ecd36af3ab2 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:39:56 +0900 Subject: [PATCH 10/22] =?UTF-8?q?[feat]=20#49=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=A0=84=ED=99=98=20=EB=B0=8F=20=ED=99=94=EB=A9=B4=20=EA=B0=84?= =?UTF-8?q?=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EA=B3=B5=EC=9C=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 닉네임 및 프로필 사진 등록 Scene에서는 interactor만 그 전 화면에서 얻은 데이터를 알게끔 구현했습니다. --- .../Interactor/ProfileCreateInteractable.swift | 2 ++ .../Presenter/ProfileInputPresenter.swift | 7 ++++--- .../CreateProfile/Router/ProfileCreateRouter.swift | 6 ++++-- .../CreateProfile/Router/ProfileInputRouter.swift | 12 +++++++++--- .../View/ProfileInputViewController.swift | 13 +++++++++++++ 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift index 48c9cf6..a4f8f76 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift @@ -6,9 +6,11 @@ // protocol ProfileCreateInteractable: AnyObject { + var dogDetailInfo: DogDetailInfo? { get set } var presenter: ProfileCreatePresentable? { get set } } final class ProfileCreateInteractor: ProfileCreateInteractable { + var dogDetailInfo: DogDetailInfo? weak var presenter: ProfileCreatePresentable? } diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileInputPresenter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileInputPresenter.swift index d5d2534..fc045df 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileInputPresenter.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileInputPresenter.swift @@ -8,7 +8,7 @@ protocol ProfileInputPresentable { var view: ProfileInputViewable? { get set } var router: ProfileInputRoutable? { get set } - func moveToProfileCreateView() + func moveToProfileCreateView(with newDogDetailInfo: DogDetailInfo) } @@ -16,7 +16,8 @@ final class ProfileInputPresenter: ProfileInputPresentable { weak var view: ProfileInputViewable? var router: ProfileInputRoutable? - func moveToProfileCreateView() { - + func moveToProfileCreateView(with newDogDetailInfo: DogDetailInfo) { + guard let view else { return } + router?.presentPostCreateScreen(from: view, with: newDogDetailInfo) } } diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift index 54a2391..6d79f99 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift @@ -7,12 +7,12 @@ import UIKit protocol ProfileCreateRoutable { - static func createProfileCreateModule() -> UIViewController + static func createProfileCreateModule(dogDetailInfo: DogDetailInfo) -> UIViewController func presentMainScreen(from view: ProfileCreateViewable) } final class ProfileCreateRouter: ProfileCreateRoutable { - static func createProfileCreateModule() -> UIViewController { + static func createProfileCreateModule(dogDetailInfo: DogDetailInfo) -> UIViewController { let view: ProfileCreateViewable & UIViewController = ProfileCreateViewController() var presenter: ProfileCreatePresentable = ProfileCreatePresenter() let interactor: ProfileCreateInteractable = ProfileCreateInteractor() @@ -23,6 +23,8 @@ final class ProfileCreateRouter: ProfileCreateRoutable { presenter.router = router presenter.interactor = interactor interactor.presenter = presenter + interactor.dogDetailInfo = dogDetailInfo + print("전달완료: \(dogDetailInfo)") return view } diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift index 89f2d10..c73ef80 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift @@ -8,7 +8,7 @@ import UIKit protocol ProfileInputRoutable { static func createProfileInputModule() -> UIViewController - func navigateToNextScreen() + func presentPostCreateScreen(from view: ProfileInputViewable, with dogDetail: DogDetailInfo) } final class ProfileInputRouter: ProfileInputRoutable { @@ -24,7 +24,13 @@ final class ProfileInputRouter: ProfileInputRoutable { return view } - func navigateToNextScreen() { - + func presentPostCreateScreen(from view: ProfileInputViewable, with dogDetail: DogDetailInfo) { + let profileCreateViewController = + ProfileCreateRouter.createProfileCreateModule(dogDetailInfo: dogDetail) + + if let sourceView = view as? UIViewController { + sourceView.navigationController?.pushViewController(profileCreateViewController, + animated: true) + } } } diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift index 046de16..ae3d67c 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift @@ -61,6 +61,19 @@ final class ProfileInputViewController: UIViewController, ProfileInputViewable { for: .editingChanged) ageTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) + + setButtonAction() + } + + func setButtonAction() { + nextButton.addAction(UIAction { [weak self] _ in + guard let name = self?.nameTextField.text, + let ageText = self?.ageTextField.text, + let age = Int(ageText) else { return } + + let dogInfo = DogDetailInfo(name: name, age: UInt8(age), size: .small, keywords: [.active]) + self?.presenter?.moveToProfileCreateView(with: dogInfo) + }, for: .touchUpInside) } } From 401d12005c983816b01b46dffaa1d4d7299ef371 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:56:16 +0900 Subject: [PATCH 11/22] =?UTF-8?q?[feat]=20#49=20Codable=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=86=A0=EC=BD=9C=20=EC=B1=84=ED=83=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift index d5c6015..7efd81a 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift @@ -6,7 +6,6 @@ // import Foundation -//. dog(name, age, size, keyword, nickname, image) struct DogDetailInfo { let name: String let age: UInt8 @@ -14,14 +13,14 @@ struct DogDetailInfo { let keywords: [Keyword] } -enum Size { +enum Size: Codable { case superSmall case small case medium case big } -enum Keyword: String { +enum Keyword: String, Codable { case energetic = "활발한" case smart = "똑똑한" case active = "적극적인" @@ -30,11 +29,11 @@ enum Keyword: String { } -struct Dog { +struct Dog: Codable { let name: String let age: UInt8 let size: Size let keywords: [Keyword] let nickname: String - let profileImage: Data + let profileImage: Data? } From 5672cbef1b1a4a202a2ce60dfe2b5a1aeb0abe2b Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:57:34 +0900 Subject: [PATCH 12/22] =?UTF-8?q?[feat]=20#49=20=EB=B0=98=EB=A0=A4?= =?UTF-8?q?=EA=B2=AC=20=EC=A0=95=EB=B3=B4=20=EC=A0=9C=EC=B6=9C=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=95=A1=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/ProfileCreateViewController.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift index d3e29fc..2fa4eaf 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileCreateViewController.swift @@ -71,7 +71,7 @@ private extension ProfileCreateViewController { enum Context { static let submitBtnTitle: String = "등록 완료" static let placeholder: String = "닉네임을 입력해주세요." - static let mainTitle: String = "마지막으로,\n사진과 닉네임을 등록해주세요." + static let mainTitle: String = "마지막으로,\n반려견 사진과 닉네임을 등록해주세요." static let horizontalPadding: CGFloat = 24 static let imageViewSize: CGFloat = 140 static let addPhotoButtonSize: CGFloat = 44 @@ -121,18 +121,26 @@ private extension ProfileCreateViewController { constant: Context.horizontalPadding), submitButton.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -Context.horizontalPadding), - submitButton.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -32) + submitButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -32) ]) } func setDelegate() { picker.delegate = self nicknameTextField.delegate = self } + func setButtonAction() { addPhotoButton.addAction(UIAction { [weak self] _ in guard let picker = self?.picker else { return } self?.present(picker, animated: true, completion: nil) }, for: .touchUpInside) + + submitButton.addAction(UIAction { [weak self] _ in + // approuter를 통해서 화면전환을 수행한다. window를 다르게 설정해야 할듯 + guard let nickname = self?.nicknameTextField.text else { return } + self?.presenter?.saveDogInfo(nickname: nickname, imageData: nil) + + }, for: .touchUpInside) } } From b5f680dd8e7fbb7fb378b18c545e6e7835b19593 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:00:26 +0900 Subject: [PATCH 13/22] =?UTF-8?q?[feat]=20#49=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84=20=EB=B0=8F=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=82=AC?= =?UTF-8?q?=EC=A7=84=20=EB=93=B1=EB=A1=9D=20Scene=EC=9D=98=20Presenter=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 해당 Presenter는 ProfileCreatePresentable, DogInfoInteractorOutput 채택하였다. - ProfileCreatePresentable 프로토콜은 View가 Presenter를 사용하는 부분 - DogInfoInteractorOutput 프로토콜은 Interactor가 Presenter를 사용하는 부분 --- .../Presenter/ProfileCreatePresenter.swift | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileCreatePresenter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileCreatePresenter.swift index 1129d74..6b3a6ef 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileCreatePresenter.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Presenter/ProfileCreatePresenter.swift @@ -4,21 +4,58 @@ // // Created by 윤지성 on 11/14/24. // +import Foundation protocol ProfileCreatePresentable : AnyObject{ + var dogInfo: DogDetailInfo { get set } var view: ProfileCreateViewable? { get set } var interactor: ProfileCreateInteractable? { get set } var router: ProfileCreateRoutable? { get set } - func saveDogInfo(newDog: Dog) + func saveDogInfo(nickname: String, imageData: Data?) } +protocol DogInfoInteractorOutput: AnyObject { + func didSaveDogInfo() + func didFailToSaveDogInfo(error: Error) +} + + final class ProfileCreatePresenter: ProfileCreatePresentable { + var dogInfo: DogDetailInfo weak var view: ProfileCreateViewable? var interactor: ProfileCreateInteractable? var router: ProfileCreateRoutable? - func saveDogInfo(newDog: Dog) { + init(dogInfo: DogDetailInfo, + view: ProfileCreateViewable? = nil, + interactor: ProfileCreateInteractable? = nil, + router: ProfileCreateRoutable? = nil) + { + self.dogInfo = dogInfo + self.view = view + self.interactor = interactor + self.router = router + } + + func saveDogInfo(nickname: String, imageData: Data?) { + interactor?.saveDogInfo(dogInfo: Dog(name: dogInfo.name, + age: dogInfo.age, + size: dogInfo.size, + keywords: dogInfo.keywords, + nickname: nickname, + profileImage: imageData)) } } + +extension ProfileCreatePresenter: DogInfoInteractorOutput { + func didSaveDogInfo() { + guard let view else { return } + router?.presentMainScreen(from: view) + } + + func didFailToSaveDogInfo(error: any Error) { + // TODO: - alert 올리는데 어떻게 올릴지 정하기 + } +} From a2514b88ef34164a13076a7c5b99449111962998 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:01:23 +0900 Subject: [PATCH 14/22] =?UTF-8?q?[feat]=20#49=20=EA=B0=95=EC=95=84?= =?UTF-8?q?=EC=A7=80=20=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=ED=95=98=EB=8A=94=20Usecase=20=ED=94=84=EB=A1=9C=ED=86=A0?= =?UTF-8?q?=EC=BD=9C=20=EB=B0=8F=20=EA=B5=AC=ED=98=84=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interactor/SaveInfoUseCase.swift | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/SaveInfoUseCase.swift diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/SaveInfoUseCase.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/SaveInfoUseCase.swift new file mode 100644 index 0000000..11473d3 --- /dev/null +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/SaveInfoUseCase.swift @@ -0,0 +1,44 @@ +// +// SaveInfoUseCase.swift +// SniffMeet +// +// Created by 윤지성 on 11/14/24. +// +import Foundation + +protocol DataStorable { + func storeData(data: Encodable) throws +} + +// TODO: - dataManager를 주입받을 수 있도록 수정 예정 +final class LocalDataManager: DataStorable { + private let dataManager = UserDefaultsManager(userDefaults: UserDefaults(suiteName: "demo")!, + jsonEncoder: JSONEncoder(), + jsonDecoder: JSONDecoder()) + func storeData(data: any Encodable) throws { + try dataManager.set(value: data, forKey: UserDefaultKey.dogInfo) + } +} + +extension LocalDataManager { + private enum UserDefaultKey { + static let dogInfo: String = "dogInfo" + } +} + +protocol StoreDogInfoUseCase { + func execute(dog: Dog) throws +} + + +final class StoreDogInfoUserCaseImpl: StoreDogInfoUseCase { + let localDataManager: DataStorable + + init(localDataManager: DataStorable) { + self.localDataManager = localDataManager + } + + func execute(dog: Dog) throws { + try localDataManager.storeData(data: dog) + } +} From 3267ad05176ac44797eec0a75c590bdd4e571307 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:02:41 +0900 Subject: [PATCH 15/22] =?UTF-8?q?[feat]=20#49=20ProfileCreateInteractor=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProfileCreateInteractable.swift | 16 ---------- .../Interactor/ProfileCreateInteractor.swift | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+), 16 deletions(-) delete mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift create mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractor.swift diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift deleted file mode 100644 index a4f8f76..0000000 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractable.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// ProfileCreateInteractable.swift -// SniffMeet -// -// Created by 윤지성 on 11/14/24. -// - -protocol ProfileCreateInteractable: AnyObject { - var dogDetailInfo: DogDetailInfo? { get set } - var presenter: ProfileCreatePresentable? { get set } -} - -final class ProfileCreateInteractor: ProfileCreateInteractable { - var dogDetailInfo: DogDetailInfo? - weak var presenter: ProfileCreatePresentable? -} diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractor.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractor.swift new file mode 100644 index 0000000..8968623 --- /dev/null +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/ProfileCreateInteractor.swift @@ -0,0 +1,32 @@ +// +// ProfileCreateInteractable.swift +// SniffMeet +// +// Created by 윤지성 on 11/14/24. +// + +protocol ProfileCreateInteractable: AnyObject { + var presenter: DogInfoInteractorOutput? { get set } + var storeDogInfoUsecase: StoreDogInfoUseCase { get set } + + func saveDogInfo(dogInfo: Dog) +} + +final class ProfileCreateInteractor: ProfileCreateInteractable { + weak var presenter: DogInfoInteractorOutput? + var storeDogInfoUsecase: StoreDogInfoUseCase + + init(presenter: DogInfoInteractorOutput? = nil, usecase: StoreDogInfoUseCase) { + self.presenter = presenter + storeDogInfoUsecase = usecase + } + + func saveDogInfo(dogInfo: Dog) { + do { + try storeDogInfoUsecase.execute(dog: dogInfo) + presenter?.didSaveDogInfo() + } catch (let error){ + presenter?.didFailToSaveDogInfo(error: error) + } + } +} From 6abc8b3080ceed13206aefa85b2a38a93ef8eba6 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:05:16 +0900 Subject: [PATCH 16/22] =?UTF-8?q?[feat]=20#49=20ProfileCreateRouter=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - createProfileCreateModule 수정 - appRouter에 관련 메서드가 없어서 아직 화면전환은 구현하지 못한 상태 --- .../Router/ProfileCreateRouter.swift | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift index 6d79f99..ddb66c9 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift @@ -13,9 +13,14 @@ protocol ProfileCreateRoutable { final class ProfileCreateRouter: ProfileCreateRoutable { static func createProfileCreateModule(dogDetailInfo: DogDetailInfo) -> UIViewController { + let storeDogInfoUsecase: StoreDogInfoUseCase = + StoreDogInfoUserCaseImpl(localDataManager: LocalDataManager()) + let view: ProfileCreateViewable & UIViewController = ProfileCreateViewController() - var presenter: ProfileCreatePresentable = ProfileCreatePresenter() - let interactor: ProfileCreateInteractable = ProfileCreateInteractor() + let presenter: ProfileCreatePresentable & DogInfoInteractorOutput + = ProfileCreatePresenter(dogInfo: dogDetailInfo) + let interactor: ProfileCreateInteractable = + ProfileCreateInteractor(usecase: storeDogInfoUsecase) let router: ProfileCreateRoutable = ProfileCreateRouter() view.presenter = presenter @@ -23,13 +28,13 @@ final class ProfileCreateRouter: ProfileCreateRoutable { presenter.router = router presenter.interactor = interactor interactor.presenter = presenter - interactor.dogDetailInfo = dogDetailInfo - print("전달완료: \(dogDetailInfo)") return view } func presentMainScreen(from view: any ProfileCreateViewable) { - +#if DEBUG + print("여기까지 성공하셨습니다. ") +#endif } } From fcef149fbb298b6675366deaabeac8ad6420ab04 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:05:33 +0900 Subject: [PATCH 17/22] =?UTF-8?q?[chore]=20#49=20.pbxproj=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SniffMeet/SniffMeet.xcodeproj/project.pbxproj | 60 ++++++++++++++----- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/SniffMeet/SniffMeet.xcodeproj/project.pbxproj b/SniffMeet/SniffMeet.xcodeproj/project.pbxproj index ee69744..cac59df 100644 --- a/SniffMeet/SniffMeet.xcodeproj/project.pbxproj +++ b/SniffMeet/SniffMeet.xcodeproj/project.pbxproj @@ -12,7 +12,7 @@ 320043762CDCA18E00D08B6D /* (null) in Sources */ = {isa = PBXBuildFile; }; 320043782CDCA49100D08B6D /* (null) in Sources */ = {isa = PBXBuildFile; }; 3200437C2CDCA6F300D08B6D /* (null) in Sources */ = {isa = PBXBuildFile; }; - 3200438B2CDF3BEF00D08B6D /* ProfileSetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200438A2CDF3BE900D08B6D /* ProfileSetupView.swift */; }; + 3200438B2CDF3BEF00D08B6D /* ProfileCreateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200438A2CDF3BE900D08B6D /* ProfileCreateViewController.swift */; }; 320043912CDF3D7F00D08B6D /* KeywordButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200438E2CDF3D7F00D08B6D /* KeywordButton.swift */; }; 320043922CDF3D7F00D08B6D /* InputTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200438D2CDF3D7F00D08B6D /* InputTextField.swift */; }; 320043932CDF3D7F00D08B6D /* KeywordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200438F2CDF3D7F00D08B6D /* KeywordView.swift */; }; @@ -22,8 +22,15 @@ 3200441A2CE48A3D00D08B6D /* MPCBroswer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320044192CE48A3100D08B6D /* MPCBroswer.swift */; }; 3200441C2CE48C5C00D08B6D /* MPCAdvertiser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200441B2CE48C5600D08B6D /* MPCAdvertiser.swift */; }; 3200441E2CE48D3500D08B6D /* MPConnectionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200441D2CE48D1F00D08B6D /* MPConnectionManager.swift */; }; + 3200444E2CE595EA00D08B6D /* ProfileCreatePresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200444D2CE595DE00D08B6D /* ProfileCreatePresenter.swift */; }; + 320044502CE595F700D08B6D /* ProfileInputPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200444F2CE595F000D08B6D /* ProfileInputPresenter.swift */; }; + 320044532CE59A8A00D08B6D /* Dog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320044522CE59A8100D08B6D /* Dog.swift */; }; + 320044562CE59DF500D08B6D /* ProfileInputRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320044552CE59D5D00D08B6D /* ProfileInputRouter.swift */; }; + 320044582CE5B04C00D08B6D /* ProfileCreateRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320044572CE5B04300D08B6D /* ProfileCreateRouter.swift */; }; + 3200445A2CE5B3AA00D08B6D /* ProfileCreateInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320044592CE5B39A00D08B6D /* ProfileCreateInteractor.swift */; }; + 3200445E2CE5CA1B00D08B6D /* SaveInfoUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200445D2CE5CA1A00D08B6D /* SaveInfoUseCase.swift */; }; 995D94262CE32ECE005A47BF /* Extension + Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 995D94252CE32EC1005A47BF /* Extension + Keyboard.swift */; }; - 99FA4E792CE0FBBF00553C2E /* ProfileInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99FA4E782CE0FBBF00553C2E /* ProfileInputView.swift */; }; + 99FA4E792CE0FBBF00553C2E /* ProfileInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99FA4E782CE0FBBF00553C2E /* ProfileInputViewController.swift */; }; A21435F72CE20D2500564A4D /* TabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A21435F62CE20D2500564A4D /* TabBarController.swift */; }; A288A63D2CDC595000D11C34 /* (null) in Resources */ = {isa = PBXBuildFile; }; A2C328862CE245AC00D255AB /* TabBarModuleBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2C328852CE245AC00D255AB /* TabBarModuleBuilder.swift */; }; @@ -61,7 +68,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 3200438A2CDF3BE900D08B6D /* ProfileSetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileSetupView.swift; sourceTree = ""; }; + 3200438A2CDF3BE900D08B6D /* ProfileCreateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreateViewController.swift; sourceTree = ""; }; 3200438C2CDF3D7F00D08B6D /* Extension + Navigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension + Navigation.swift"; sourceTree = ""; }; 3200438D2CDF3D7F00D08B6D /* InputTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputTextField.swift; sourceTree = ""; }; 3200438E2CDF3D7F00D08B6D /* KeywordButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeywordButton.swift; sourceTree = ""; }; @@ -71,8 +78,15 @@ 320044192CE48A3100D08B6D /* MPCBroswer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPCBroswer.swift; sourceTree = ""; }; 3200441B2CE48C5600D08B6D /* MPCAdvertiser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPCAdvertiser.swift; sourceTree = ""; }; 3200441D2CE48D1F00D08B6D /* MPConnectionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPConnectionManager.swift; sourceTree = ""; }; + 3200444D2CE595DE00D08B6D /* ProfileCreatePresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreatePresenter.swift; sourceTree = ""; }; + 3200444F2CE595F000D08B6D /* ProfileInputPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInputPresenter.swift; sourceTree = ""; }; + 320044522CE59A8100D08B6D /* Dog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dog.swift; sourceTree = ""; }; + 320044552CE59D5D00D08B6D /* ProfileInputRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInputRouter.swift; sourceTree = ""; }; + 320044572CE5B04300D08B6D /* ProfileCreateRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreateRouter.swift; sourceTree = ""; }; + 320044592CE5B39A00D08B6D /* ProfileCreateInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreateInteractor.swift; sourceTree = ""; }; + 3200445D2CE5CA1A00D08B6D /* SaveInfoUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SaveInfoUseCase.swift; sourceTree = ""; }; 995D94252CE32EC1005A47BF /* Extension + Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension + Keyboard.swift"; sourceTree = ""; }; - 99FA4E782CE0FBBF00553C2E /* ProfileInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInputView.swift; sourceTree = ""; }; + 99FA4E782CE0FBBF00553C2E /* ProfileInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInputViewController.swift; sourceTree = ""; }; A21435F62CE20D2500564A4D /* TabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = ""; }; A2C328852CE245AC00D255AB /* TabBarModuleBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarModuleBuilder.swift; sourceTree = ""; }; A2C328872CE2481900D255AB /* HomeModuleBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeModuleBuilder.swift; sourceTree = ""; }; @@ -133,6 +147,14 @@ path = MPC; sourceTree = ""; }; + 320044512CE5995F00D08B6D /* Entity */ = { + isa = PBXGroup; + children = ( + 320044522CE59A8100D08B6D /* Dog.swift */, + ); + path = Entity; + sourceTree = ""; + }; A21435F52CE20CF600564A4D /* Tab */ = { isa = PBXGroup; children = ( @@ -583,7 +605,7 @@ FDA491682CDA7C0300A36FB0 /* View */, FDA491662CDA7BE500A36FB0 /* Interactor */, FDA491642CDA7BD600A36FB0 /* Presenter */, - FDA491652CDA7BDF00A36FB0 /* Entity */, + 320044512CE5995F00D08B6D /* Entity */, FDA491672CDA7BEB00A36FB0 /* Router */, ); path = CreateProfile; @@ -635,20 +657,17 @@ FDA491642CDA7BD600A36FB0 /* Presenter */ = { isa = PBXGroup; children = ( + 3200444F2CE595F000D08B6D /* ProfileInputPresenter.swift */, + 3200444D2CE595DE00D08B6D /* ProfileCreatePresenter.swift */, ); path = Presenter; sourceTree = ""; }; - FDA491652CDA7BDF00A36FB0 /* Entity */ = { - isa = PBXGroup; - children = ( - ); - path = Entity; - sourceTree = ""; - }; FDA491662CDA7BE500A36FB0 /* Interactor */ = { isa = PBXGroup; children = ( + 320044592CE5B39A00D08B6D /* ProfileCreateInteractor.swift */, + 3200445D2CE5CA1A00D08B6D /* SaveInfoUseCase.swift */, ); path = Interactor; sourceTree = ""; @@ -656,6 +675,8 @@ FDA491672CDA7BEB00A36FB0 /* Router */ = { isa = PBXGroup; children = ( + 320044552CE59D5D00D08B6D /* ProfileInputRouter.swift */, + 320044572CE5B04300D08B6D /* ProfileCreateRouter.swift */, ); path = Router; sourceTree = ""; @@ -663,8 +684,8 @@ FDA491682CDA7C0300A36FB0 /* View */ = { isa = PBXGroup; children = ( - 99FA4E782CE0FBBF00553C2E /* ProfileInputView.swift */, - 3200438A2CDF3BE900D08B6D /* ProfileSetupView.swift */, + 99FA4E782CE0FBBF00553C2E /* ProfileInputViewController.swift */, + 3200438A2CDF3BE900D08B6D /* ProfileCreateViewController.swift */, ); path = View; sourceTree = ""; @@ -1075,9 +1096,11 @@ files = ( FDBFA9A12CE1E51500AA9220 /* SNMColor.swift in Sources */, A2C844D12CDBE1E5007F2970 /* (null) in Sources */, + 3200444E2CE595EA00D08B6D /* ProfileCreatePresenter.swift in Sources */, FD3A03422CD8CF460047B7ED /* AppDelegate.swift in Sources */, FD3A03432CD8CF460047B7ED /* SceneDelegate.swift in Sources */, - 99FA4E792CE0FBBF00553C2E /* ProfileInputView.swift in Sources */, + 99FA4E792CE0FBBF00553C2E /* ProfileInputViewController.swift in Sources */, + 320044582CE5B04C00D08B6D /* ProfileCreateRouter.swift in Sources */, FDEAEA7C2CE314A7005890FA /* BaseViewController.swift in Sources */, A21435F72CE20D2500564A4D /* TabBarController.swift in Sources */, 320043762CDCA18E00D08B6D /* (null) in Sources */, @@ -1087,17 +1110,21 @@ 3200441C2CE48C5C00D08B6D /* MPCAdvertiser.swift in Sources */, A2F825D12CDF4BA6000C5419 /* HomeViewController.swift in Sources */, 320043972CDF493C00D08B6D /* Extension + UIView.swift in Sources */, + 320044502CE595F700D08B6D /* ProfileInputPresenter.swift in Sources */, FD69B1B32CE3BC76009D71DC /* KeychainManager.swift in Sources */, 320043782CDCA49100D08B6D /* (null) in Sources */, FDBFA9B12CE1FE5500AA9220 /* LayoutConstant.swift in Sources */, 320043912CDF3D7F00D08B6D /* KeywordButton.swift in Sources */, 320043922CDF3D7F00D08B6D /* InputTextField.swift in Sources */, 320043932CDF3D7F00D08B6D /* KeywordView.swift in Sources */, + 3200445E2CE5CA1B00D08B6D /* SaveInfoUseCase.swift in Sources */, 320043942CDF3D7F00D08B6D /* PrimaryButton.swift in Sources */, 320043952CDF3D7F00D08B6D /* Extension + Navigation.swift in Sources */, FDBFA99F2CE1E50C00AA9220 /* SNMFont.swift in Sources */, + 320044532CE59A8A00D08B6D /* Dog.swift in Sources */, + 320044562CE59DF500D08B6D /* ProfileInputRouter.swift in Sources */, A2C844D72CDBEF8B007F2970 /* (null) in Sources */, - 3200438B2CDF3BEF00D08B6D /* ProfileSetupView.swift in Sources */, + 3200438B2CDF3BEF00D08B6D /* ProfileCreateViewController.swift in Sources */, FDEAEA7A2CE3148D005890FA /* BaseView.swift in Sources */, A2C328862CE245AC00D255AB /* TabBarModuleBuilder.swift in Sources */, FD69B1B52CE3BC7E009D71DC /* UserDefaultsManager.swift in Sources */, @@ -1105,6 +1132,7 @@ 3200441E2CE48D3500D08B6D /* MPConnectionManager.swift in Sources */, 3200441A2CE48A3D00D08B6D /* MPCBroswer.swift in Sources */, 3200437C2CDCA6F300D08B6D /* (null) in Sources */, + 3200445A2CE5B3AA00D08B6D /* ProfileCreateInteractor.swift in Sources */, A2C328922CE3BEA000D255AB /* AppRouter.swift in Sources */, 320043702CDC9A0D00D08B6D /* (null) in Sources */, ); From 6ab540df7ada17e5692ce1a520065b3bc37a22a6 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:58:57 +0900 Subject: [PATCH 18/22] =?UTF-8?q?[feat]=20#52=20=EB=B0=98=EB=A0=A4?= =?UTF-8?q?=EA=B2=AC=20=EC=A0=95=EB=B3=B4=20=EC=9E=85=EB=A0=A5=20=ED=9B=84?= =?UTF-8?q?=20=ED=99=88=20=ED=99=94=EB=A9=B4=EC=9C=BC=EB=A1=9C=20=EC=A0=84?= =?UTF-8?q?=ED=99=98=EB=90=98=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SniffMeet/SniffMeet/Source/App/AppRouter.swift | 13 ++++++++++--- SniffMeet/SniffMeet/Source/App/SceneDelegate.swift | 10 ++++------ .../CreateProfile/Router/ProfileCreateRouter.swift | 10 +++++++--- .../Source/Home/Main/HomeModuleBuilder.swift | 4 ++-- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/SniffMeet/SniffMeet/Source/App/AppRouter.swift b/SniffMeet/SniffMeet/Source/App/AppRouter.swift index 721afcf..33c5873 100644 --- a/SniffMeet/SniffMeet/Source/App/AppRouter.swift +++ b/SniffMeet/SniffMeet/Source/App/AppRouter.swift @@ -13,8 +13,6 @@ final class AppRouter { init(window: UIWindow?) { self.window = window } - - // 첫 화면을 뭘 보여줄지는 회원 가입 여부에 따라 앱 플로우가 다르므로, UIWindow를 이용해야 합니다. func displayInitialScreen(isLoggedIn: Bool) { if isLoggedIn { displayTabBar() @@ -24,7 +22,7 @@ final class AppRouter { } private func displayTabBar() { let submodules = ( - home: HomeModuleBuilder.build(), + home: UINavigationController(rootViewController: HomeModuleBuilder.build()), walk: UIViewController(), mate: UIViewController() ) @@ -37,4 +35,13 @@ final class AppRouter { window?.rootViewController = navigationController window?.makeKeyAndVisible() } + + func moveToHomeScreen() { + let submodules = ( + home: UINavigationController(rootViewController: HomeModuleBuilder.build()), + walk: UIViewController(), + mate: UIViewController() + ) + window?.rootViewController = TabBarModuleBuilder.build(usingSubmodules: submodules) + } } diff --git a/SniffMeet/SniffMeet/Source/App/SceneDelegate.swift b/SniffMeet/SniffMeet/Source/App/SceneDelegate.swift index 3a0f8f0..395d7b7 100644 --- a/SniffMeet/SniffMeet/Source/App/SceneDelegate.swift +++ b/SniffMeet/SniffMeet/Source/App/SceneDelegate.swift @@ -17,12 +17,10 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate { options connectionOptions: UIScene.ConnectionOptions ) { guard let windowScene = (scene as? UIWindowScene) else { return } - let window = UIWindow(windowScene: windowScene) - let appRouter = AppRouter(window: window) - self.window = window - self.appRouter = appRouter + + window = UIWindow(windowScene: windowScene) + appRouter = AppRouter(window: window) - appRouter.displayInitialScreen(isLoggedIn: true) - window.makeKeyAndVisible() + appRouter?.displayInitialScreen(isLoggedIn: false) } } diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift index ddb66c9..6e6a8b5 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift @@ -33,8 +33,12 @@ final class ProfileCreateRouter: ProfileCreateRoutable { } func presentMainScreen(from view: any ProfileCreateViewable) { -#if DEBUG - print("여기까지 성공하셨습니다. ") -#endif + if let sceneDelegate = UIApplication.shared.connectedScenes + .first(where: { $0.activationState == .foregroundActive })? + .delegate as? SceneDelegate { + if let router = sceneDelegate.appRouter { + router.moveToHomeScreen() + } + } } } diff --git a/SniffMeet/SniffMeet/Source/Home/Main/HomeModuleBuilder.swift b/SniffMeet/SniffMeet/Source/Home/Main/HomeModuleBuilder.swift index e036b77..493fbdd 100644 --- a/SniffMeet/SniffMeet/Source/Home/Main/HomeModuleBuilder.swift +++ b/SniffMeet/SniffMeet/Source/Home/Main/HomeModuleBuilder.swift @@ -8,7 +8,7 @@ import UIKit enum HomeModuleBuilder { - static func build() -> UINavigationController { + static func build() -> UIViewController { let view = HomeViewController() view.title = "SniffMeet" @@ -16,6 +16,6 @@ enum HomeModuleBuilder { // let interactor = HomeInteractor() // view.presenter = HomePresenter(view: view, router: router, interactor: interactor) - return UINavigationController(rootViewController: view) + return view } } From c14b9a8423e1d60cee308878d8b352d7d4cb8238 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 20:16:41 +0900 Subject: [PATCH 19/22] =?UTF-8?q?[fix]=20#52=20keyword=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20case=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift | 3 +-- .../Auth/CreateProfile/View/ProfileInputViewController.swift | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift index 7efd81a..0beee7f 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift @@ -14,7 +14,6 @@ struct DogDetailInfo { } enum Size: Codable { - case superSmall case small case medium case big @@ -23,7 +22,7 @@ enum Size: Codable { enum Keyword: String, Codable { case energetic = "활발한" case smart = "똑똑한" - case active = "적극적인" + case friendly = "친화력 좋은" case shy = "소심한" case independent = "독립적인" } diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift index ae3d67c..73eea1d 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/View/ProfileInputViewController.swift @@ -71,7 +71,10 @@ final class ProfileInputViewController: UIViewController, ProfileInputViewable { let ageText = self?.ageTextField.text, let age = Int(ageText) else { return } - let dogInfo = DogDetailInfo(name: name, age: UInt8(age), size: .small, keywords: [.active]) + let dogInfo = DogDetailInfo(name: name, + age: UInt8(age), + size: .small, + keywords: [.energetic]) self?.presenter?.moveToProfileCreateView(with: dogInfo) }, for: .touchUpInside) } From eb1b29ae23080ab31c7610471aabd97854e735f3 Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 20:17:45 +0900 Subject: [PATCH 20/22] =?UTF-8?q?[refactor]=20#52=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=86=A0=EC=BD=9C=20=EB=B6=84=EB=A6=AC=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Router가 Scene 단위의 VIPER 모듈을 생성하는 것과 화면전환 2역할을 수행한다. 따라서 이를 프로토콜로 분리하고자 하였다. --- .../Router/ProfileCreateRouter.swift | 28 +++++++++++------- .../Router/ProfileInputRouter.swift | 29 +++++++++++-------- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift index 6e6a8b5..ddfcc6e 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileCreateRouter.swift @@ -7,11 +7,26 @@ import UIKit protocol ProfileCreateRoutable { - static func createProfileCreateModule(dogDetailInfo: DogDetailInfo) -> UIViewController func presentMainScreen(from view: ProfileCreateViewable) } +protocol ProfileCreateBuildable { + static func createProfileCreateModule(dogDetailInfo: DogDetailInfo) -> UIViewController +} + final class ProfileCreateRouter: ProfileCreateRoutable { + func presentMainScreen(from view: any ProfileCreateViewable) { + if let sceneDelegate = UIApplication.shared.connectedScenes + .first(where: { $0.activationState == .foregroundActive })? + .delegate as? SceneDelegate { + if let router = sceneDelegate.appRouter { + router.moveToHomeScreen() + } + } + } +} + +extension ProfileCreateRouter: ProfileCreateBuildable { static func createProfileCreateModule(dogDetailInfo: DogDetailInfo) -> UIViewController { let storeDogInfoUsecase: StoreDogInfoUseCase = StoreDogInfoUserCaseImpl(localDataManager: LocalDataManager()) @@ -21,7 +36,7 @@ final class ProfileCreateRouter: ProfileCreateRoutable { = ProfileCreatePresenter(dogInfo: dogDetailInfo) let interactor: ProfileCreateInteractable = ProfileCreateInteractor(usecase: storeDogInfoUsecase) - let router: ProfileCreateRoutable = ProfileCreateRouter() + let router: ProfileCreateRoutable & ProfileCreateBuildable = ProfileCreateRouter() view.presenter = presenter presenter.view = view @@ -32,13 +47,4 @@ final class ProfileCreateRouter: ProfileCreateRoutable { return view } - func presentMainScreen(from view: any ProfileCreateViewable) { - if let sceneDelegate = UIApplication.shared.connectedScenes - .first(where: { $0.activationState == .foregroundActive })? - .delegate as? SceneDelegate { - if let router = sceneDelegate.appRouter { - router.moveToHomeScreen() - } - } - } } diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift index c73ef80..d47ec86 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Router/ProfileInputRouter.swift @@ -7,15 +7,30 @@ import UIKit protocol ProfileInputRoutable { - static func createProfileInputModule() -> UIViewController func presentPostCreateScreen(from view: ProfileInputViewable, with dogDetail: DogDetailInfo) } +protocol ProfileInputBuildable { + static func createProfileInputModule() -> UIViewController +} + final class ProfileInputRouter: ProfileInputRoutable { + func presentPostCreateScreen(from view: ProfileInputViewable, with dogDetail: DogDetailInfo) { + let profileCreateViewController = + ProfileCreateRouter.createProfileCreateModule(dogDetailInfo: dogDetail) + + if let sourceView = view as? UIViewController { + sourceView.navigationController?.pushViewController(profileCreateViewController, + animated: true) + } + } +} + +extension ProfileInputRouter: ProfileInputBuildable { static func createProfileInputModule() -> UIViewController { let view: ProfileInputViewable & UIViewController = ProfileInputViewController() var presenter: ProfileInputPresentable = ProfileInputPresenter() - let router: ProfileInputRoutable = ProfileInputRouter() + let router: ProfileInputRoutable & ProfileInputBuildable = ProfileInputRouter() view.presenter = presenter presenter.view = view @@ -23,14 +38,4 @@ final class ProfileInputRouter: ProfileInputRoutable { return view } - - func presentPostCreateScreen(from view: ProfileInputViewable, with dogDetail: DogDetailInfo) { - let profileCreateViewController = - ProfileCreateRouter.createProfileCreateModule(dogDetailInfo: dogDetail) - - if let sourceView = view as? UIViewController { - sourceView.navigationController?.pushViewController(profileCreateViewController, - animated: true) - } - } } From e4c76a0d4fc51193d94181bdaa98d912a36f165e Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 20:18:02 +0900 Subject: [PATCH 21/22] =?UTF-8?q?[chore]=20#52=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interactor/DataManager.swift | 28 +++++++++++++++++++ .../Interactor/SaveInfoUseCase.swift | 20 ------------- 2 files changed, 28 insertions(+), 20 deletions(-) create mode 100644 SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/DataManager.swift diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/DataManager.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/DataManager.swift new file mode 100644 index 0000000..74c2e04 --- /dev/null +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/DataManager.swift @@ -0,0 +1,28 @@ +// +// DataManager.swift +// SniffMeet +// +// Created by 윤지성 on 11/14/24. +// + +import Foundation + +protocol DataStorable { + func storeData(data: Encodable) throws +} + +// TODO: - dataManager를 주입받을 수 있도록 수정 예정 +final class LocalDataManager: DataStorable { + private let dataManager = UserDefaultsManager(userDefaults: UserDefaults(suiteName: "demo")!, + jsonEncoder: JSONEncoder(), + jsonDecoder: JSONDecoder()) + func storeData(data: any Encodable) throws { + try dataManager.set(value: data, forKey: UserDefaultKey.dogInfo) + } +} + +extension LocalDataManager { + private enum UserDefaultKey { + static let dogInfo: String = "dogInfo" + } +} diff --git a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/SaveInfoUseCase.swift b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/SaveInfoUseCase.swift index 11473d3..19330dc 100644 --- a/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/SaveInfoUseCase.swift +++ b/SniffMeet/SniffMeet/Source/Auth/CreateProfile/Interactor/SaveInfoUseCase.swift @@ -6,26 +6,6 @@ // import Foundation -protocol DataStorable { - func storeData(data: Encodable) throws -} - -// TODO: - dataManager를 주입받을 수 있도록 수정 예정 -final class LocalDataManager: DataStorable { - private let dataManager = UserDefaultsManager(userDefaults: UserDefaults(suiteName: "demo")!, - jsonEncoder: JSONEncoder(), - jsonDecoder: JSONDecoder()) - func storeData(data: any Encodable) throws { - try dataManager.set(value: data, forKey: UserDefaultKey.dogInfo) - } -} - -extension LocalDataManager { - private enum UserDefaultKey { - static let dogInfo: String = "dogInfo" - } -} - protocol StoreDogInfoUseCase { func execute(dog: Dog) throws } From 27e907390d30c7baafbe21a37df0a10400ddfffc Mon Sep 17 00:00:00 2001 From: green-yoon87 <113659520+green-yoon87@users.noreply.github.com> Date: Thu, 14 Nov 2024 20:18:20 +0900 Subject: [PATCH 22/22] =?UTF-8?q?[chore]=20#52=20.pbxproj=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SniffMeet/SniffMeet.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SniffMeet/SniffMeet.xcodeproj/project.pbxproj b/SniffMeet/SniffMeet.xcodeproj/project.pbxproj index cac59df..3aa08af 100644 --- a/SniffMeet/SniffMeet.xcodeproj/project.pbxproj +++ b/SniffMeet/SniffMeet.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 320044582CE5B04C00D08B6D /* ProfileCreateRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320044572CE5B04300D08B6D /* ProfileCreateRouter.swift */; }; 3200445A2CE5B3AA00D08B6D /* ProfileCreateInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320044592CE5B39A00D08B6D /* ProfileCreateInteractor.swift */; }; 3200445E2CE5CA1B00D08B6D /* SaveInfoUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3200445D2CE5CA1A00D08B6D /* SaveInfoUseCase.swift */; }; + 320044672CE6125100D08B6D /* DataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320044662CE6124900D08B6D /* DataManager.swift */; }; 995D94262CE32ECE005A47BF /* Extension + Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 995D94252CE32EC1005A47BF /* Extension + Keyboard.swift */; }; 99FA4E792CE0FBBF00553C2E /* ProfileInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99FA4E782CE0FBBF00553C2E /* ProfileInputViewController.swift */; }; A21435F72CE20D2500564A4D /* TabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A21435F62CE20D2500564A4D /* TabBarController.swift */; }; @@ -85,6 +86,7 @@ 320044572CE5B04300D08B6D /* ProfileCreateRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreateRouter.swift; sourceTree = ""; }; 320044592CE5B39A00D08B6D /* ProfileCreateInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreateInteractor.swift; sourceTree = ""; }; 3200445D2CE5CA1A00D08B6D /* SaveInfoUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SaveInfoUseCase.swift; sourceTree = ""; }; + 320044662CE6124900D08B6D /* DataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataManager.swift; sourceTree = ""; }; 995D94252CE32EC1005A47BF /* Extension + Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension + Keyboard.swift"; sourceTree = ""; }; 99FA4E782CE0FBBF00553C2E /* ProfileInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInputViewController.swift; sourceTree = ""; }; A21435F62CE20D2500564A4D /* TabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = ""; }; @@ -666,6 +668,7 @@ FDA491662CDA7BE500A36FB0 /* Interactor */ = { isa = PBXGroup; children = ( + 320044662CE6124900D08B6D /* DataManager.swift */, 320044592CE5B39A00D08B6D /* ProfileCreateInteractor.swift */, 3200445D2CE5CA1A00D08B6D /* SaveInfoUseCase.swift */, ); @@ -1125,6 +1128,7 @@ 320044562CE59DF500D08B6D /* ProfileInputRouter.swift in Sources */, A2C844D72CDBEF8B007F2970 /* (null) in Sources */, 3200438B2CDF3BEF00D08B6D /* ProfileCreateViewController.swift in Sources */, + 320044672CE6125100D08B6D /* DataManager.swift in Sources */, FDEAEA7A2CE3148D005890FA /* BaseView.swift in Sources */, A2C328862CE245AC00D255AB /* TabBarModuleBuilder.swift in Sources */, FD69B1B52CE3BC7E009D71DC /* UserDefaultsManager.swift in Sources */,