diff --git a/Projects/Feature/FeatureLogin/Sources/AgreeToTerms/AgreeToTermsFeature.swift b/Projects/Feature/FeatureLogin/Sources/AgreeToTerms/AgreeToTermsFeature.swift index 21dca3b0..bec21026 100644 --- a/Projects/Feature/FeatureLogin/Sources/AgreeToTerms/AgreeToTermsFeature.swift +++ b/Projects/Feature/FeatureLogin/Sources/AgreeToTerms/AgreeToTermsFeature.swift @@ -39,21 +39,21 @@ public struct AgreeToTermsFeature { /// - Binding case binding(BindingAction) /// - Button Tapped - case nextButtonTapped - case backButtonTapped - case 개인정보_동의_버튼_클릭 - case 서비스_이용약관_버튼_클릭 - case 마케팅_정보_수신_버튼_클릭 + case 다음_버튼_눌렀을때 + case 뒤로가기_버튼_눌렀을때 + case 개인정보_동의_버튼_눌렀을때 + case 서비스_이용약관_버튼_눌렀을때 + case 마케팅_정보_수신_버튼_눌렀을때 } public enum InnerAction: Equatable { - case checkAgreements - case personalAndUsageAgreeSelected - case serviceAgreeSelected - case marketingAgreeSelected - case allAgreementSelected + case 동의_체크_확인 + case 개인정보_동의_선택했을때 + case 서비스_이용약관_동의_선택했을때 + case 마케팅_정보_수신_동의_선택했을때 + case 전체_동의_선택했을때 } - public enum AsyncAction: Equatable { case doNothing } - public enum ScopeAction: Equatable { case doNothing } + public enum AsyncAction: Equatable { case 없음 } + public enum ScopeAction: Equatable { case 없음 } public enum DelegateAction: Equatable { case pushRegisterNicknameView } @@ -91,29 +91,29 @@ private extension AgreeToTermsFeature { /// - View Effect func handleViewAction(_ action: Action.ViewAction, state: inout State) -> Effect { switch action { - case .nextButtonTapped: + case .다음_버튼_눌렀을때: return .send(.delegate(.pushRegisterNicknameView)) - case .backButtonTapped: + case .뒤로가기_버튼_눌렀을때: return .run { _ in await self.dismiss() } case .binding(\.isAgreeAllTerms): - return .send(.inner(.allAgreementSelected)) + return .send(.inner(.전체_동의_선택했을때)) case .binding(\.isPersonalAndUsageArgee): - return .send(.inner(.personalAndUsageAgreeSelected)) + return .send(.inner(.개인정보_동의_선택했을때)) case .binding(\.isServiceAgree): - return .send(.inner(.serviceAgreeSelected)) + return .send(.inner(.서비스_이용약관_동의_선택했을때)) case .binding(\.isMarketingAgree): - return .send(.inner(.marketingAgreeSelected)) + return .send(.inner(.마케팅_정보_수신_동의_선택했을때)) case .binding: return .none - case .개인정보_동의_버튼_클릭: + case .개인정보_동의_버튼_눌렀을때: state.webViewURL = Constants.개인정보_처리방침_주소 state.isWebViewPresented = true return .none - case .서비스_이용약관_버튼_클릭: + case .서비스_이용약관_버튼_눌렀을때: state.webViewURL = Constants.서비스_이용약관_주소 state.isWebViewPresented = true return .none - case .마케팅_정보_수신_버튼_클릭: + case .마케팅_정보_수신_버튼_눌렀을때: state.webViewURL = Constants.마케팅_정보_수신_주소 state.isWebViewPresented = true return .none @@ -123,19 +123,19 @@ private extension AgreeToTermsFeature { func handleInnerAction(_ action: Action.InnerAction, state: inout State) -> Effect { switch action { /// - 개별 동의 체크 박스를 확인 하여 전체 동의 체크 여부 결정 - case .checkAgreements: + case .동의_체크_확인: let isAgreeAllterm = state.isPersonalAndUsageArgee && state.isServiceAgree && state.isMarketingAgree state.isAgreeAllTerms = isAgreeAllterm return .none /// - 각각의 개별 동의 체크박스가 선택 되었을 때 - case .personalAndUsageAgreeSelected, - .serviceAgreeSelected, - .marketingAgreeSelected: - return .send(.inner(.checkAgreements)) + case .개인정보_동의_선택했을때, + .서비스_이용약관_동의_선택했을때, + .마케팅_정보_수신_동의_선택했을때: + return .send(.inner(.동의_체크_확인)) /// - 전체 동의 체크박으가 선택 되었을 때 - case .allAgreementSelected: + case .전체_동의_선택했을때: state.isPersonalAndUsageArgee = state.isAgreeAllTerms state.isServiceAgree = state.isAgreeAllTerms state.isMarketingAgree = state.isAgreeAllTerms diff --git a/Projects/Feature/FeatureLogin/Sources/AgreeToTerms/AgreeToTermsView.swift b/Projects/Feature/FeatureLogin/Sources/AgreeToTerms/AgreeToTermsView.swift index 39e20bbb..3361dae5 100644 --- a/Projects/Feature/FeatureLogin/Sources/AgreeToTerms/AgreeToTermsView.swift +++ b/Projects/Feature/FeatureLogin/Sources/AgreeToTerms/AgreeToTermsView.swift @@ -40,7 +40,7 @@ public extension AgreeToTermsView { PokitBottomButton( "다음", state: store.isPersonalAndUsageArgee && store.isServiceAgree ? .filled(.primary) : .disable, - action: { send(.nextButtonTapped) } + action: { send(.다음_버튼_눌렀을때) } ) } .pokitMaxWidth() @@ -49,7 +49,7 @@ public extension AgreeToTermsView { PokitHeader { PokitHeaderItems(placement: .leading) { PokitToolbarButton(.icon(.arrowLeft)) { - send(.backButtonTapped) + send(.뒤로가기_버튼_눌렀을때) } } } @@ -98,19 +98,19 @@ extension AgreeToTermsView { termsButton( "(필수)개인정보 수집 및 이용 동의", isSelected: $store.isPersonalAndUsageArgee, - action: { send(.개인정보_동의_버튼_클릭) } + action: { send(.개인정보_동의_버튼_눌렀을때) } ) termsButton( "(필수)서비스 이용약관", isSelected: $store.isServiceAgree, - action: { send(.서비스_이용약관_버튼_클릭) } + action: { send(.서비스_이용약관_버튼_눌렀을때) } ) termsButton( "(선택)마케팅 정보 수신", isSelected: $store.isMarketingAgree, - action: { send(.마케팅_정보_수신_버튼_클릭) } + action: { send(.마케팅_정보_수신_버튼_눌렀을때) } ) } .padding(.leading, 20) diff --git a/Projects/Feature/FeatureLogin/Sources/Login/LoginFeature.swift b/Projects/Feature/FeatureLogin/Sources/Login/LoginFeature.swift index d02e8d28..a5e2c166 100644 --- a/Projects/Feature/FeatureLogin/Sources/Login/LoginFeature.swift +++ b/Projects/Feature/FeatureLogin/Sources/Login/LoginFeature.swift @@ -45,21 +45,22 @@ public struct LoginFeature { @CasePathable public enum View: Equatable { /// - Button Tapped - case appleLoginButtonTapped - case googleLoginButtonTapped + case 애플로그인_버튼_눌렀을때 + case 구글로그인_버튼_눌렀을때 } public enum InnerAction: Equatable { - case pushAgreeToTermsView - case pushRegisterNicknameView - case pushSelectFieldView(nickname: String) - case pushSignUpDoneView - case 애플로그인(SocialLoginInfo) - case 구글로그인(SocialLoginInfo) + case 약관동의_화면이동 + case 닉네임_등록_화면이동 + case 관심분야_선택_화면이동(nickname: String) + case 회원가입_완료_화면이동 case 로그인_이후_화면이동(isRegistered: Bool) } public enum AsyncAction: Equatable { - case 회원가입 - case 로그인(SocialLoginInfo) + case 회원가입_API + case 애플로그인_API(SocialLoginInfo) + case 구글로그인_API(SocialLoginInfo) + case 애플로그인_소셜_API + case 구글로그인_소셜_API } public enum ScopeAction { case agreeToTerms(AgreeToTermsFeature.Action.DelegateAction) @@ -106,34 +107,48 @@ private extension LoginFeature { /// - View Effect func handleViewAction(_ action: Action.View, state: inout State) -> Effect { switch action { - case .appleLoginButtonTapped: - return .run { send in - let response = try await socialLogin.appleLogin() - await send(.async(.로그인(response))) - } - - case .googleLoginButtonTapped: - return .run { send in - let response = try await socialLogin.googleLogin() - await send(.async(.로그인(response))) - } + case .애플로그인_버튼_눌렀을때: + return .send(.async(.애플로그인_소셜_API)) + case .구글로그인_버튼_눌렀을때: + return .send(.async(.구글로그인_소셜_API)) } } /// - Inner Effect func handleInnerAction(_ action: Action.InnerAction, state: inout State) -> Effect { switch action { - case .pushAgreeToTermsView: + case .약관동의_화면이동: state.path.append(.agreeToTerms(AgreeToTermsFeature.State())) return .none - case .pushRegisterNicknameView: + case .닉네임_등록_화면이동: state.path.append(.registerNickname(RegisterNicknameFeature.State())) return .none - case .pushSelectFieldView(let nickname): + case .관심분야_선택_화면이동(let nickname): state.path.append(.selecteField(SelectFieldFeature.State(nickname: nickname))) return .none - case .pushSignUpDoneView: + case .회원가입_완료_화면이동: return .send(.delegate(.회원가입_완료_화면_이동)) - case let .애플로그인(response): + case let .로그인_이후_화면이동(isRegistered): + /// [3]. 이미 회원가입했던 유저라면 `메인`이동 + if isRegistered { + return .run { send in await send(.delegate(.dismissLoginRootView)) } + } else { + return .run { send in await send(.inner(.약관동의_화면이동)) } + } + } + } + /// - Async Effect + func handleAsyncAction(_ action: Action.AsyncAction, state: inout State) -> Effect { + switch action { + case .회원가입_API: + return .run { [nickName = state.nickName, interests = state.interests] send in + guard let nickName else { return } + guard let interests else { return } + let signUpRequest = SignupRequest(nickName: nickName, interests: interests) + let _ = try await userClient.회원등록(signUpRequest) + + await send(.inner(.회원가입_완료_화면이동)) + } + case let .애플로그인_API(response): return .run { send in guard let idToken = response.idToken else { return } guard let authCode = response.authCode else { return } @@ -157,7 +172,7 @@ private extension LoginFeature { await send(.inner(.로그인_이후_화면이동(isRegistered: tokenResponse.isRegistered))) } - case let .구글로그인(response): + case let .구글로그인_API(response): return .run { send in guard let idToken = response.idToken else { return } let platform = response.provider.description @@ -173,34 +188,15 @@ private extension LoginFeature { await send(.inner(.로그인_이후_화면이동(isRegistered: tokenResponse.isRegistered))) } - case let .로그인_이후_화면이동(isRegistered): - /// [3]. 이미 회원가입했던 유저라면 `메인`이동 - if isRegistered { - return .run { send in await send(.delegate(.dismissLoginRootView)) } - } else { - return .run { send in await send(.inner(.pushAgreeToTermsView)) } - } - } - } - /// - Async Effect - func handleAsyncAction(_ action: Action.AsyncAction, state: inout State) -> Effect { - switch action { - case .회원가입: - return .run { [nickName = state.nickName, interests = state.interests] send in - guard let nickName else { return } - guard let interests else { return } - let signUpRequest = SignupRequest(nickName: nickName, interests: interests) - let _ = try await userClient.회원등록(signUpRequest) - - await send(.inner(.pushSignUpDoneView)) + case .애플로그인_소셜_API: + return .run { send in + let response = try await socialLogin.appleLogin() + await send(.async(.애플로그인_API(response))) } - - case .로그인(let response): - switch response.provider { - case .apple: - return .run { send in await send(.inner(.애플로그인(response))) } - case .google: - return .run { send in await send(.inner(.구글로그인(response))) } + case .구글로그인_소셜_API: + return .run { send in + let response = try await socialLogin.googleLogin() + await send(.async(.구글로그인_API(response))) } } } @@ -210,19 +206,19 @@ private extension LoginFeature { case .agreeToTerms(let delegate): switch delegate { case .pushRegisterNicknameView: - return .send(.inner(.pushRegisterNicknameView)) + return .send(.inner(.닉네임_등록_화면이동)) } case .registerNickname(let delegate): switch delegate { case .pushSelectFieldView(let nickname): state.nickName = nickname - return .send(.inner(.pushSelectFieldView(nickname: nickname))) + return .send(.inner(.관심분야_선택_화면이동(nickname: nickname))) } case .selectField(let delegate): switch delegate { case let .pushSignUpDoneView(interests): state.interests = interests - return .send(.async(.회원가입)) + return .send(.async(.회원가입_API)) } } } diff --git a/Projects/Feature/FeatureLogin/Sources/Login/LoginView.swift b/Projects/Feature/FeatureLogin/Sources/Login/LoginView.swift index 17519224..7452a7e1 100644 --- a/Projects/Feature/FeatureLogin/Sources/Login/LoginView.swift +++ b/Projects/Feature/FeatureLogin/Sources/Login/LoginView.swift @@ -82,7 +82,7 @@ extension LoginView { private var appleLoginButton: some View { Button { - send(.appleLoginButtonTapped) + send(.애플로그인_버튼_눌렀을때) } label: { appleLoginButtonLabel } @@ -123,7 +123,7 @@ extension LoginView { private var googleLoginButton: some View { Button { - send(.googleLoginButtonTapped) + send(.구글로그인_버튼_눌렀을때) } label: { googleLoginButtonLabel } diff --git a/Projects/Feature/FeatureLogin/Sources/RegisterNickname/RegisterNicknameFeature.swift b/Projects/Feature/FeatureLogin/Sources/RegisterNickname/RegisterNicknameFeature.swift index 64b5da36..ee5bf4df 100644 --- a/Projects/Feature/FeatureLogin/Sources/RegisterNickname/RegisterNicknameFeature.swift +++ b/Projects/Feature/FeatureLogin/Sources/RegisterNickname/RegisterNicknameFeature.swift @@ -45,17 +45,19 @@ public struct RegisterNicknameFeature { /// - Binding case binding(BindingAction) /// - Button Tapped - case nextButtonTapped - case backButtonTapped + case 다음_버튼_눌렀을때 + case dismiss } + public enum InnerAction: Equatable { - case textChanged - case 닉네임_중복_체크_네트워크_결과(Bool) + case 닉네임_텍스트_변경되었을때 + case 닉네임_중복_체크_API_반영(Bool) } + public enum AsyncAction: Equatable { - case 닉네임_중복_체크_네트워크 + case 닉네임_중복_체크_API } - public enum ScopeAction: Equatable { case doNothing } + public enum ScopeAction: Equatable { case 없음 } public enum DelegateAction: Equatable { case pushSelectFieldView(nickname: String) } @@ -94,18 +96,14 @@ private extension RegisterNicknameFeature { /// - View Effect func handleViewAction(_ action: Action.ViewAction, state: inout State) -> Effect { switch action { - case .nextButtonTapped: - return .run { [nickName = state.nicknameText] send in - await send(.delegate(.pushSelectFieldView(nickname: nickName))) - } - case .backButtonTapped: + case .다음_버튼_눌렀을때: + let nickname = state.nicknameText + return .send(.delegate(.pushSelectFieldView(nickname: nickname))) + case .dismiss: return .run { _ in await self.dismiss() } case .binding(\.nicknameText): state.buttonActive = false - return .run { send in - await send(.inner(.textChanged)) - } - .debounce( + return .send(.inner(.닉네임_텍스트_변경되었을때)).debounce( id: CancelID.response, for: 0.5, scheduler: mainQueue @@ -117,7 +115,7 @@ private extension RegisterNicknameFeature { /// - Inner Effect func handleInnerAction(_ action: Action.InnerAction, state: inout State) -> Effect { switch action { - case .textChanged: + case .닉네임_텍스트_변경되었을때: /// [1]. 닉네임 텍스트필드가 비어있을 때 if state.nicknameText.isEmpty { state.buttonActive = false @@ -136,10 +134,10 @@ private extension RegisterNicknameFeature { return .none } else { /// [4]. 정상 케이스일 때 - return .run { send in await send(.async(.닉네임_중복_체크_네트워크)) } + return .run { send in await send(.async(.닉네임_중복_체크_API)) } } - case let .닉네임_중복_체크_네트워크_결과(isDuplicate): + case let .닉네임_중복_체크_API_반영(isDuplicate): if isDuplicate { state.textfieldState = .error(message: "중복된 닉네임입니다.") state.buttonActive = false @@ -153,10 +151,10 @@ private extension RegisterNicknameFeature { /// - Async Effect func handleAsyncAction(_ action: Action.AsyncAction, state: inout State) -> Effect { switch action { - case .닉네임_중복_체크_네트워크: + case .닉네임_중복_체크_API: return .run { [nickName = state.nicknameText] send in let result = try await userClient.닉네임_중복_체크(nickName) - await send(.inner(.닉네임_중복_체크_네트워크_결과(result.isDuplicate))) + await send(.inner(.닉네임_중복_체크_API_반영(result.isDuplicate))) } } } diff --git a/Projects/Feature/FeatureLogin/Sources/RegisterNickname/RegisterNicknameView.swift b/Projects/Feature/FeatureLogin/Sources/RegisterNickname/RegisterNicknameView.swift index e321c920..83cf8c24 100644 --- a/Projects/Feature/FeatureLogin/Sources/RegisterNickname/RegisterNicknameView.swift +++ b/Projects/Feature/FeatureLogin/Sources/RegisterNickname/RegisterNicknameView.swift @@ -42,7 +42,7 @@ public extension RegisterNicknameView { state: store.buttonActive ? .filled(.primary) : .disable, - action: { send(.nextButtonTapped) } + action: { send(.다음_버튼_눌렀을때) } ) .setKeyboardHeight() } @@ -52,7 +52,7 @@ public extension RegisterNicknameView { PokitHeader { PokitHeaderItems(placement: .leading) { PokitToolbarButton(.icon(.arrowLeft)) { - send(.backButtonTapped) + send(.dismiss) } } } diff --git a/Projects/Feature/FeatureLogin/Sources/SelectField/SelectFieldFeature.swift b/Projects/Feature/FeatureLogin/Sources/SelectField/SelectFieldFeature.swift index fa069c78..38771fd6 100644 --- a/Projects/Feature/FeatureLogin/Sources/SelectField/SelectFieldFeature.swift +++ b/Projects/Feature/FeatureLogin/Sources/SelectField/SelectFieldFeature.swift @@ -48,8 +48,8 @@ public struct SelectFieldFeature { public enum InnerAction: Equatable { case 관심사_목록_조회_결과(interests: [InterestResponse]) } - public enum AsyncAction: Equatable { case doNothing } - public enum ScopeAction: Equatable { case doNothing } + public enum AsyncAction: Equatable { case 없음 } + public enum ScopeAction: Equatable { case 없음 } public enum DelegateAction: Equatable { case pushSignUpDoneView(interests: [String]) } diff --git a/Projects/Feature/FeatureLogin/Sources/SignUpDone/SignUpDoneFeature.swift b/Projects/Feature/FeatureLogin/Sources/SignUpDone/SignUpDoneFeature.swift index df3fa547..4a9a50ff 100644 --- a/Projects/Feature/FeatureLogin/Sources/SignUpDone/SignUpDoneFeature.swift +++ b/Projects/Feature/FeatureLogin/Sources/SignUpDone/SignUpDoneFeature.swift @@ -35,16 +35,16 @@ public struct SignUpDoneFeature { @CasePathable public enum View: Equatable { /// - Button Tapped - case startButtonTapped + case 시작_버튼_눌렀을때 - case firecrackerOnAppeared - case titleOnAppeared - case confettiOnAppeared - case pookiOnAppeared + case 폭죽불꽃_이미지_나타났을때 + case 제목_나타났을때 + case 폭죽_이미지_나타났을때 + case 푸키_이미지_나타났을때 } - public enum InnerAction: Equatable { case doNothing } - public enum AsyncAction: Equatable { case doNothing } - public enum ScopeAction: Equatable { case doNothing } + public enum InnerAction: Equatable { case 없음 } + public enum AsyncAction: Equatable { case 없음 } + public enum ScopeAction: Equatable { case 없음 } public enum DelegateAction: Equatable { case dismissLoginRootView } @@ -81,18 +81,18 @@ private extension SignUpDoneFeature { /// - View Effect func handleViewAction(_ action: Action.ViewAction, state: inout State) -> Effect { switch action { - case .startButtonTapped: + case .시작_버튼_눌렀을때: return .send(.delegate(.dismissLoginRootView), animation: .pokitDissolve) - case .firecrackerOnAppeared: + case .폭죽불꽃_이미지_나타났을때: state.firecrackIsAppear = true return .none - case .titleOnAppeared: + case .제목_나타났을때: state.titleIsAppear = true return .none - case .confettiOnAppeared: + case .폭죽_이미지_나타났을때: state.confettiIsAppear = true return .none - case .pookiOnAppeared: + case .푸키_이미지_나타났을때: state.pookiIsAppear = true return .none } diff --git a/Projects/Feature/FeatureLogin/Sources/SignUpDone/SignUpDoneView.swift b/Projects/Feature/FeatureLogin/Sources/SignUpDone/SignUpDoneView.swift index d5f5c0de..018e4360 100644 --- a/Projects/Feature/FeatureLogin/Sources/SignUpDone/SignUpDoneView.swift +++ b/Projects/Feature/FeatureLogin/Sources/SignUpDone/SignUpDoneView.swift @@ -41,7 +41,7 @@ public extension SignUpDoneView { PokitBottomButton( "시작하기", state: .filled(.primary), - action: { send(.startButtonTapped) } + action: { send(.시작_버튼_눌렀을때) } ) .pokitMaxWidth() .padding(.horizontal, 20) @@ -65,7 +65,7 @@ extension SignUpDoneView { store.firecrackIsAppear ? 1 : 0, anchor: .bottomTrailing ) - .onAppear { send(.firecrackerOnAppeared, animation: .pokitSpring) } + .onAppear { send(.폭죽불꽃_이미지_나타났을때, animation: .pokitSpring) } Spacer() } @@ -83,7 +83,7 @@ extension SignUpDoneView { .multilineTextAlignment(.center) } .opacity(store.titleIsAppear ? 1 : 0) - .onAppear { send(.titleOnAppeared, animation: .pokitDissolve) } + .onAppear { send(.제목_나타났을때, animation: .pokitDissolve) } } private var images: some View { @@ -97,7 +97,7 @@ extension SignUpDoneView { store.confettiIsAppear ? 1 : 0, anchor: .bottom ) - .onAppear { send(.confettiOnAppeared, animation: .pokitSpring) } + .onAppear { send(.폭죽_이미지_나타났을때, animation: .pokitSpring) } Image(.character(.pooki)) .resizable() @@ -107,7 +107,7 @@ extension SignUpDoneView { store.pookiIsAppear ? 1 : 0, anchor: .bottom ) - .onAppear{ send(.pookiOnAppeared, animation: .pokitSpring) } + .onAppear{ send(.푸키_이미지_나타났을때, animation: .pokitSpring) } } } }