From a4bb97bba0b30127359287eb7af3d907620e568c Mon Sep 17 00:00:00 2001 From: mmaybei Date: Fri, 23 Aug 2024 16:28:56 +0900 Subject: [PATCH 01/15] =?UTF-8?q?fix/#301=20=EC=8A=A4=ED=81=AC=EB=A1=A4?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=94=EC=9A=B4=EC=8A=A4=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EC=9D=B4=EC=8A=88=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Home/ViewController/HomeViewController.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift index 1419c397..846c311f 100644 --- a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift +++ b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift @@ -181,9 +181,8 @@ extension HomeViewController: UICollectionViewDataSource { extension HomeViewController: UIScrollViewDelegate { func scrollViewDidScroll(_ scrollView: UIScrollView) { let maxOffsetY = rootView.scrollView.contentSize.height - rootView.scrollView.bounds.height - if rootView.scrollView.contentOffset.y > maxOffsetY { - rootView.scrollView.contentOffset.y = maxOffsetY - } + + rootView.backgroundColor = rootView.scrollView.contentOffset.y >= maxOffsetY ? .gray0 : .maincolor } } From 7e95f19b476d345d920f82cf4314d6dfafce3b15 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Fri, 23 Aug 2024 21:37:10 +0900 Subject: [PATCH 02/15] =?UTF-8?q?fix/#301=20=EC=88=98=EC=A0=95=EB=90=9C=20?= =?UTF-8?q?API=20=EB=AA=85=EC=84=B8=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/Model/Promises/NearestPromiseResponseModel.swift | 3 +-- .../DTO/Model/Promises/UpcomingPromiseListResponseModel.swift | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/KkuMulKum/Network/DTO/Model/Promises/NearestPromiseResponseModel.swift b/KkuMulKum/Network/DTO/Model/Promises/NearestPromiseResponseModel.swift index 757c54f2..8641d167 100644 --- a/KkuMulKum/Network/DTO/Model/Promises/NearestPromiseResponseModel.swift +++ b/KkuMulKum/Network/DTO/Model/Promises/NearestPromiseResponseModel.swift @@ -12,7 +12,7 @@ import Foundation struct NearestPromiseModel: ResponseModelType { let promiseID, dDay: Int - let name, meetingName, dressUpLevel, date, time, placeName: String + let name, meetingName, dressUpLevel, time, placeName: String enum CodingKeys: String, CodingKey { case promiseID = "promiseId" @@ -20,7 +20,6 @@ struct NearestPromiseModel: ResponseModelType { case name case meetingName case dressUpLevel - case date case time case placeName } diff --git a/KkuMulKum/Network/DTO/Model/Promises/UpcomingPromiseListResponseModel.swift b/KkuMulKum/Network/DTO/Model/Promises/UpcomingPromiseListResponseModel.swift index 52396e6c..9cdc20bf 100644 --- a/KkuMulKum/Network/DTO/Model/Promises/UpcomingPromiseListResponseModel.swift +++ b/KkuMulKum/Network/DTO/Model/Promises/UpcomingPromiseListResponseModel.swift @@ -16,7 +16,7 @@ struct UpcomingPromiseListModel: ResponseModelType { struct UpcomingPromise: Codable { let promiseID, dDay: Int - let name, meetingName, dressUpLevel, date, time, placeName: String + let name, meetingName, dressUpLevel, time, placeName: String enum CodingKeys: String, CodingKey { case promiseID = "promiseId" @@ -24,7 +24,6 @@ struct UpcomingPromise: Codable { case name case meetingName case dressUpLevel - case date case time case placeName } From 659f7b3c97c10aec51a539e9869ae3acc9ad6164 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Fri, 23 Aug 2024 21:38:21 +0900 Subject: [PATCH 03/15] =?UTF-8?q?refactor/#301=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=ED=83=80=EC=9E=85=20=EB=B3=80=EA=B2=BD=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KkuMulKum.xcodeproj/project.pbxproj | 25 ++- KkuMulKum/Network/Service/HomeService.swift | 136 +++++++++++++++ .../ServiceProtocol/HomeServiceProtocol.swift | 22 +++ .../Home/ServiceType/HomeServiceType.swift | 162 ------------------ 4 files changed, 170 insertions(+), 175 deletions(-) create mode 100644 KkuMulKum/Source/Home/ServiceProtocol/HomeServiceProtocol.swift delete mode 100644 KkuMulKum/Source/Home/ServiceType/HomeServiceType.swift diff --git a/KkuMulKum.xcodeproj/project.pbxproj b/KkuMulKum.xcodeproj/project.pbxproj index 6c308e8e..d0a9ecec 100644 --- a/KkuMulKum.xcodeproj/project.pbxproj +++ b/KkuMulKum.xcodeproj/project.pbxproj @@ -90,6 +90,7 @@ A3DD9C402C41BAD000E58A13 /* MeetingListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C382C41BAD000E58A13 /* MeetingListViewController.swift */; }; A3DD9C412C41BAD000E58A13 /* MeetingListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C3A2C41BAD000E58A13 /* MeetingListViewModel.swift */; }; A3DD9C682C45C78300E58A13 /* HomeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C672C45C78300E58A13 /* HomeService.swift */; }; + A3FB02442C788A790026DE0E /* HomeServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB02432C788A790026DE0E /* HomeServiceProtocol.swift */; }; A3FB184D2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB184C2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift */; }; A3FB184F2C3BF4BC001483E5 /* MakeMeetingsResponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB184E2C3BF4BB001483E5 /* MakeMeetingsResponseModel.swift */; }; A3FB18512C3BF531001483E5 /* RegisterMeetingsResquestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB18502C3BF531001483E5 /* RegisterMeetingsResquestModel.swift */; }; @@ -118,7 +119,6 @@ DD39768A2C41C2AD00E2A4C4 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3976822C41C2AD00E2A4C4 /* HomeViewController.swift */; }; DD39768C2C41C36B00E2A4C4 /* Color.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD39768B2C41C36B00E2A4C4 /* Color.xcassets */; }; DD3F9DC62C484DEB008E1FF7 /* PromiseService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DC52C484DEB008E1FF7 /* PromiseService.swift */; }; - DD3F9DCC2C485614008E1FF7 /* HomeServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DCB2C485614008E1FF7 /* HomeServiceType.swift */; }; DD3F9DD02C48571A008E1FF7 /* MeetingListServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DCF2C48571A008E1FF7 /* MeetingListServiceType.swift */; }; DD3F9DD22C485753008E1FF7 /* UtilService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DD12C485753008E1FF7 /* UtilService.swift */; }; DD3F9DD42C4858A3008E1FF7 /* UtilTargetType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DD32C4858A3008E1FF7 /* UtilTargetType.swift */; }; @@ -252,7 +252,6 @@ 782B407E2C3E44B7008B0CA7 /* WelcomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewModel.swift; sourceTree = ""; }; 782B40812C3E4925008B0CA7 /* NicknameViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameViewModel.swift; sourceTree = ""; }; 784824F62C6E1C9900FE07A0 /* AuthServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthServiceProtocol.swift; sourceTree = ""; }; - 785AE1D02C3B07A600677CA0 /* PrivacyInfo.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = PrivacyInfo.plist; sourceTree = ""; }; 789196332C486F6B00FF8CDF /* KeychainAccessible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainAccessible.swift; sourceTree = ""; }; 789196352C492F8600FF8CDF /* AuthTargetType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthTargetType.swift; sourceTree = ""; }; 789196372C49697B00FF8CDF /* AuthError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthError.swift; sourceTree = ""; }; @@ -286,6 +285,7 @@ A3DD9C382C41BAD000E58A13 /* MeetingListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingListViewController.swift; sourceTree = ""; }; A3DD9C3A2C41BAD000E58A13 /* MeetingListViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingListViewModel.swift; sourceTree = ""; }; A3DD9C672C45C78300E58A13 /* HomeService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeService.swift; sourceTree = ""; }; + A3FB02432C788A790026DE0E /* HomeServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeServiceProtocol.swift; sourceTree = ""; }; A3FB184C2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MakeMeetingsRequestModel.swift; sourceTree = ""; }; A3FB184E2C3BF4BB001483E5 /* MakeMeetingsResponseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MakeMeetingsResponseModel.swift; sourceTree = ""; }; A3FB18502C3BF531001483E5 /* RegisterMeetingsResquestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterMeetingsResquestModel.swift; sourceTree = ""; }; @@ -315,7 +315,6 @@ DD3976822C41C2AD00E2A4C4 /* HomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = ""; }; DD39768B2C41C36B00E2A4C4 /* Color.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Color.xcassets; sourceTree = ""; }; DD3F9DC52C484DEB008E1FF7 /* PromiseService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromiseService.swift; sourceTree = ""; }; - DD3F9DCB2C485614008E1FF7 /* HomeServiceType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeServiceType.swift; sourceTree = ""; }; DD3F9DCF2C48571A008E1FF7 /* MeetingListServiceType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingListServiceType.swift; sourceTree = ""; }; DD3F9DD12C485753008E1FF7 /* UtilService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilService.swift; sourceTree = ""; }; DD3F9DD32C4858A3008E1FF7 /* UtilTargetType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilTargetType.swift; sourceTree = ""; }; @@ -717,6 +716,14 @@ path = Service; sourceTree = ""; }; + A3FB02422C788A520026DE0E /* ServiceProtocol */ = { + isa = PBXGroup; + children = ( + A3FB02432C788A790026DE0E /* HomeServiceProtocol.swift */, + ); + path = ServiceProtocol; + sourceTree = ""; + }; DD1FD02C2C5CC6DE00D0A72C /* View */ = { isa = PBXGroup; children = ( @@ -817,7 +824,7 @@ DD3976752C41C2AD00E2A4C4 /* Home */ = { isa = PBXGroup; children = ( - DD3F9DCA2C485606008E1FF7 /* ServiceType */, + A3FB02422C788A520026DE0E /* ServiceProtocol */, DD3976762C41C2AD00E2A4C4 /* ViewModel */, DD3976812C41C2AD00E2A4C4 /* ViewController */, DD39767C2C41C2AD00E2A4C4 /* View */, @@ -895,14 +902,6 @@ path = ViewController; sourceTree = ""; }; - DD3F9DCA2C485606008E1FF7 /* ServiceType */ = { - isa = PBXGroup; - children = ( - DD3F9DCB2C485614008E1FF7 /* HomeServiceType.swift */, - ); - path = ServiceType; - sourceTree = ""; - }; DD3F9DCE2C485700008E1FF7 /* ServiceType */ = { isa = PBXGroup; children = ( @@ -1754,6 +1753,7 @@ DD30721E2C3C0CC800416D9F /* PromiseInfoResponseModel.swift in Sources */, DD41BEFF2C41DAA40095A068 /* TardyEmptyView.swift in Sources */, A3FB18512C3BF531001483E5 /* RegisterMeetingsResquestModel.swift in Sources */, + A3FB02442C788A790026DE0E /* HomeServiceProtocol.swift in Sources */, DD8626632C4606A300E4F980 /* EnterReadyInfoButtonView.swift in Sources */, 789AD4B32C3C0093002E2688 /* SocialLoginResponseModel.swift in Sources */, DD43937F2C41357800EC1799 /* InviteCodeViewModel.swift in Sources */, @@ -1830,7 +1830,6 @@ DECB845E2C4442AF0022A003 /* FindPlaceView.swift in Sources */, DE6D4D0F2C3F14D80005584B /* MeetingInfoService.swift in Sources */, DD3F9DD62C4988E2008E1FF7 /* RegisterMeetingsResponseModel.swift in Sources */, - DD3F9DCC2C485614008E1FF7 /* HomeServiceType.swift in Sources */, DD39768A2C41C2AD00E2A4C4 /* HomeViewController.swift in Sources */, DED5DBF42C34539A006ECE7E /* BaseTableViewCell.swift in Sources */, DDE7D2CA2C47EE81005A921F /* PromiseTargetType.swift in Sources */, diff --git a/KkuMulKum/Network/Service/HomeService.swift b/KkuMulKum/Network/Service/HomeService.swift index 303489f7..1d67a554 100644 --- a/KkuMulKum/Network/Service/HomeService.swift +++ b/KkuMulKum/Network/Service/HomeService.swift @@ -39,3 +39,139 @@ final class HomeService { } } } + +extension HomeService: HomeServiceProtocol { + func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { + return try await request(with: .fetchMyReadyStatus(promiseID: promiseID)) + } + + func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { + return try await request( + with: .updatePreparationStatus(promiseID: promiseID) + ) + } + + func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { + return try await request( + with: .updateDepartureStatus(promiseID: promiseID) + ) + } + + func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { + return try await request( + with: .updateArrivalStatus(promiseID: promiseID) + ) + } + + func fetchLoginUser() async throws -> ResponseBodyDTO? { + return try await request(with: .fetchLoginUser) + } + + func fetchNearestPromise() async throws -> ResponseBodyDTO? { + return try await request(with: .fetchNearestPromise) + } + + func fetchUpcomingPromise() async throws -> ResponseBodyDTO? { + return try await request(with: .fetchUpcomingPromise) + } +} + +final class MockHomeService: HomeServiceProtocol { + func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { + return nil + } + + func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { + return nil + } + + func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { + return nil + } + + func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { + return nil + } + + func fetchLoginUser() async throws -> ResponseBodyDTO? { + let mockData = ResponseBodyDTO( + success: true, + data: LoginUserModel( + userID: 1, + name: "꾸물리안", + level: 4, + promiseCount: 8, + tardyCount: 2, + tardySum: 72, + profileImageURL: "" + ), + error: nil + ) + return mockData + } + + func fetchNearestPromise() async throws -> ResponseBodyDTO? { + let mockData = ResponseBodyDTO( + success: true, + data: NearestPromiseModel( + promiseID: 1, + dDay: 0, + name: "꾸물이들 대환장 파티", + meetingName: "꾸물이들", + dressUpLevel: "냐미", + time: "PM 8:00", + placeName: "DMC역" + ), + error: nil + ) + return mockData + } + + func fetchUpcomingPromise() async throws -> ResponseBodyDTO? { + let mockData = ResponseBodyDTO( + success: true, + data: UpcomingPromiseListModel( + promises: [ + UpcomingPromise( + promiseID: 1, + dDay: 1, + name: "누가 코코볼 다 먹었어?", + meetingName: "우마우스", + dressUpLevel: "", + time: "PM 2:00", + placeName: "가자하우스" + ), + UpcomingPromise( + promiseID: 2, + dDay: 1, + name: "누가 코코볼 다 먹었어?", + meetingName: "우마우스", + dressUpLevel: "", + time: "PM 2:00", + placeName: "가자하우스" + ), + UpcomingPromise( + promiseID: 3, + dDay: 1, + name: "누가 코코볼 다 먹었어?", + meetingName: "우마우스", + dressUpLevel: "", + time: "PM 2:00", + placeName: "가자하우스" + ), + UpcomingPromise( + promiseID: 4, + dDay: 1, + name: "누가 코코볼 다 먹었어?", + meetingName: "우마우스", + dressUpLevel: "", + time: "PM 2:00", + placeName: "가자하우스" + ) + ] + ), + error: nil + ) + return mockData + } +} diff --git a/KkuMulKum/Source/Home/ServiceProtocol/HomeServiceProtocol.swift b/KkuMulKum/Source/Home/ServiceProtocol/HomeServiceProtocol.swift new file mode 100644 index 00000000..996dbeda --- /dev/null +++ b/KkuMulKum/Source/Home/ServiceProtocol/HomeServiceProtocol.swift @@ -0,0 +1,22 @@ +// +// HomeServiceProtocol.swift +// KkuMulKum +// +// Created by 예삐 on 8/23/24. +// + +import Foundation + +import Moya + +protocol HomeServiceProtocol { + func fetchLoginUser() async throws -> ResponseBodyDTO? + + func fetchNearestPromise() async throws -> ResponseBodyDTO? + func fetchUpcomingPromise() async throws -> ResponseBodyDTO? + func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO? + + func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO? + func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO? + func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO? +} diff --git a/KkuMulKum/Source/Home/ServiceType/HomeServiceType.swift b/KkuMulKum/Source/Home/ServiceType/HomeServiceType.swift deleted file mode 100644 index 1b4360eb..00000000 --- a/KkuMulKum/Source/Home/ServiceType/HomeServiceType.swift +++ /dev/null @@ -1,162 +0,0 @@ -// -// HomeServiceType.swift -// KkuMulKum -// -// Created by YOUJIM on 7/18/24. -// - -import Foundation - -import Moya - -protocol HomeServiceType { - func fetchLoginUser() async throws -> ResponseBodyDTO? - func fetchNearestPromise() async throws -> ResponseBodyDTO? - func fetchUpcomingPromise() async throws -> ResponseBodyDTO? - func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO? - - func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO? - func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO? - func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO? -} - -extension HomeService: HomeServiceType { - func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { - return try await request(with: .fetchMyReadyStatus(promiseID: promiseID)) - } - - func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { - return try await request( - with: .updatePreparationStatus(promiseID: promiseID) - ) - } - - func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { - return try await request( - with: .updateDepartureStatus(promiseID: promiseID) - ) - } - - func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { - return try await request( - with: .updateArrivalStatus(promiseID: promiseID) - ) - } - - func fetchLoginUser() async throws -> ResponseBodyDTO? { - return try await request(with: .fetchLoginUser) - } - - func fetchNearestPromise() async throws -> ResponseBodyDTO? { - return try await request(with: .fetchNearestPromise) - } - - func fetchUpcomingPromise() async throws -> ResponseBodyDTO? { - return try await request(with: .fetchUpcomingPromise) - } -} - -final class MockHomeService: HomeServiceType { - func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { - return nil - } - - func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { - return nil - } - - func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { - return nil - } - - func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO? { - return nil - } - - func fetchLoginUser() async throws -> ResponseBodyDTO? { - let mockData = ResponseBodyDTO( - success: true, - data: LoginUserModel( - userID: 1, - name: "꾸물리안", - level: 4, - promiseCount: 8, - tardyCount: 2, - tardySum: 72, - profileImageURL: "" - ), - error: nil - ) - return mockData - } - - func fetchNearestPromise() async throws -> ResponseBodyDTO? { - let mockData = ResponseBodyDTO( - success: true, - data: NearestPromiseModel( - promiseID: 1, - dDay: 0, - name: "꾸물이들 대환장 파티", - meetingName: "꾸물이들", - dressUpLevel: "냐미", - date: "2024.07.16", - time: "PM 8:00", - placeName: "DMC역" - ), - error: nil - ) - return mockData - } - - func fetchUpcomingPromise() async throws -> ResponseBodyDTO? { - let mockData = ResponseBodyDTO( - success: true, - data: UpcomingPromiseListModel( - promises: [ - UpcomingPromise( - promiseID: 1, - dDay: 1, - name: "누가 코코볼 다 먹었어?", - meetingName: "우마우스", - dressUpLevel: "", - date: "2024.07.17", - time: "PM 2:00", - placeName: "가자하우스" - ), - UpcomingPromise( - promiseID: 2, - dDay: 1, - name: "누가 코코볼 다 먹었어?", - meetingName: "우마우스", - dressUpLevel: "", - date: "2024.07.17", - time: "PM 2:00", - placeName: "가자하우스" - ), - UpcomingPromise( - promiseID: 3, - dDay: 1, - name: "누가 코코볼 다 먹었어?", - meetingName: "우마우스", - dressUpLevel: "", - date: "2024.07.17", - time: "PM 2:00", - placeName: "가자하우스" - ), - UpcomingPromise( - promiseID: 4, - dDay: 1, - name: "누가 코코볼 다 먹었어?", - meetingName: "우마우스", - dressUpLevel: "", - date: "2024.07.17", - time: "PM 2:00", - placeName: "가자하우스" - ) - ] - ), - error: nil - ) - return mockData - } -} From b0468e650e47bec92c4a0e34128087d3bae25b9c Mon Sep 17 00:00:00 2001 From: mmaybei Date: Fri, 23 Aug 2024 21:55:53 +0900 Subject: [PATCH 04/15] =?UTF-8?q?refactor/#301=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=ED=94=84=EB=A1=9C=ED=86=A0=EC=BD=9C=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Home/View/UpcomingPromiseCollecitonViewCell.swift | 2 +- KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift b/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift index 0468fe9b..12c37ca6 100644 --- a/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift +++ b/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift @@ -147,7 +147,7 @@ extension UpcomingPromiseCollectionViewCell { ) meetingNameLabel.setText(contentData.meetingName, style: .caption02, color: .green3) nameLabel.setText(contentData.name, style: .body03, color: .gray8) - dateLabel.setText(contentData.date, style: .body06, color: .gray7) + dateLabel.setText(contentData.time, style: .body06, color: .gray7) timeLabel.setText(contentData.time, style: .body06, color: .gray7) placeNameLabel.setText( contentData.placeName, diff --git a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift index 604adab9..2db552ef 100644 --- a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift +++ b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift @@ -27,9 +27,9 @@ final class HomeViewModel { var levelName = ObservablePattern("") var levelCaption = ObservablePattern("") - private let service: HomeServiceType + private let service: HomeServiceProtocol - init(service: HomeServiceType) { + init(service: HomeServiceProtocol) { self.service = service } From 44ed84a0dc1ea32c8f6054453aee8d6db2d36fcf Mon Sep 17 00:00:00 2001 From: mmaybei Date: Sat, 24 Aug 2024 00:11:42 +0900 Subject: [PATCH 05/15] =?UTF-8?q?refactor/#301=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EC=BD=98=20=ED=81=AC=EA=B8=B0=20=EB=B0=8F=20=EC=83=89=EC=83=81?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KkuMulKum/Source/Home/View/HomeView.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KkuMulKum/Source/Home/View/HomeView.swift b/KkuMulKum/Source/Home/View/HomeView.swift index 629f7828..f70659d5 100644 --- a/KkuMulKum/Source/Home/View/HomeView.swift +++ b/KkuMulKum/Source/Home/View/HomeView.swift @@ -66,7 +66,7 @@ final class HomeView: BaseView { } let todayButton = UIButton().then { - let icon = UIImage(resource: .iconRight) + let icon = UIImage(resource: .iconRight).withTintColor(.gray4) $0.setImage(icon, for: .normal) } @@ -210,7 +210,8 @@ final class HomeView: BaseView { todayButton.snp.makeConstraints { $0.trailing.equalToSuperview().offset(-20) $0.centerY.equalTo(todayLabel.snp.centerY) - $0.size.equalTo(20) + $0.height.equalTo(Screen.height(24)) + $0.width.equalTo(Screen.width(24)) } todayPromiseView.snp.makeConstraints { From a22fdee9ed695777bf3532c24b586d8e68f29196 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Sat, 24 Aug 2024 00:38:16 +0900 Subject: [PATCH 06/15] =?UTF-8?q?refactor/#301=20=ED=98=84=EC=9E=AC=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EA=B4=80=EB=A0=A8=20=EB=B7=B0=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Home/ViewModel/HomeViewModel.swift | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift index 2db552ef..2af7f34f 100644 --- a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift +++ b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift @@ -17,13 +17,12 @@ enum ReadyState { } final class HomeViewModel { - var currentState = ObservablePattern(.none) - var loginUser = ObservablePattern?>(nil) var nearestPromise = ObservablePattern?>(nil) var upcomingPromiseList = ObservablePattern?>(nil) var myReadyStatus = ObservablePattern?>(nil) + var currentState = ObservablePattern(.none) var levelName = ObservablePattern("") var levelCaption = ObservablePattern("") @@ -60,16 +59,21 @@ final class HomeViewModel { } } + ///서버에서 보내주는 readyStatus의 시간 유무에 따른 현재 상태 분류 private func judgeReadyStatus() { - let data = myReadyStatus.value?.data - if data?.preparationStartAt == nil && data?.departureAt == nil && data?.arrivalAt == nil { + guard let data = myReadyStatus.value?.data else { currentState.value = .none - } else if data?.preparationStartAt != nil && data?.departureAt == nil && data?.arrivalAt == nil { - currentState.value = .prepare - } else if data?.departureAt != nil && data?.arrivalAt == nil { - currentState.value = .move - } else if data?.arrivalAt != nil { + return + } + + if let _ = data.arrivalAt { currentState.value = .arrive + } else if let _ = data.departureAt { + currentState.value = .move + } else if let _ = data.preparationStartAt { + currentState.value = .prepare + } else { + currentState.value = .none } } From e73dae205d153656a359271d53a0dd0b864e6530 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Sat, 24 Aug 2024 01:03:26 +0900 Subject: [PATCH 07/15] =?UTF-8?q?chore/#301=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=A3=BC=EC=84=9D=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F?= =?UTF-8?q?=20=EB=A7=88=ED=81=AC=EC=A3=BC=EC=84=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift index 2af7f34f..ea701ef8 100644 --- a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift +++ b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift @@ -17,6 +17,10 @@ enum ReadyState { } final class HomeViewModel { + + + // MARK: - Property + var loginUser = ObservablePattern?>(nil) var nearestPromise = ObservablePattern?>(nil) var upcomingPromiseList = ObservablePattern?>(nil) @@ -26,12 +30,18 @@ final class HomeViewModel { var levelName = ObservablePattern("") var levelCaption = ObservablePattern("") + + // MARK: - Initializer + private let service: HomeServiceProtocol init(service: HomeServiceProtocol) { self.service = service } + + // MARK: - Function + ///서버에서 보내주는 level Int 값에 따른 levelName private func getLevelName(level: Int) -> String { switch level { @@ -80,12 +90,10 @@ final class HomeViewModel { func requestMyReadyStatus() { Task { do { - print(currentState.value) myReadyStatus.value = try await service.fetchMyReadyStatus( with: nearestPromise.value?.data?.promiseID ?? 1 ) judgeReadyStatus() - print(currentState.value) } catch { print(">>> \(error.localizedDescription) : \(#function)") } From e60d1a042589fa329e459c3594c7607d05a1e4a5 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Sat, 24 Aug 2024 01:42:18 +0900 Subject: [PATCH 08/15] =?UTF-8?q?fix/#301=20=EC=98=A4=EB=8A=98=EC=9D=98=20?= =?UTF-8?q?=EC=95=BD=EC=86=8D=20=EB=94=94=EC=9E=90=EC=9D=B8=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KkuMulKum/Source/Home/View/TodayPromiseView.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/KkuMulKum/Source/Home/View/TodayPromiseView.swift b/KkuMulKum/Source/Home/View/TodayPromiseView.swift index 7597dcad..92e50e0d 100644 --- a/KkuMulKum/Source/Home/View/TodayPromiseView.swift +++ b/KkuMulKum/Source/Home/View/TodayPromiseView.swift @@ -224,7 +224,13 @@ final class TodayPromiseView: BaseView { $0.bottom.equalToSuperview().offset(-80) $0.height.equalTo(4) } - + + moveLineView.snp.makeConstraints { + $0.leading.equalTo(prepareButton.snp.centerX) + $0.trailing.equalTo(moveButton.snp.centerX) + $0.bottom.equalToSuperview().offset(-80) + $0.height.equalTo(4) + } arriveLineView.snp.makeConstraints { $0.leading.equalTo(moveButton.snp.centerX) From 82757d88e9db44e9a290eb4e4831414a1a3e6463 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Sat, 24 Aug 2024 01:45:28 +0900 Subject: [PATCH 09/15] =?UTF-8?q?chore/#301=20=EB=B0=94=EC=9D=B8=EB=94=A9?= =?UTF-8?q?=20=ED=95=A8=EC=88=98=20=EB=84=A4=EC=9D=B4=EB=B0=8D=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 --- .../ViewController/HomeViewController.swift | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift index 846c311f..7302eeab 100644 --- a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift +++ b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift @@ -52,27 +52,23 @@ class HomeViewController: BaseViewController { viewModel.requestNearestPromise() viewModel.requestUpcomingPromise() - updateUI() - - updateUserInfo() - updateNearestPromise() - updateUpcomingPromise() + setupBinding() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationController?.isNavigationBarHidden = true - - updateUI() - - updateUserInfo() - updateNearestPromise() - updateUpcomingPromise() + viewModel.requestLoginUser() viewModel.requestNearestPromise() viewModel.requestUpcomingPromise() + + setupBinding() } + + // MARK: - Function + override func setupAction() { rootView.todayButton.addTarget( self, @@ -197,7 +193,14 @@ private extension HomeViewController { ) } - func updateUI() { + func setupBinding() { + bindCurrentState() + bindUserInfo() + bindNearestPromise() + bindUpcomingPromise() + } + + func bindCurrentState() { viewModel.currentState.bind { [weak self] state in DispatchQueue.main.async { switch state { @@ -214,7 +217,7 @@ private extension HomeViewController { } } - func updateUserInfo() { + func bindUserInfo() { viewModel.loginUser.bind { [weak self] _ in DispatchQueue.main.async { let data = self?.viewModel.loginUser.value @@ -261,7 +264,7 @@ private extension HomeViewController { } } - func updateNearestPromise() { + func bindNearestPromise() { viewModel.nearestPromise.bind { [weak self] _ in DispatchQueue.main.async { guard let self = self else { return } @@ -300,7 +303,7 @@ private extension HomeViewController { } } - func updateUpcomingPromise() { + func bindUpcomingPromise() { viewModel.upcomingPromiseList.bind { [weak self] _ in guard let self, let responseBody = viewModel.upcomingPromiseList.value, From b49b79e09e99d8ac158a7227e2a538fd354aa791 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Sun, 25 Aug 2024 17:20:52 +0900 Subject: [PATCH 10/15] =?UTF-8?q?chore/#301=20=EA=B0=84=EB=8B=A8=ED=95=9C?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewController/HomeViewController.swift | 47 +++++++++---------- .../Source/Home/ViewModel/HomeViewModel.swift | 6 +-- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift index 7302eeab..f8df7628 100644 --- a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift +++ b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift @@ -47,11 +47,6 @@ class HomeViewController: BaseViewController { view.backgroundColor = .maincolor register() - - viewModel.requestLoginUser() - viewModel.requestNearestPromise() - viewModel.requestUpcomingPromise() - setupBinding() } @@ -62,8 +57,6 @@ class HomeViewController: BaseViewController { viewModel.requestLoginUser() viewModel.requestNearestPromise() viewModel.requestUpcomingPromise() - - setupBinding() } @@ -220,31 +213,32 @@ private extension HomeViewController { func bindUserInfo() { viewModel.loginUser.bind { [weak self] _ in DispatchQueue.main.async { - let data = self?.viewModel.loginUser.value + let data = self?.viewModel.loginUser.value?.data + let characterImage = self?.rootView.levelCharacterImage self?.rootView.kkumulLabel.setText( - "\(data?.data?.name ?? "") 님,\n\(data?.data?.promiseCount ?? 0)번의 약속에서\n\(data?.data?.tardyCount ?? 0)번 꾸물거렸어요!", + "\(data?.name ?? "") 님,\n\(data?.promiseCount ?? 0)번의 약속에서\n\(data?.tardyCount ?? 0)번 꾸물거렸어요!", style: .title02, color: .white ) self?.rootView.kkumulLabel.setHighlightText( - "\(data?.data?.name ?? "") 님,", + "\(data?.name ?? "") 님,", style: .title00, color: .white ) self?.rootView.kkumulLabel.setHighlightText( - "\(data?.data?.promiseCount ?? 0)번", - "\(data?.data?.tardyCount ?? 0)번", + "\(data?.promiseCount ?? 0)번", + "\(data?.tardyCount ?? 0)번", style: .title00, color: .lightGreen ) self?.rootView.levelLabel.setText( - "Lv.\(data?.data?.level ?? 0) \(self?.viewModel.levelName.value ?? "")", + "Lv.\(data?.level ?? 0) \(self?.viewModel.levelName.value ?? "")", style: .caption01, color: .gray6 ) self?.rootView.levelLabel.setHighlightText( - "Lv.\(data?.data?.level ?? 0)", + "Lv.\(data?.level ?? 0)", style: .caption01, color: .maincolor ) @@ -253,11 +247,11 @@ private extension HomeViewController { style: .label01, color: .white ) - switch data?.data?.level { - case 1: self?.rootView.levelCharacterImage.image = .imgLevel01 - case 2: self?.rootView.levelCharacterImage.image = .imgLevel02 - case 3: self?.rootView.levelCharacterImage.image = .imgLevel03 - case 4: self?.rootView.levelCharacterImage.image = .imgLevel04 + switch data?.level { + case 1: characterImage?.image = .imgLevel01 + case 2: characterImage?.image = .imgLevel02 + case 3: characterImage?.image = .imgLevel03 + case 4: characterImage?.image = .imgLevel04 default: break } } @@ -268,9 +262,9 @@ private extension HomeViewController { viewModel.nearestPromise.bind { [weak self] _ in DispatchQueue.main.async { guard let self = self else { return } - let data = self.viewModel.nearestPromise.value + let data = self.viewModel.nearestPromise.value?.data - if data?.data == nil { + if data == nil { self.rootView.todayPromiseView.isHidden = true self.rootView.todayEmptyView.isHidden = false self.rootView.todayButton.isHidden = true @@ -279,22 +273,22 @@ private extension HomeViewController { self.rootView.todayPromiseView.isHidden = false self.rootView.todayEmptyView.isHidden = true self.rootView.todayPromiseView.meetingNameLabel.setText( - data?.data?.meetingName ?? "", + data?.meetingName ?? "", style: .caption02, color: .green3 ) self.rootView.todayPromiseView.nameLabel.setText( - data?.data?.name ?? "", + data?.name ?? "", style: .body03, color: .gray8 ) self.rootView.todayPromiseView.placeNameLabel.setText( - data?.data?.placeName ?? "", + data?.placeName ?? "", style: .body06, color: .gray7 ) self.rootView.todayPromiseView.timeLabel.setText( - data?.data?.time ?? "", + data?.time ?? "", style: .body06, color: .gray7 ) @@ -457,15 +451,18 @@ private extension HomeViewController { @objc func prepareButtonDidTap(_ sender: UIButton) { viewModel.updatePrepareStatus() + viewModel.currentState.value = .prepare } @objc func moveButtonDidTap(_ sender: UIButton) { viewModel.updateMoveStatus() + viewModel.currentState.value = .move } @objc func arriveButtonDidTap(_ sender: UIButton) { viewModel.updateArriveStatus() + viewModel.currentState.value = .arrive } } diff --git a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift index ea701ef8..9c035de9 100644 --- a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift +++ b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift @@ -109,7 +109,7 @@ final class HomeViewModel { else { return } - currentState.value = .prepare +// currentState.value = .prepare } catch { print(">>> \(error.localizedDescription) : \(#function)") } @@ -125,7 +125,7 @@ final class HomeViewModel { else { return } - currentState.value = .move +// currentState.value = .move } catch { print(">>> \(error.localizedDescription) : \(#function)") } @@ -141,7 +141,7 @@ final class HomeViewModel { else { return } - currentState.value = .arrive +// currentState.value = .arrive } catch { print(">>> \(error.localizedDescription) : \(#function)") } From 0ec8ec24b87cea88cb2068b468e3a23816834807 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Sun, 25 Aug 2024 18:03:32 +0900 Subject: [PATCH 11/15] =?UTF-8?q?chore/#301=20=EA=B0=84=EB=8B=A8=ED=95=9C?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewController/HomeViewController.swift | 50 +++++++++++-------- .../Source/Home/ViewModel/HomeViewModel.swift | 3 -- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift index f8df7628..92401200 100644 --- a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift +++ b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift @@ -212,46 +212,52 @@ private extension HomeViewController { func bindUserInfo() { viewModel.loginUser.bind { [weak self] _ in + guard let self, + let responseBody = viewModel.loginUser.value, + let data = responseBody.data + else { + return + } + DispatchQueue.main.async { - let data = self?.viewModel.loginUser.value?.data - let characterImage = self?.rootView.levelCharacterImage + let characterImage = self.rootView.levelCharacterImage - self?.rootView.kkumulLabel.setText( - "\(data?.name ?? "") 님,\n\(data?.promiseCount ?? 0)번의 약속에서\n\(data?.tardyCount ?? 0)번 꾸물거렸어요!", + self.rootView.kkumulLabel.setText( + "\(data.name ?? "") 님,\n\(data.promiseCount)번의 약속에서\n\(data.tardyCount)번 꾸물거렸어요!", style: .title02, color: .white ) - self?.rootView.kkumulLabel.setHighlightText( - "\(data?.name ?? "") 님,", + self.rootView.kkumulLabel.setHighlightText( + "\(data.name ?? "") 님,", style: .title00, color: .white ) - self?.rootView.kkumulLabel.setHighlightText( - "\(data?.promiseCount ?? 0)번", - "\(data?.tardyCount ?? 0)번", + self.rootView.kkumulLabel.setHighlightText( + "\(data.promiseCount)번", + "\(data.tardyCount)번", style: .title00, color: .lightGreen ) - self?.rootView.levelLabel.setText( - "Lv.\(data?.level ?? 0) \(self?.viewModel.levelName.value ?? "")", + self.rootView.levelLabel.setText( + "Lv.\(data.level) \(self.viewModel.levelName.value)", style: .caption01, color: .gray6 ) - self?.rootView.levelLabel.setHighlightText( - "Lv.\(data?.level ?? 0)", + self.rootView.levelLabel.setHighlightText( + "Lv.\(data.level)", style: .caption01, color: .maincolor ) - self?.rootView.levelCaptionLabel.setText( - self?.viewModel.levelCaption.value ?? "", + self.rootView.levelCaptionLabel.setText( + self.viewModel.levelCaption.value, style: .label01, color: .white ) - switch data?.level { - case 1: characterImage?.image = .imgLevel01 - case 2: characterImage?.image = .imgLevel02 - case 3: characterImage?.image = .imgLevel03 - case 4: characterImage?.image = .imgLevel04 + switch data.level { + case 1: characterImage.image = .imgLevel01 + case 2: characterImage.image = .imgLevel02 + case 3: characterImage.image = .imgLevel03 + case 4: characterImage.image = .imgLevel04 default: break } } @@ -266,11 +272,11 @@ private extension HomeViewController { if data == nil { self.rootView.todayPromiseView.isHidden = true - self.rootView.todayEmptyView.isHidden = false self.rootView.todayButton.isHidden = true + self.rootView.todayEmptyView.isHidden = false } else { - self.rootView.todayButton.isHidden = false self.rootView.todayPromiseView.isHidden = false + self.rootView.todayButton.isHidden = false self.rootView.todayEmptyView.isHidden = true self.rootView.todayPromiseView.meetingNameLabel.setText( data?.meetingName ?? "", diff --git a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift index 9c035de9..2db7cb9b 100644 --- a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift +++ b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift @@ -109,7 +109,6 @@ final class HomeViewModel { else { return } -// currentState.value = .prepare } catch { print(">>> \(error.localizedDescription) : \(#function)") } @@ -125,7 +124,6 @@ final class HomeViewModel { else { return } -// currentState.value = .move } catch { print(">>> \(error.localizedDescription) : \(#function)") } @@ -141,7 +139,6 @@ final class HomeViewModel { else { return } -// currentState.value = .arrive } catch { print(">>> \(error.localizedDescription) : \(#function)") } From f750f3efb958bad0362960eca3b994e8d49fe6df Mon Sep 17 00:00:00 2001 From: mmaybei Date: Mon, 26 Aug 2024 16:35:24 +0900 Subject: [PATCH 12/15] =?UTF-8?q?fix/#301=20=EC=A4=80=EB=B9=84=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=EA=B4=80=EB=A0=A8=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 새로운 약속이 추가되어 오늘의 약속이 바뀔 때 준비 상태가 바뀌지 않는 오류 및 페이지 이동 시에만 시간 레이블이 반영되는 오류 수정 --- .../Source/Home/View/TodayPromiseView.swift | 27 +--- .../ViewController/HomeViewController.swift | 118 ++++++++++++++++-- .../Source/Home/ViewModel/HomeViewModel.swift | 2 + 3 files changed, 112 insertions(+), 35 deletions(-) diff --git a/KkuMulKum/Source/Home/View/TodayPromiseView.swift b/KkuMulKum/Source/Home/View/TodayPromiseView.swift index 92e50e0d..4e3f2f30 100644 --- a/KkuMulKum/Source/Home/View/TodayPromiseView.swift +++ b/KkuMulKum/Source/Home/View/TodayPromiseView.swift @@ -58,17 +58,11 @@ final class TodayPromiseView: BaseView { private let lineView = UIView(backgroundColor: .gray2) - let prepareLineView = UIView(backgroundColor: .maincolor).then { - $0.isHidden = true - } + let prepareLineView = UIView(backgroundColor: .maincolor) - let moveLineView = UIView(backgroundColor: .maincolor).then { - $0.isHidden = true - } + let moveLineView = UIView(backgroundColor: .maincolor) - let arriveLineView = UIView(backgroundColor: .maincolor).then { - $0.isHidden = true - } + let arriveLineView = UIView(backgroundColor: .maincolor) let prepareCircleView = UIView(backgroundColor: .maincolor).then { $0.layer.cornerRadius = 8 @@ -84,49 +78,38 @@ final class TodayPromiseView: BaseView { let prepareCheckView = UIImageView().then { $0.image = .iconCheck - $0.isHidden = true } let moveCheckView = UIImageView().then { $0.image = .iconCheck - $0.isHidden = true } let arriveCheckView = UIImageView().then { $0.image = .iconCheck - $0.isHidden = true } let prepareButton = UIButton().then { - $0.setTitle("준비 시작", style: .body05, color: .maincolor) $0.setLayer(borderWidth: 1, borderColor: .maincolor, cornerRadius: 16) } let moveButton = UIButton().then { - $0.setTitle("이동 시작", style: .body05, color: .gray4) - $0.setLayer(borderWidth: 1, borderColor: .gray4, cornerRadius: 16) - $0.isEnabled = false + $0.setLayer(borderWidth: 1, borderColor: .maincolor, cornerRadius: 16) } let arriveButton = UIButton().then { - $0.setTitle("도착 완료", style: .body05, color: .gray4) - $0.setLayer(borderWidth: 1, borderColor: .gray4, cornerRadius: 16) - $0.isEnabled = false + $0.setLayer(borderWidth: 1, borderColor: .maincolor, cornerRadius: 16) } let prepareLabel = UILabel().then { $0.setText("준비를 시작 시 눌러주세요", style: .label02, color: .gray5) - $0.isHidden = false } let moveLabel = UILabel().then { $0.setText("이동를 시작 시 눌러주세요", style: .label02, color: .gray5) - $0.isHidden = true } let arriveLabel = UILabel().then { $0.setText("도착 완료 시 눌러주세요", style: .label02, color: .gray5) - $0.isHidden = true } let prepareTimeLabel = UILabel() diff --git a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift index 92401200..10e92189 100644 --- a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift +++ b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift @@ -204,7 +204,7 @@ private extension HomeViewController { case .arrive: self?.setArriveUI() case .none: - break + self?.setNoneUI() } } } @@ -325,86 +325,167 @@ private extension HomeViewController { } } + func getCurrentTimeString() -> String { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "a h:mm" + dateFormatter.locale = Locale(identifier: "en_US_POSIX") + return dateFormatter.string(from: Date()) + } + func setDisableButton(_ sender: UIButton) { - sender.setTitleColor(.gray3, for: .normal) sender.layer.borderColor = UIColor.gray3.cgColor sender.backgroundColor = .white } func setEnableButton(_ sender: UIButton) { - sender.setTitleColor(.maincolor, for: .normal) sender.layer.borderColor = UIColor.maincolor.cgColor sender.backgroundColor = .white } func setProgressButton(_ sender: UIButton) { - sender.setTitleColor(.maincolor, for: .normal) sender.layer.borderColor = UIColor.maincolor.cgColor sender.backgroundColor = .green2 } func setCompleteButton(_ sender: UIButton) { - sender.setTitleColor(.white, for: .normal) sender.layer.borderColor = UIColor.maincolor.cgColor sender.backgroundColor = .maincolor } + func setNoneUI() { + print("setNoneUI") + setEnableButton(rootView.todayPromiseView.prepareButton) + setDisableButton(rootView.todayPromiseView.moveButton) + setDisableButton(rootView.todayPromiseView.arriveButton) + + rootView.todayPromiseView.prepareButton.setTitle("준비 시작", style: .body05, color: .maincolor) + rootView.todayPromiseView.moveButton.setTitle("이동 시작", style: .body05, color: .gray3) + rootView.todayPromiseView.arriveButton.setTitle("도착 완료", style: .body05, color: .gray3) + + rootView.todayPromiseView.prepareButton.isEnabled = true + rootView.todayPromiseView.moveButton.isEnabled = false + rootView.todayPromiseView.arriveButton.isEnabled = false + + rootView.todayPromiseView.prepareCircleView.backgroundColor = .gray2 + rootView.todayPromiseView.moveCircleView.backgroundColor = .gray2 + rootView.todayPromiseView.arriveCircleView.backgroundColor = .gray2 + + rootView.todayPromiseView.prepareCheckView.isHidden = true + rootView.todayPromiseView.moveCheckView.isHidden = true + rootView.todayPromiseView.arriveCheckView.isHidden = true + + rootView.todayPromiseView.prepareLabel.isHidden = false + rootView.todayPromiseView.moveLabel.isHidden = true + rootView.todayPromiseView.arriveLabel.isHidden = true + + rootView.todayPromiseView.prepareLineView.isHidden = true + rootView.todayPromiseView.moveLineView.isHidden = true + rootView.todayPromiseView.arriveLineView.isHidden = true + + rootView.todayPromiseView.prepareTimeLabel.isHidden = true + rootView.todayPromiseView.moveTimeLabel.isHidden = true + rootView.todayPromiseView.arriveTimeLabel.isHidden = true + } + func setPrepareUI() { + print("setPrepareUI") setProgressButton(rootView.todayPromiseView.prepareButton) - rootView.todayPromiseView.moveButton.setTitle("준비 중", for: .normal) setEnableButton(rootView.todayPromiseView.moveButton) setDisableButton(rootView.todayPromiseView.arriveButton) + rootView.todayPromiseView.prepareButton.setTitle("준비 중", style: .body05, color: .maincolor) + rootView.todayPromiseView.moveButton.setTitle("이동 시작", style: .body05, color: .maincolor) + rootView.todayPromiseView.arriveButton.setTitle("도착 완료", style: .body05, color: .gray3) + rootView.todayPromiseView.prepareButton.isEnabled = false rootView.todayPromiseView.moveButton.isEnabled = true + rootView.todayPromiseView.arriveButton.isEnabled = false rootView.todayPromiseView.prepareCircleView.backgroundColor = .green2 + rootView.todayPromiseView.moveCircleView.backgroundColor = .gray2 + rootView.todayPromiseView.arriveCircleView.backgroundColor = .gray2 + + rootView.todayPromiseView.prepareCheckView.isHidden = true + rootView.todayPromiseView.moveCheckView.isHidden = true + rootView.todayPromiseView.arriveCheckView.isHidden = true rootView.todayPromiseView.prepareLabel.isHidden = true rootView.todayPromiseView.moveLabel.isHidden = false + rootView.todayPromiseView.arriveLabel.isHidden = true rootView.todayPromiseView.prepareLineView.isHidden = false + rootView.todayPromiseView.moveLineView.isHidden = true + rootView.todayPromiseView.arriveLineView.isHidden = true + let currentTime = getCurrentTimeString() rootView.todayPromiseView.prepareTimeLabel.setText( - self.viewModel.myReadyStatus.value?.data?.preparationStartAt ?? "", style: .caption02, color: .gray8 + self.viewModel.myReadyStatus.value?.data?.preparationStartAt ?? currentTime, + style: .caption02, + color: .gray8 ) + + rootView.todayPromiseView.prepareTimeLabel.isHidden = false + rootView.todayPromiseView.moveTimeLabel.isHidden = true + rootView.todayPromiseView.arriveTimeLabel.isHidden = true } func setMoveUI() { + print("setMoveUI") setCompleteButton(rootView.todayPromiseView.prepareButton) - rootView.todayPromiseView.moveButton.setTitle("이동 중", for: .normal) setProgressButton(rootView.todayPromiseView.moveButton) setEnableButton(rootView.todayPromiseView.arriveButton) + rootView.todayPromiseView.prepareButton.setTitle("준비 중", style: .body05, color: .white) + rootView.todayPromiseView.moveButton.setTitle("이동 중", style: .body05, color: .maincolor) + rootView.todayPromiseView.arriveButton.setTitle("도착 완료", style: .body05, color: .maincolor) + rootView.todayPromiseView.prepareButton.isEnabled = false rootView.todayPromiseView.moveButton.isEnabled = false rootView.todayPromiseView.arriveButton.isEnabled = true rootView.todayPromiseView.prepareCircleView.backgroundColor = .maincolor rootView.todayPromiseView.moveCircleView.backgroundColor = .green2 + rootView.todayPromiseView.arriveCircleView.backgroundColor = .gray2 rootView.todayPromiseView.prepareLabel.isHidden = true rootView.todayPromiseView.moveLabel.isHidden = true rootView.todayPromiseView.arriveLabel.isHidden = false rootView.todayPromiseView.prepareCheckView.isHidden = false + rootView.todayPromiseView.moveCheckView.isHidden = true + rootView.todayPromiseView.arriveCheckView.isHidden = true rootView.todayPromiseView.prepareLineView.isHidden = false rootView.todayPromiseView.moveLineView.isHidden = false + rootView.todayPromiseView.arriveLineView.isHidden = true + let currentTime = getCurrentTimeString() rootView.todayPromiseView.prepareTimeLabel.setText( - self.viewModel.myReadyStatus.value?.data?.preparationStartAt ?? "", style: .caption02, color: .gray8 + self.viewModel.myReadyStatus.value?.data?.preparationStartAt ?? currentTime, + style: .caption02, + color: .gray8 ) rootView.todayPromiseView.moveTimeLabel.setText( - self.viewModel.myReadyStatus.value?.data?.departureAt ?? "", style: .caption02, color: .gray8 + self.viewModel.myReadyStatus.value?.data?.departureAt ?? currentTime, + style: .caption02, + color: .gray8 ) + + rootView.todayPromiseView.prepareTimeLabel.isHidden = false + rootView.todayPromiseView.moveTimeLabel.isHidden = false + rootView.todayPromiseView.arriveTimeLabel.isHidden = true } func setArriveUI() { + print("setArriveUI") setCompleteButton(rootView.todayPromiseView.prepareButton) setCompleteButton(rootView.todayPromiseView.moveButton) setCompleteButton(rootView.todayPromiseView.arriveButton) + rootView.todayPromiseView.prepareButton.setTitle("준비 중", style: .body05, color: .white) + rootView.todayPromiseView.moveButton.setTitle("이동 중", style: .body05, color: .white) + rootView.todayPromiseView.arriveButton.setTitle("도착 완료", style: .body05, color: .white) + rootView.todayPromiseView.prepareButton.isEnabled = false rootView.todayPromiseView.moveButton.isEnabled = false rootView.todayPromiseView.arriveButton.isEnabled = false @@ -425,15 +506,26 @@ private extension HomeViewController { rootView.todayPromiseView.moveLineView.isHidden = false rootView.todayPromiseView.arriveLineView.isHidden = false + let currentTime = getCurrentTimeString() rootView.todayPromiseView.prepareTimeLabel.setText( - self.viewModel.myReadyStatus.value?.data?.preparationStartAt ?? "", style: .caption02, color: .gray8 + self.viewModel.myReadyStatus.value?.data?.preparationStartAt ?? currentTime, + style: .caption02, + color: .gray8 ) rootView.todayPromiseView.moveTimeLabel.setText( - self.viewModel.myReadyStatus.value?.data?.departureAt ?? "", style: .caption02, color: .gray8 + self.viewModel.myReadyStatus.value?.data?.departureAt ?? currentTime, + style: .caption02, + color: .gray8 ) rootView.todayPromiseView.arriveTimeLabel.setText( - self.viewModel.myReadyStatus.value?.data?.arrivalAt ?? "", style: .caption02, color: .gray8 + self.viewModel.myReadyStatus.value?.data?.arrivalAt ?? currentTime, + style: .caption02, + color: .gray8 ) + + rootView.todayPromiseView.prepareTimeLabel.isHidden = false + rootView.todayPromiseView.moveTimeLabel.isHidden = false + rootView.todayPromiseView.arriveTimeLabel.isHidden = false } diff --git a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift index 2db7cb9b..c7d3224d 100644 --- a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift +++ b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift @@ -71,6 +71,7 @@ final class HomeViewModel { ///서버에서 보내주는 readyStatus의 시간 유무에 따른 현재 상태 분류 private func judgeReadyStatus() { + print("judgeReadyStatus = \(currentState.value)") guard let data = myReadyStatus.value?.data else { currentState.value = .none return @@ -85,6 +86,7 @@ final class HomeViewModel { } else { currentState.value = .none } + print("judgeReadyStatus = \(currentState.value)") } func requestMyReadyStatus() { From e53b2524da935b30f7f677a1fb96c4f646a48e14 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Mon, 26 Aug 2024 17:24:35 +0900 Subject: [PATCH 13/15] =?UTF-8?q?refactor/#301=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=EB=90=9C=20=EC=84=9C=EB=B2=84=20=EB=AA=85=EC=84=B8=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=8F=AC?= =?UTF-8?q?=EB=A7=B7=20=EB=B0=8F=20=EB=B0=94=EC=9D=B8=EB=94=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UpcomingPromiseCollecitonViewCell.swift | 6 +-- .../ViewController/HomeViewController.swift | 7 ++- .../Source/Home/ViewModel/HomeViewModel.swift | 47 +++++++++++++++++-- 3 files changed, 52 insertions(+), 8 deletions(-) diff --git a/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift b/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift index 12c37ca6..0474e06d 100644 --- a/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift +++ b/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift @@ -138,7 +138,7 @@ final class UpcomingPromiseCollectionViewCell: BaseCollectionViewCell { // MARK: - Data Bind extension UpcomingPromiseCollectionViewCell { - func dataBind(_ contentData: UpcomingPromise) { + func dataBind(_ contentData: UpcomingPromise, formattedTime: String, formattedDay: String) { let dDayText = contentData.dDay == 0 ? "DAY" : "\(contentData.dDay)" dDayLabel.setText( "D-\(dDayText)", @@ -147,8 +147,8 @@ extension UpcomingPromiseCollectionViewCell { ) meetingNameLabel.setText(contentData.meetingName, style: .caption02, color: .green3) nameLabel.setText(contentData.name, style: .body03, color: .gray8) - dateLabel.setText(contentData.time, style: .body06, color: .gray7) - timeLabel.setText(contentData.time, style: .body06, color: .gray7) + dateLabel.setText(formattedDay, style: .body06, color: .gray7) + timeLabel.setText(formattedTime, style: .body06, color: .gray7) placeNameLabel.setText( contentData.placeName, style: .body06, diff --git a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift index 10e92189..361758de 100644 --- a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift +++ b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift @@ -157,8 +157,11 @@ extension HomeViewController: UICollectionViewDataSource { withReuseIdentifier: UpcomingPromiseCollectionViewCell.reuseIdentifier, for: indexPath ) as? UpcomingPromiseCollectionViewCell else { return UICollectionViewCell() } + if let data = viewModel.upcomingPromiseList.value?.data?.promises[indexPath.item] { - cell.dataBind(data) + let formattedTime = viewModel.formattedTimes.value[indexPath.item] + let formattedDay = viewModel.formattedDays.value[indexPath.item] + cell.dataBind(data, formattedTime: formattedTime, formattedDay: formattedDay) } return cell } @@ -294,7 +297,7 @@ private extension HomeViewController { color: .gray7 ) self.rootView.todayPromiseView.timeLabel.setText( - data?.time ?? "", + self.viewModel.todayFormattedTime.value, style: .body06, color: .gray7 ) diff --git a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift index c7d3224d..b6948390 100644 --- a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift +++ b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift @@ -30,6 +30,13 @@ final class HomeViewModel { var levelName = ObservablePattern("") var levelCaption = ObservablePattern("") + /// 오늘의 약속 + var todayFormattedTime = ObservablePattern("") + + /// 다가올 나의 약속 + var formattedTimes = ObservablePattern<[String]>([]) + var formattedDays = ObservablePattern<[String]>([]) + // MARK: - Initializer @@ -42,7 +49,7 @@ final class HomeViewModel { // MARK: - Function - ///서버에서 보내주는 level Int 값에 따른 levelName + /// 서버에서 보내주는 level Int 값에 따른 levelName private func getLevelName(level: Int) -> String { switch level { case 1: return "빼꼼 꾸물이" @@ -53,7 +60,7 @@ final class HomeViewModel { } } - ///서버에서 보내주는 level Int 값에 따른 levelCaption + /// 서버에서 보내주는 level Int 값에 따른 levelCaption private func getLevelCaption(level: Int) -> String { switch level { case 1: @@ -69,7 +76,35 @@ final class HomeViewModel { } } - ///서버에서 보내주는 readyStatus의 시간 유무에 따른 현재 상태 분류 + /// 서버에서 보내주는 time 데이터를 시간으로 변환하는 함수 + private func formatTimeToString(_ timeString: String) -> String? { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" + dateFormatter.locale = Locale(identifier: "en_US_POSIX") + + if let time = dateFormatter.date(from: timeString) { + dateFormatter.dateFormat = "a h:mm" + return dateFormatter.string(from: time) + } + + return nil + } + + /// 서버에서 보내주는 time 데이터를 날짜로 변환하는 함수 + func formatDateToString(_ timeString: String) -> String? { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" + dateFormatter.locale = Locale(identifier: "en_US_POSIX") + + if let date = dateFormatter.date(from: timeString) { + dateFormatter.dateFormat = "yyyy.MM.dd" + return dateFormatter.string(from: date) + } + + return nil + } + + /// 서버에서 보내주는 readyStatus의 시간 유무에 따른 현재 상태 분류 private func judgeReadyStatus() { print("judgeReadyStatus = \(currentState.value)") guard let data = myReadyStatus.value?.data else { @@ -163,6 +198,7 @@ final class HomeViewModel { Task { do { nearestPromise.value = try await service.fetchNearestPromise() + todayFormattedTime.value = formatTimeToString(nearestPromise.value?.data?.time ?? "") ?? "" requestMyReadyStatus() } catch { print(">>> \(error.localizedDescription) : \(#function)") @@ -174,6 +210,11 @@ final class HomeViewModel { Task { do { upcomingPromiseList.value = try await service.fetchUpcomingPromise() + + let promises = upcomingPromiseList.value?.data?.promises ?? [] + formattedTimes.value = promises.map { formatTimeToString($0.time) ?? "" } + formattedDays.value = promises.map { formatDateToString($0.time) ?? "" } + } catch { print(">>> \(error.localizedDescription) : \(#function)") } From d83b3bf14448b7bcc58e2e5c932130096829c0f0 Mon Sep 17 00:00:00 2001 From: mmaybei Date: Mon, 26 Aug 2024 17:26:06 +0900 Subject: [PATCH 14/15] =?UTF-8?q?chore/#301=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=A3=BC=EC=84=9D=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KkuMulKum/Source/Home/ViewController/HomeViewController.swift | 4 ---- KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift | 3 --- 2 files changed, 7 deletions(-) diff --git a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift index 361758de..d8522e2c 100644 --- a/KkuMulKum/Source/Home/ViewController/HomeViewController.swift +++ b/KkuMulKum/Source/Home/ViewController/HomeViewController.swift @@ -356,7 +356,6 @@ private extension HomeViewController { } func setNoneUI() { - print("setNoneUI") setEnableButton(rootView.todayPromiseView.prepareButton) setDisableButton(rootView.todayPromiseView.moveButton) setDisableButton(rootView.todayPromiseView.arriveButton) @@ -391,7 +390,6 @@ private extension HomeViewController { } func setPrepareUI() { - print("setPrepareUI") setProgressButton(rootView.todayPromiseView.prepareButton) setEnableButton(rootView.todayPromiseView.moveButton) setDisableButton(rootView.todayPromiseView.arriveButton) @@ -433,7 +431,6 @@ private extension HomeViewController { } func setMoveUI() { - print("setMoveUI") setCompleteButton(rootView.todayPromiseView.prepareButton) setProgressButton(rootView.todayPromiseView.moveButton) setEnableButton(rootView.todayPromiseView.arriveButton) @@ -480,7 +477,6 @@ private extension HomeViewController { } func setArriveUI() { - print("setArriveUI") setCompleteButton(rootView.todayPromiseView.prepareButton) setCompleteButton(rootView.todayPromiseView.moveButton) setCompleteButton(rootView.todayPromiseView.arriveButton) diff --git a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift index b6948390..2c58abc4 100644 --- a/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift +++ b/KkuMulKum/Source/Home/ViewModel/HomeViewModel.swift @@ -106,7 +106,6 @@ final class HomeViewModel { /// 서버에서 보내주는 readyStatus의 시간 유무에 따른 현재 상태 분류 private func judgeReadyStatus() { - print("judgeReadyStatus = \(currentState.value)") guard let data = myReadyStatus.value?.data else { currentState.value = .none return @@ -121,7 +120,6 @@ final class HomeViewModel { } else { currentState.value = .none } - print("judgeReadyStatus = \(currentState.value)") } func requestMyReadyStatus() { @@ -214,7 +212,6 @@ final class HomeViewModel { let promises = upcomingPromiseList.value?.data?.promises ?? [] formattedTimes.value = promises.map { formatTimeToString($0.time) ?? "" } formattedDays.value = promises.map { formatDateToString($0.time) ?? "" } - } catch { print(">>> \(error.localizedDescription) : \(#function)") } From 15c78cb2d066ebc954eff3757469dce75a8ef52f Mon Sep 17 00:00:00 2001 From: mmaybei Date: Mon, 26 Aug 2024 17:46:38 +0900 Subject: [PATCH 15/15] =?UTF-8?q?refact/#301=20=EC=85=80=20=EB=94=94?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=20=EB=A0=88=EC=9D=B4=EB=B8=94=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Home/View/UpcomingPromiseCollecitonViewCell.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift b/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift index 0474e06d..7953b46a 100644 --- a/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift +++ b/KkuMulKum/Source/Home/View/UpcomingPromiseCollecitonViewCell.swift @@ -139,9 +139,9 @@ final class UpcomingPromiseCollectionViewCell: BaseCollectionViewCell { extension UpcomingPromiseCollectionViewCell { func dataBind(_ contentData: UpcomingPromise, formattedTime: String, formattedDay: String) { - let dDayText = contentData.dDay == 0 ? "DAY" : "\(contentData.dDay)" + let dDayText = contentData.dDay == 0 ? "-DAY" : "\(contentData.dDay)" dDayLabel.setText( - "D-\(dDayText)", + "D\(dDayText)", style: .body05, color: contentData.dDay == 0 ? .mainorange : .gray5 )