@@ -37,8 +37,7 @@ final class ResultRecommendedRoutineViewController: BaseViewController<ResultRec
3737
3838 var confirmButtonLabel : String {
3939 switch self {
40- case . onboarding: " 등록하기 "
41- case . mypage: " 확인 "
40+ case . onboarding, . mypage: " 등록하기 "
4241 case . emotion: " 맞춤 추천 루틴 보러 가기 "
4342 }
4443 }
@@ -54,9 +53,9 @@ final class ResultRecommendedRoutineViewController: BaseViewController<ResultRec
5453
5554 var isRoutineButtonEnabled : Bool {
5655 switch self {
57- case . onboarding, . emotion :
56+ case . onboarding, . mypage :
5857 true
59- case . mypage :
58+ case . emotion :
6059 false
6160 }
6261 }
@@ -132,7 +131,7 @@ final class ResultRecommendedRoutineViewController: BaseViewController<ResultRec
132131 case . onboarding, . mypage:
133132 configureCustomNavigationBar ( navigationBarStyle: . withProgressBar( step: OnboardingType . allCases. count + 1 ) )
134133 case . emotion:
135- configureCustomNavigationBar ( navigationBarStyle: . withBackButton ( title: " " ) )
134+ configureCustomNavigationBar ( navigationBarStyle: . withTitle ( title: " " ) )
136135 }
137136
138137 let mainLabelText = entryPoint. mainLabelText
@@ -216,9 +215,9 @@ final class ResultRecommendedRoutineViewController: BaseViewController<ResultRec
216215 case . onboarding:
217216 confirmButton = PrimaryButton ( buttonState: . disabled, buttonTitle: entryPoint. confirmButtonLabel)
218217 case . mypage:
219- confirmButton = PrimaryButton ( buttonState: . default, buttonTitle: entryPoint. confirmButtonLabel)
220- case . emotion:
221218 confirmButton = PrimaryButton ( buttonState: . disabled, buttonTitle: entryPoint. confirmButtonLabel)
219+ case . emotion:
220+ confirmButton = PrimaryButton ( buttonState: . default, buttonTitle: entryPoint. confirmButtonLabel)
222221 }
223222 }
224223
@@ -312,20 +311,27 @@ final class ResultRecommendedRoutineViewController: BaseViewController<ResultRec
312311 }
313312
314313 private func configureSkipButton( ) {
315- skipButton. addAction ( UIAction { [ weak self] _ in
316- guard let self else { return }
317- switch entryPoint {
318- case . emotion:
319- if let navigationController = self . navigationController {
320- let viewControllers = navigationController. viewControllers
321- if viewControllers. count >= 3 {
322- navigationController. popToViewController ( viewControllers [ viewControllers. count - 3 ] , animated: false )
314+ skipButton. addAction (
315+ UIAction { [ weak self] _ in
316+ guard let self else { return }
317+ switch entryPoint {
318+ case . emotion:
319+ if
320+ let windowScene = UIApplication . shared. connectedScenes. first as? UIWindowScene ,
321+ let window = windowScene. windows. first ( where: { $0. isKeyWindow } ) ,
322+ let tabBarView = window. rootViewController as? TabBarView {
323+ self . navigationController? . popToRootViewController ( animated: false )
324+ tabBarView. selectedIndex = 0
323325 }
326+
327+ case . onboarding:
328+ goToNextView ( )
329+
330+ case . mypage:
331+ break
324332 }
325- case . onboarding, . mypage:
326- goToNextView ( )
327- }
328- } , for: . touchUpInside)
333+ } ,
334+ for: . touchUpInside)
329335 }
330336
331337 private func goToNextView( ) {
@@ -337,6 +343,9 @@ final class ResultRecommendedRoutineViewController: BaseViewController<ResultRec
337343 }
338344
339345 case . mypage:
346+ viewModel. action ( input: . fetchSelectedRoutineId)
347+
348+ case . emotion:
340349 if
341350 let windowScene = UIApplication . shared. connectedScenes. first as? UIWindowScene ,
342351 let window = windowScene. windows. first ( where: { $0. isKeyWindow } ) ,
@@ -345,16 +354,16 @@ final class ResultRecommendedRoutineViewController: BaseViewController<ResultRec
345354 tabBarView. selectedIndex = 1
346355 }
347356 viewModel. action ( input: . showRecommendedRoutineToastMessageView)
348-
349- case . emotion:
350- viewModel. action ( input: . fetchSelectedRoutineId)
351357 }
352358 }
353359
354360 private func goToRoutineCreationView( routineId: Int ) {
355361 guard let routineCreationViewModel = DIContainer . shared. resolve ( type: RoutineCreationViewModel . self)
356362 else { fatalError ( " routineCreationViewModel 의존성이 등록되지 않았습니다. " ) }
357- let routineCreationView = RoutineCreationViewController ( viewModel: routineCreationViewModel, recommendRoutineId: routineId)
363+ let routineCreationView = RoutineCreationViewController (
364+ viewModel: routineCreationViewModel,
365+ recommendRoutineId: routineId,
366+ isFromMypage: true )
358367 routineCreationView. hidesBottomBarWhenPushed = true
359368 self . navigationController? . pushViewController ( routineCreationView, animated: true )
360369 }
0 commit comments