From f39a451b50e32a65c71a21f104bdd6f24214d66f Mon Sep 17 00:00:00 2001 From: yeonee Date: Wed, 21 Jan 2026 22:49:08 +0900 Subject: [PATCH 1/2] =?UTF-8?q?style:=20#140=20=ED=85=8D=EC=8A=A4=ED=8A=B8?= =?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 --- .../Feature/ChallengeView/View/ChallengeLoadingView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/View/ChallengeLoadingView.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/View/ChallengeLoadingView.swift index 8d587720..4a5568e0 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/View/ChallengeLoadingView.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/View/ChallengeLoadingView.swift @@ -13,7 +13,7 @@ struct ChallengeLoadingView: View { var body: some View { VStack { VStack(spacing: 4.adjustedH) { - highlight(highlightText: viewModel.selectedRoutine?.description ?? "", normalText: "관리 방향을 바탕으로") + highlight(highlightText: viewModel.selectedRoutine?.description ?? "", normalText: "방향을 바탕으로") .padding(.top, 113.adjustedH) TypographyText("TO-DO 미션을 만들고 있어요.", style: .title1_sb_18, color: .gray800) Image(.loading) From 5214413646def47b1b21ad803db1df5fb8a05594 Mon Sep 17 00:00:00 2001 From: yeonee Date: Wed, 21 Jan 2026 23:12:34 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20#140=20=20=EC=B1=8C=EB=A6=B0?= =?UTF-8?q?=EC=A7=80=20=ED=83=AD=20=EB=B6=84=EA=B8=B0=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Persistence/UserDefaultKey.swift | 1 + .../Data/Repository/DemoRepository.swift | 24 +++++++--- .../Data/Repository/HomeRepository.swift | 5 ++ .../Coordinator/ChallengeCoordinator.swift | 1 - .../ChallengeCoordinatorView.swift | 46 +++++++++++-------- 5 files changed, 49 insertions(+), 28 deletions(-) diff --git a/Cherrish-iOS/Cherrish-iOS/Data/Persistence/UserDefaultKey.swift b/Cherrish-iOS/Cherrish-iOS/Data/Persistence/UserDefaultKey.swift index e6308ca9..95d27d12 100644 --- a/Cherrish-iOS/Cherrish-iOS/Data/Persistence/UserDefaultKey.swift +++ b/Cherrish-iOS/Cherrish-iOS/Data/Persistence/UserDefaultKey.swift @@ -10,4 +10,5 @@ import Foundation enum UserDefaultsKey: String, CaseIterable { case userID case isOnboardingCompleted + case hasProgressChallenge } diff --git a/Cherrish-iOS/Cherrish-iOS/Data/Repository/DemoRepository.swift b/Cherrish-iOS/Cherrish-iOS/Data/Repository/DemoRepository.swift index 16a57862..2baa5bc7 100644 --- a/Cherrish-iOS/Cherrish-iOS/Data/Repository/DemoRepository.swift +++ b/Cherrish-iOS/Cherrish-iOS/Data/Repository/DemoRepository.swift @@ -25,17 +25,27 @@ struct DefaultDemoRepository: DemoInterface { DemoAPI.fetchChallenges(userID: userID), decodingType: FetchChallengesResponseDTO.self ) - + let _ = userDefaultService.save(true, key: .hasProgressChallenge) + CherrishLogger.debug(userDefaultService.load(key: .hasProgressChallenge) ?? false) return response.toEntity() } func advance() async throws -> ProgressChallengeEntity { let userID: Int = userDefaultService.load(key: .userID) ?? 1 - let response = try await networkService.request( - DemoAPI.advance(userID: userID), - decodingType: FetchChallengesResponseDTO.self - ) - return response.toEntity() + do { + let response = try await networkService.request( + DemoAPI.advance(userID: userID), + decodingType: FetchChallengesResponseDTO.self + ) + return response.toEntity() + + } catch { + if error as! CherrishError == CherrishError.conflict { + let _ = userDefaultService.save(false, key: .hasProgressChallenge) + } + throw error + } + } func toggleRoutine(routineID: Int) async throws -> ProgressRoutineEntity { @@ -49,7 +59,7 @@ struct DefaultDemoRepository: DemoInterface { func createChallenge(missionIds: Int, routineNames: [String]) async throws { let userID: Int = userDefaultService.load(key: .userID) ?? 1 - let response: () = try await networkService.request( + let response = try await networkService.request( DemoAPI.createChallenge(userID: userID, requestDTO: .init( homecareRoutineId: missionIds, diff --git a/Cherrish-iOS/Cherrish-iOS/Data/Repository/HomeRepository.swift b/Cherrish-iOS/Cherrish-iOS/Data/Repository/HomeRepository.swift index c7865b3e..f1e5c48e 100644 --- a/Cherrish-iOS/Cherrish-iOS/Data/Repository/HomeRepository.swift +++ b/Cherrish-iOS/Cherrish-iOS/Data/Repository/HomeRepository.swift @@ -22,6 +22,11 @@ struct DefaultHomeRepository: HomeInterface { HomeAPI.fetchDashboard(userID: userID), decodingType: DashboardDTO.self ) + + if dto.challengeName == nil { + _ = userDefaultService.save(false, key: .hasProgressChallenge) + } + CherrishLogger.debug(userDefaultService.load(key: .hasProgressChallenge) ?? false) return dto.toEntity() } diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/Coordinator/ChallengeCoordinator.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/Coordinator/ChallengeCoordinator.swift index 4cc489ad..81e74a01 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/Coordinator/ChallengeCoordinator.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/Coordinator/ChallengeCoordinator.swift @@ -8,7 +8,6 @@ import SwiftUI enum ChallengeRoute: PresentationTypeProtocol { - case root case startChallenge case createChallenge case challengeProgress diff --git a/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/Coordinator/ChallengeCoordinatorView.swift b/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/Coordinator/ChallengeCoordinatorView.swift index c2bb85fa..767cccc7 100644 --- a/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/Coordinator/ChallengeCoordinatorView.swift +++ b/Cherrish-iOS/Cherrish-iOS/Presentation/Feature/ChallengeView/Coordinator/ChallengeCoordinatorView.swift @@ -10,30 +10,36 @@ import SwiftUI struct ChallengeCoordinatorView: View { @EnvironmentObject private var challengeCoordinator: ChallengeCoordinator @EnvironmentObject private var tabBarCoordinator: TabBarCoordinator + private let userDefaultService: UserDefaultService = DefaultUserDefaultService() + var body: some View { NavigationStack(path: $challengeCoordinator.path) { - ViewFactory.shared.makeStartChallengeView() - .navigationDestination(for: ChallengeRoute.self) { route in - Group { - switch route { - case .root: - ViewFactory.shared.makeHomeView() - case .startChallenge: - ViewFactory.shared.makeStartChallengeView() - case .createChallenge: - ViewFactory.shared.makeCreateChallengeView() - .onAppear { - tabBarCoordinator.isTabbarHidden = true - } - case .challengeProgress: - ViewFactory.shared.makeChallengeProgressView() - .onAppear() { - tabBarCoordinator.isTabbarHidden = false - } - } + Group { + if let hasProgress: Bool = userDefaultService.load(key: .hasProgressChallenge), hasProgress { + ViewFactory.shared.makeChallengeProgressView() + } else { + ViewFactory.shared.makeStartChallengeView() + } + } + .navigationDestination(for: ChallengeRoute.self) { route in + Group { + switch route { + case .startChallenge: + ViewFactory.shared.makeStartChallengeView() + case .createChallenge: + ViewFactory.shared.makeCreateChallengeView() + .onAppear { + tabBarCoordinator.isTabbarHidden = true + } + case .challengeProgress: + ViewFactory.shared.makeChallengeProgressView() + .onAppear() { + tabBarCoordinator.isTabbarHidden = false + } } - .navigationBarBackButtonHidden() } + .navigationBarBackButtonHidden() + } } } }