Skip to content

Commit

Permalink
Merge branch 'feture/#13/snmnetwork' of https://github.com/boostcampw…
Browse files Browse the repository at this point in the history
…m-2024/iOS03-SniffMeet into feture/#13/snmnetwork
  • Loading branch information
soletree committed Nov 14, 2024
2 parents a52d5bb + 8ac7dd7 commit 57674df
Show file tree
Hide file tree
Showing 15 changed files with 411 additions and 40 deletions.
64 changes: 48 additions & 16 deletions SniffMeet/SniffMeet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand All @@ -22,8 +22,16 @@
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 */; };
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 /* 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 */; };
Expand Down Expand Up @@ -66,7 +74,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
3200438A2CDF3BE900D08B6D /* ProfileSetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileSetupView.swift; sourceTree = "<group>"; };
3200438A2CDF3BE900D08B6D /* ProfileCreateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreateViewController.swift; sourceTree = "<group>"; };
3200438C2CDF3D7F00D08B6D /* Extension + Navigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension + Navigation.swift"; sourceTree = "<group>"; };
3200438D2CDF3D7F00D08B6D /* InputTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputTextField.swift; sourceTree = "<group>"; };
3200438E2CDF3D7F00D08B6D /* KeywordButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeywordButton.swift; sourceTree = "<group>"; };
Expand All @@ -76,8 +84,16 @@
320044192CE48A3100D08B6D /* MPCBroswer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPCBroswer.swift; sourceTree = "<group>"; };
3200441B2CE48C5600D08B6D /* MPCAdvertiser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPCAdvertiser.swift; sourceTree = "<group>"; };
3200441D2CE48D1F00D08B6D /* MPConnectionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPConnectionManager.swift; sourceTree = "<group>"; };
3200444D2CE595DE00D08B6D /* ProfileCreatePresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreatePresenter.swift; sourceTree = "<group>"; };
3200444F2CE595F000D08B6D /* ProfileInputPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInputPresenter.swift; sourceTree = "<group>"; };
320044522CE59A8100D08B6D /* Dog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dog.swift; sourceTree = "<group>"; };
320044552CE59D5D00D08B6D /* ProfileInputRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInputRouter.swift; sourceTree = "<group>"; };
320044572CE5B04300D08B6D /* ProfileCreateRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreateRouter.swift; sourceTree = "<group>"; };
320044592CE5B39A00D08B6D /* ProfileCreateInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCreateInteractor.swift; sourceTree = "<group>"; };
3200445D2CE5CA1A00D08B6D /* SaveInfoUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SaveInfoUseCase.swift; sourceTree = "<group>"; };
320044662CE6124900D08B6D /* DataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataManager.swift; sourceTree = "<group>"; };
995D94252CE32EC1005A47BF /* Extension + Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension + Keyboard.swift"; sourceTree = "<group>"; };
99FA4E782CE0FBBF00553C2E /* ProfileInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInputView.swift; sourceTree = "<group>"; };
99FA4E782CE0FBBF00553C2E /* ProfileInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInputViewController.swift; sourceTree = "<group>"; };
A21435F62CE20D2500564A4D /* TabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = "<group>"; };
A2C328852CE245AC00D255AB /* TabBarModuleBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarModuleBuilder.swift; sourceTree = "<group>"; };
A2C328872CE2481900D255AB /* HomeModuleBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeModuleBuilder.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -143,6 +159,14 @@
path = MPC;
sourceTree = "<group>";
};
320044512CE5995F00D08B6D /* Entity */ = {
isa = PBXGroup;
children = (
320044522CE59A8100D08B6D /* Dog.swift */,
);
path = Entity;
sourceTree = "<group>";
};
A21435F52CE20CF600564A4D /* Tab */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -606,7 +630,7 @@
FDA491682CDA7C0300A36FB0 /* View */,
FDA491662CDA7BE500A36FB0 /* Interactor */,
FDA491642CDA7BD600A36FB0 /* Presenter */,
FDA491652CDA7BDF00A36FB0 /* Entity */,
320044512CE5995F00D08B6D /* Entity */,
FDA491672CDA7BEB00A36FB0 /* Router */,
);
path = CreateProfile;
Expand Down Expand Up @@ -658,36 +682,36 @@
FDA491642CDA7BD600A36FB0 /* Presenter */ = {
isa = PBXGroup;
children = (
3200444F2CE595F000D08B6D /* ProfileInputPresenter.swift */,
3200444D2CE595DE00D08B6D /* ProfileCreatePresenter.swift */,
);
path = Presenter;
sourceTree = "<group>";
};
FDA491652CDA7BDF00A36FB0 /* Entity */ = {
isa = PBXGroup;
children = (
);
path = Entity;
sourceTree = "<group>";
};
FDA491662CDA7BE500A36FB0 /* Interactor */ = {
isa = PBXGroup;
children = (
320044662CE6124900D08B6D /* DataManager.swift */,
320044592CE5B39A00D08B6D /* ProfileCreateInteractor.swift */,
3200445D2CE5CA1A00D08B6D /* SaveInfoUseCase.swift */,
);
path = Interactor;
sourceTree = "<group>";
};
FDA491672CDA7BEB00A36FB0 /* Router */ = {
isa = PBXGroup;
children = (
320044552CE59D5D00D08B6D /* ProfileInputRouter.swift */,
320044572CE5B04300D08B6D /* ProfileCreateRouter.swift */,
);
path = Router;
sourceTree = "<group>";
};
FDA491682CDA7C0300A36FB0 /* View */ = {
isa = PBXGroup;
children = (
99FA4E782CE0FBBF00553C2E /* ProfileInputView.swift */,
3200438A2CDF3BE900D08B6D /* ProfileSetupView.swift */,
99FA4E782CE0FBBF00553C2E /* ProfileInputViewController.swift */,
3200438A2CDF3BE900D08B6D /* ProfileCreateViewController.swift */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -1098,9 +1122,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 */,
Expand All @@ -1112,6 +1138,7 @@
FD0634282CE596BD003C9D6B /* SNMRequestConvertible.swift in Sources */,
320043972CDF493C00D08B6D /* Extension + UIView.swift in Sources */,
FD0634262CE596B5003C9D6B /* Endpoint.swift in Sources */,
320044502CE595F700D08B6D /* ProfileInputPresenter.swift in Sources */,
FD69B1B32CE3BC76009D71DC /* KeychainManager.swift in Sources */,
320043782CDCA49100D08B6D /* (null) in Sources */,
FD06342A2CE596D0003C9D6B /* NetworkProvider.swift in Sources */,
Expand All @@ -1120,11 +1147,15 @@
320043922CDF3D7F00D08B6D /* InputTextField.swift in Sources */,
320043932CDF3D7F00D08B6D /* KeywordView.swift in Sources */,
FD06342C2CE5984D003C9D6B /* SNMNetworkResponse.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 */,
320044672CE6125100D08B6D /* DataManager.swift in Sources */,
FDEAEA7A2CE3148D005890FA /* BaseView.swift in Sources */,
A2C328862CE245AC00D255AB /* TabBarModuleBuilder.swift in Sources */,
FD69B1B52CE3BC7E009D71DC /* UserDefaultsManager.swift in Sources */,
Expand All @@ -1133,6 +1164,7 @@
FD0634312CE62578003C9D6B /* AnyEncodable.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 */,
);
Expand Down
18 changes: 13 additions & 5 deletions SniffMeet/SniffMeet/Source/App/AppRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ final class AppRouter {
init(window: UIWindow?) {
self.window = window
}

// 첫 화면을 뭘 보여줄지는 회원 가입 여부에 따라 앱 플로우가 다르므로, UIWindow를 이용해야 합니다.
func displayInitialScreen(isLoggedIn: Bool) {
if isLoggedIn {
displayTabBar()
Expand All @@ -24,16 +22,26 @@ final class AppRouter {
}
private func displayTabBar() {
let submodules = (
home: HomeModuleBuilder.build(),
home: UINavigationController(rootViewController: HomeModuleBuilder.build()),
walk: UIViewController(),
mate: UIViewController()
)
window?.rootViewController = TabBarModuleBuilder.build(usingSubmodules: submodules)
window?.makeKeyAndVisible()
}
private func displayProfileSetupView() {
let profileViewController = ProfileInputView()
window?.rootViewController = profileViewController
let navigationController =
UINavigationController(rootViewController: ProfileInputRouter.createProfileInputModule())
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
}

func moveToHomeScreen() {
let submodules = (
home: UINavigationController(rootViewController: HomeModuleBuilder.build()),
walk: UIViewController(),
mate: UIViewController()
)
window?.rootViewController = TabBarModuleBuilder.build(usingSubmodules: submodules)
}
}
10 changes: 4 additions & 6 deletions SniffMeet/SniffMeet/Source/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
38 changes: 38 additions & 0 deletions SniffMeet/SniffMeet/Source/Auth/CreateProfile/Entity/Dog.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// DogDTO.swift
// SniffMeet
//
// Created by 윤지성 on 11/14/24.
//
import Foundation

struct DogDetailInfo {
let name: String
let age: UInt8
let size: Size
let keywords: [Keyword]
}

enum Size: Codable {
case small
case medium
case big
}

enum Keyword: String, Codable {
case energetic = "활발한"
case smart = "똑똑한"
case friendly = "친화력 좋은"
case shy = "소심한"
case independent = "독립적인"
}


struct Dog: Codable {
let name: String
let age: UInt8
let size: Size
let keywords: [Keyword]
let nickname: String
let profileImage: Data?
}
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// SaveInfoUseCase.swift
// SniffMeet
//
// Created by 윤지성 on 11/14/24.
//
import Foundation

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)
}
}
Loading

0 comments on commit 57674df

Please sign in to comment.