Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TNT-221] 기존 User API 최신화, OnboardingFlow 중 회원가입 연결 #63

Merged
merged 9 commits into from
Feb 10, 2025

Conversation

FpRaArNkK
Copy link
Contributor

📌 What is the PR?

  • 기존에 존재하던 UserAPI를 최신화했습니다
  • OnboardingFlow 중 트레이너/트레이니의 회원 가입 플로우까지 API를 연결했습니다.

🪄 Changes

  • User API 최신화
  • TermView LoginView에 연결
  • 트레이너 회원가입 연결
  • 트레이니 회원가입 연결

🌐 Common Changes

  • 기존 OnboardingFlow에서 TermView가 NavPath에 직접 append 되는 것으로 작업되어있었는데, 이는 modal로 표시되는 바텀시트 - TermView의 표시 방식과 맞지 않습니다.
  • 따라서 Tree-based 관리 방식에 맞춰 LoginView에 연결하고, 별도의 ifLet - Reducer를 통해 표시하는 것으로 변경했습니다.

🔥 PR Point

  1. 각 OnboardingFlow / TraineeMainFlow / TrainerMainFlow 간 흐름 전환이 필요하므로 AppCoordinator에 setFlow 함수를, 각 FlowCoordinator에 switchFlow 함수를 추가했습니다. 각 Flow에서 switchFlow action 발생 시 AppCoordinator가 이를 감지하여 setFlow를 통해 화면에 표시되는 플로우를 변경하는 방식입니다.
 public enum Action {
        /// 하위 코디네이터에서 일어나는 액션을 처리합니다
        case subFeature(SubFeatureAction)
        
        @CasePathable
        public enum SubFeatureAction: Sendable {
            /// 온보딩 플로우 코디네이터에서 발생하는 액션 처리
            case onboardingFlow(OnboardingFlowFeature.Action)
            /// 트레이너 메인탭 플로우 코디네이터에서 발생하는 액션 처리
            case trainerMainFlow(TrainerMainFlowFeature.Action)
            /// 트레이니 메인탭 플로우 코디네이터에서 발생하는 액션 처리
            case traineeMainFlow(TraineeMainFlowFeature.Action)
        }
        
        ... 
        
        Reduce { state, action in
            switch action {
            case .subFeature(let internalAction):
                switch internalAction {
                case .onboardingFlow(.switchFlow(let flow)):
                    return self.setFlow(flow, state: &state)
                    
                    
      ...
      
      /// 앱의 흐름을 조절합니다
    /// 선택된 플로우에 따라 유저타입도 분기처리됩니다
    private func setFlow(_ flow: AppFlow, state: inout State) -> Effect<Action> {
        state.onboardingState = nil
        state.traineeMainState = nil
        state.trainerMainState = nil
        
        switch flow {
        case .onboardingFlow:
            state.userType = nil
            state.onboardingState = .init()
        case .traineeMainFlow:
            state.userType = .trainee
            state.traineeMainState = .init()
        case .trainerMainFlow:
            state.userType = .trainer
            state.trainerMainState = .init()
        }
        
        return .none
    }
}

🙆🏻 To Reviewers

  • 이어서 세션 체크 코드 + 트레이너/트레이니 연결 코드 PR 예정입니다

💭 Related Issues

@FpRaArNkK FpRaArNkK added the ✨Feat 새로운 기능 구현 (새로운 로직 추가, UI 구현 등) label Feb 8, 2025
@FpRaArNkK FpRaArNkK requested a review from syss220211 February 8, 2025 22:47
@FpRaArNkK FpRaArNkK self-assigned this Feb 8, 2025
@FpRaArNkK FpRaArNkK merged commit a551f08 into develop Feb 10, 2025
@FpRaArNkK FpRaArNkK deleted the TNT-221-apiConnectionBase branch February 12, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨Feat 새로운 기능 구현 (새로운 로직 추가, UI 구현 등)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants