diff --git a/Drink-EG/Drink-EG.xcodeproj/project.pbxproj b/Drink-EG/Drink-EG.xcodeproj/project.pbxproj index b311164..d5a2cfb 100644 --- a/Drink-EG/Drink-EG.xcodeproj/project.pbxproj +++ b/Drink-EG/Drink-EG.xcodeproj/project.pbxproj @@ -28,6 +28,8 @@ 165401072C6BA5D8008A9DBF /* MemberInfoRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 165401062C6BA5D8008A9DBF /* MemberInfoRequest.swift */; }; 165401092C6BA644008A9DBF /* MemberInfoAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 165401082C6BA644008A9DBF /* MemberInfoAPI.swift */; }; 1654010B2C6BACDC008A9DBF /* SelectionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1654010A2C6BACDC008A9DBF /* SelectionManager.swift */; }; + 1654014E2C6F9582008A9DBF /* APIResponseNoteResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1654014D2C6F9582008A9DBF /* APIResponseNoteResponse.swift */; }; + 165401502C6F960A008A9DBF /* NoteResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1654014F2C6F960A008A9DBF /* NoteResponse.swift */; }; 16752F9D2C5A7FB90001907D /* HexCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16752F9C2C5A7FB90001907D /* HexCode.swift */; }; 16B97CD42C4BEB0900D8B453 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B97CD32C4BEB0900D8B453 /* AppDelegate.swift */; }; 16B97CD62C4BEB0900D8B453 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B97CD52C4BEB0900D8B453 /* SceneDelegate.swift */; }; @@ -129,6 +131,8 @@ 165401062C6BA5D8008A9DBF /* MemberInfoRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemberInfoRequest.swift; sourceTree = ""; }; 165401082C6BA644008A9DBF /* MemberInfoAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemberInfoAPI.swift; sourceTree = ""; }; 1654010A2C6BACDC008A9DBF /* SelectionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionManager.swift; sourceTree = ""; }; + 1654014D2C6F9582008A9DBF /* APIResponseNoteResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIResponseNoteResponse.swift; sourceTree = ""; }; + 1654014F2C6F960A008A9DBF /* NoteResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteResponse.swift; sourceTree = ""; }; 16752F9C2C5A7FB90001907D /* HexCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexCode.swift; sourceTree = ""; }; 16B97CD02C4BEB0900D8B453 /* Drink-EG.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Drink-EG.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 16B97CD32C4BEB0900D8B453 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -227,6 +231,7 @@ 165401012C69F297008A9DBF /* WineNews */, 1F205A322C69FE9800E80659 /* JoinNLoginRequest.swift */, 165401062C6BA5D8008A9DBF /* MemberInfoRequest.swift */, + 1654014F2C6F960A008A9DBF /* NoteResponse.swift */, ); path = Datas; sourceTree = ""; @@ -256,6 +261,7 @@ 165400F92C69F15D008A9DBF /* APIResponseWineNewsResponse.swift */, 165400FD2C69F218008A9DBF /* APIResponseWineClassResponse.swift */, 1F205A362C6A71BC00E80659 /* APIResponseLoginResponse.swift */, + 1654014D2C6F9582008A9DBF /* APIResponseNoteResponse.swift */, ); path = APIResponseModels; sourceTree = ""; @@ -613,6 +619,7 @@ 1F598F0F2C5CBE70000CE79F /* FirstTasteTestViewController.swift in Sources */, 5E2219562C69D5E7005849FB /* ChooseTasteViewController.swift in Sources */, 165400F62C69EF89008A9DBF /* WineNewsRequest.swift in Sources */, + 1654014E2C6F9582008A9DBF /* APIResponseNoteResponse.swift in Sources */, 5E2219552C69D5E7005849FB /* CustomSlider.swift in Sources */, 1654010B2C6BACDC008A9DBF /* SelectionManager.swift in Sources */, 16752F9D2C5A7FB90001907D /* HexCode.swift in Sources */, @@ -642,6 +649,7 @@ 5E2219432C69D5D0005849FB /* ModalViewController.swift in Sources */, 165400FC2C69F1A3008A9DBF /* WineClassRequest.swift in Sources */, 165401002C69F251008A9DBF /* WineClassResponse.swift in Sources */, + 165401502C6F960A008A9DBF /* NoteResponse.swift in Sources */, 5E2219482C69D5D0005849FB /* CommunityListViewController.swift in Sources */, 5E2219492C69D5D0005849FB /* CommunityMainViewController.swift in Sources */, 16B97CD42C4BEB0900D8B453 /* AppDelegate.swift in Sources */, diff --git a/Drink-EG/Drink-EG/Sources/Datas/NoteResponse.swift b/Drink-EG/Drink-EG/Sources/Datas/NoteResponse.swift new file mode 100644 index 0000000..3c44ebd --- /dev/null +++ b/Drink-EG/Drink-EG/Sources/Datas/NoteResponse.swift @@ -0,0 +1,26 @@ +// +// NoteResponse.swift +// Drink-EG +// +// Created by 김도연 on 8/16/24. +// + +import Foundation + +struct NoteResponse : Codable { + let noteId : Int + let wineId : Int + let name : String + let picture : String + let color : String + let sugarContent : Int + let acidity : Int + let tannin : Int + let body : Int + let alcohol : Int + let scentAroma : [String] + let scentTaste : [String] + let scentFinish : [String] + let satisfaction : Double + let review : String +} diff --git a/Drink-EG/Drink-EG/Sources/Models/APIResponseModels/APIResponseNoteResponse.swift b/Drink-EG/Drink-EG/Sources/Models/APIResponseModels/APIResponseNoteResponse.swift new file mode 100644 index 0000000..dd919ca --- /dev/null +++ b/Drink-EG/Drink-EG/Sources/Models/APIResponseModels/APIResponseNoteResponse.swift @@ -0,0 +1,15 @@ +// +// APIResponseNoteResponse.swift +// Drink-EG +// +// Created by 김도연 on 8/16/24. +// + +import Foundation + +struct APIResponseNoteResponse : Codable { + let isSuccess : Bool + let code : String + let message : String + let result : NoteResponse +} diff --git a/Drink-EG/Drink-EG/Sources/VCs/Login/LoginViewController.swift b/Drink-EG/Drink-EG/Sources/VCs/Login/LoginViewController.swift index 41ac2fb..d328c1e 100644 --- a/Drink-EG/Drink-EG/Sources/VCs/Login/LoginViewController.swift +++ b/Drink-EG/Drink-EG/Sources/VCs/Login/LoginViewController.swift @@ -16,6 +16,7 @@ class LoginViewController: UIViewController, UITextFieldDelegate { public var userID : String? public var userPW : String? var loginDTO : JoinNLoginRequest? + public static var isFirstLogin : Bool = false let loginButton = UIButton(type: .system) let joinButton = UIButton(type: .system) @@ -212,7 +213,12 @@ class LoginViewController: UIViewController, UITextFieldDelegate { assignUserData() callLoginAPI { [weak self] isSuccess in if isSuccess { - self?.goToNextView() + if LoginViewController.isFirstLogin { + self?.goToNextView() + } else { + self?.goToHomeView() + } + } else { print("로그인 실패") // 실패 시에 대한 처리 (예: 에러 메시지 표시) @@ -225,6 +231,11 @@ class LoginViewController: UIViewController, UITextFieldDelegate { navigationController?.pushViewController(enterTasteTestViewController, animated: true) } + private func goToHomeView() { + let homeViewController = MainTabBarViewController() + navigationController?.pushViewController(homeViewController, animated: true) + } + private func configureJoinButton() { joinButton.setTitle("회원가입", for: .normal) joinButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 14) diff --git a/Drink-EG/Drink-EG/Sources/VCs/NoteListViewController.swift b/Drink-EG/Drink-EG/Sources/VCs/NoteListViewController.swift index fa32cb9..93ae74a 100644 --- a/Drink-EG/Drink-EG/Sources/VCs/NoteListViewController.swift +++ b/Drink-EG/Drink-EG/Sources/VCs/NoteListViewController.swift @@ -238,13 +238,22 @@ class NoteListViewController: UIViewController, UICollectionViewDelegate, UIColl provider.request(TastingNoteAPI.getNoteID(noteId: noteId)) { result in switch result { case .success(let response): - self.handleNoteDetailsResponse(response) + do { + let responseData = try JSONDecoder().decode(APIResponseNoteResponse.self, from: response.data) + self.handleNoteData(responseData.result) + } catch { + print("Failed to decode response: \(error)") + } case .failure(let error): print("Request failed: \(error)") } } } + func handleNoteData(_ data: NoteResponse) { + // TODO : 여기에서 데이터 처리하기 + } + func handleNoteDetailsResponse(_ response: Response) { do { if let jsonData = try response.mapJSON() as? [String: Any] {