diff --git a/PingPong/Projects/Core/Common/Sources/ViewModel/CommonViewViewModel.swift b/PingPong/Projects/Core/Common/Sources/ViewModel/CommonViewViewModel.swift index 278b8903..42b6f831 100644 --- a/PingPong/Projects/Core/Common/Sources/ViewModel/CommonViewViewModel.swift +++ b/PingPong/Projects/Core/Common/Sources/ViewModel/CommonViewViewModel.swift @@ -43,8 +43,6 @@ public class CommonViewViewModel: ObservableObject { print(selectedFlavorArray) } } - - @Published public var viewPath: NavigationPath = NavigationPath() //MARK: 모달 관련 @Published public var offsetY: CGFloat = 30 diff --git "a/PingPong/Projects/DesignSystem/Resources/ImageAssets.xcassets/SituationSourceFlavorImage/\354\225\204\354\271\264\354\235\264\353\270\214.zip" "b/PingPong/Projects/DesignSystem/Resources/ImageAssets.xcassets/SituationSourceFlavorImage/\354\225\204\354\271\264\354\235\264\353\270\214.zip" deleted file mode 100644 index b5bb74dc..00000000 Binary files "a/PingPong/Projects/DesignSystem/Resources/ImageAssets.xcassets/SituationSourceFlavorImage/\354\225\204\354\271\264\354\235\264\353\270\214.zip" and /dev/null differ diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift index f6cf256d..909ae6ae 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift @@ -22,13 +22,14 @@ public struct LoginView: View { @StateObject var authViewModel: AuthorizationViewModel = AuthorizationViewModel() @StateObject var viewModel: OnBoardingViewModel @StateObject var commonViewViewModel: CommonViewViewModel = CommonViewViewModel() + @State var path: [String] = [] public init(viewModel: OnBoardingViewModel){ self._viewModel = StateObject(wrappedValue: viewModel) } public var body: some View { - NavigationStack { + NavigationStack(path: $path) { VStack(spacing: .zero) { loadingAnimationView() @@ -38,23 +39,25 @@ public struct LoginView: View { authButton() } + .navigationDestination(for: String.self) { state in + switch state { + case "isLogin": + OnBoardingLoginView(viewModel: viewModel, path: $path) + .navigationBarBackButtonHidden() + case "isLoginSuccess": + ServiceUseAgreementView(path: $path) + .environmentObject(viewModel) + default: + OnBoardingView(viewModel: viewModel, path: $path) + .navigationBarBackButtonHidden() + } + } .onAppear{ authViewModel.getRefreshToken() if authViewModel.isDeletAuth { authViewModel.deleteAuth = true } } - - .navigationDestination(isPresented: $viewModel.goToLoginRegisterView) { - OnBoardingView(viewModel: viewModel) - .navigationBarBackButtonHidden() - } - - .navigationDestination(isPresented: $viewModel.goToLoginView){ - OnBoardingLoginView(viewModel: viewModel) - .navigationBarBackButtonHidden() - } - .popup(isPresented: $authViewModel.deleteAuth) { WithDrawPOPUP( image: .empty, @@ -143,18 +146,19 @@ public struct LoginView: View { .frame(height: UIScreen.screenHeight*0.1) VStack(spacing: .zero) { - RoundedRectangle(cornerRadius: 12) - .stroke(Color.primaryOrange, style: .init(lineWidth: 2)) - .frame(height: 56) - .overlay { - Text("로그인하기") - .foregroundStyle(Color.primaryOrangeText) - .pretendardFont(family: .SemiBold, size: 16) - } - .onTapGesture { - viewModel.goToLoginView.toggle() - } - +// RoundedRectangle(cornerRadius: 12) +// .stroke(Color.primaryOrange, style: .init(lineWidth: 2)) +// .frame(height: 56) +// .overlay { +// Text("로그인하기") +// .foregroundStyle(Color.primaryOrangeText) +// .pretendardFont(family: .SemiBold, size: 16) +// } +// .onTapGesture { +// viewModel.goToLoginView.toggle() +// path.append(LoginViewPageState.isLogin.rawValue) +// } + Spacer() .frame(height: 8) @@ -170,9 +174,8 @@ public struct LoginView: View { viewModel.isSignUP = true viewModel.alreadySignUP = false viewModel.goToLoginRegisterView.toggle() + path.append(LoginViewPageState.isEnter.rawValue) } - - } .padding(.horizontal, 20) } @@ -184,3 +187,8 @@ extension LoginView { public static let viewStringKey: String = "LoginView" } } + +enum LoginViewPageState:String, Hashable { + case isLogin + case isEnter +} diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift index ec2faaab..80e44010 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift @@ -21,20 +21,21 @@ struct OnBoardingLoginView: View { @StateObject var commonViewViewModel: CommonViewViewModel = CommonViewViewModel() @StateObject var sheetManager: SheetManager = SheetManager() + @Binding var path: [String] @Environment(\.presentationMode) var presentationMode public init( - viewModel: OnBoardingViewModel - + viewModel: OnBoardingViewModel, + path: Binding<[String]> ) { self._viewModel = ObservedObject(wrappedValue: viewModel) + self._path = path } var body: some View { - NavigationStack { VStack(spacing: .zero) { loadingAnimationView() @@ -42,11 +43,6 @@ struct OnBoardingLoginView: View { cookeWiseSayingView() socialLoginButtonView() - - - } - - .navigationDestination(isPresented: $appState.goToMainHomeView) { CoreView(viewModel: commonViewViewModel, isFistUserPOPUP: $commonViewViewModel.isFirstUserPOPUP) diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingView.swift index cd03582b..f8a5ed49 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingView.swift @@ -21,35 +21,28 @@ public struct OnBoardingView: View { @StateObject var viewModel: OnBoardingViewModel @StateObject var commonViewViewModel: CommonViewViewModel = CommonViewViewModel() @StateObject var sheetManager: SheetManager = SheetManager() + @Binding var path: [String] @Environment(\.presentationMode) var presentationMode public init( - viewModel: OnBoardingViewModel - + viewModel: OnBoardingViewModel, + path: Binding<[String]> ) { self._viewModel = StateObject(wrappedValue: viewModel) + self._path = path } public var body: some View { - NavigationStack { - VStack(spacing: .zero) { - - loadingAnimationView() - - cookeWiseSayingView() - - socialLoginButtonView() - - - } + VStack(spacing: .zero) { + + loadingAnimationView() + + cookeWiseSayingView() + + socialLoginButtonView() - .navigationDestination(isPresented: $appState.serviceUseAgmentView) { - ServiceUseAgreementView() - .environmentObject(viewModel) - } } - .popup(isPresented: $appState.signUPFaillPOPUP) { FloaterPOPUP(image: .errorCircle_rounded, floaterTitle: "알림", floaterSubTitle: "애플로그인에 오류가 생겼습니다. 다시 시도해주세요") @@ -62,7 +55,7 @@ public struct OnBoardingView: View { .closeOnTapOutside(true) } - + } @@ -116,8 +109,6 @@ public struct OnBoardingView: View { Spacer() } .offset(x: -10) - - } .padding(.horizontal, 20) } @@ -132,17 +123,13 @@ public struct OnBoardingView: View { .frame(height: 12) loginWithApple() - } } - + @ViewBuilder private func loginWithApple() -> some View { Spacer() .frame(height: 20) - //mark: - - SignInWithAppleButton(.signIn) { request in authViewModel.nonce = AppleLoginManger.shared.randomNonceString() @@ -159,10 +146,12 @@ public struct OnBoardingView: View { authViewModel.appleLogin(credential: credential) DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - appState.serviceUseAgmentView.toggle() + path.append(OnboardingViewPageState.isLoginSuccess.rawValue) + print(path) } - case .failure(let error): + + case .failure: appState.signUPFaillPOPUP.toggle() presentationMode.wrappedValue.dismiss() } @@ -182,4 +171,6 @@ public struct OnBoardingView: View { } } - +enum OnboardingViewPageState: String, Hashable { + case isLoginSuccess +} diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/ServiceAgmentView/ServiceUseAgreementView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/ServiceAgmentView/ServiceUseAgreementView.swift index 8b2f2264..caadc6a4 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/ServiceAgmentView/ServiceUseAgreementView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/ServiceAgmentView/ServiceUseAgreementView.swift @@ -13,11 +13,13 @@ import SafariServices import API public struct ServiceUseAgreementView: View { - public init() { } + public init(path: Binding<[String]>) { self._path = path} @Environment(\.presentationMode) var presentationMode @EnvironmentObject var viewModel: OnBoardingViewModel + @Binding var path: [String] + public var body: some View { ZStack (alignment: .bottom) { VStack { @@ -158,10 +160,3 @@ public struct ServiceUseAgreementView: View { } } } - -struct ServiceUseAgmentView_Previews: PreviewProvider { - static var previews: some View { - ServiceUseAgreementView() - } -} - diff --git a/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift b/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift index a9c665b1..213352b0 100644 --- a/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift +++ b/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift @@ -62,10 +62,7 @@ struct WithDrawView: View { authViewModel.isDeletAuth = true authViewModel.isLoginCheck = false profileViewModel.randomNickName = "" - print("viewModelviewPath", viewModel.viewPath.count) - while !viewModel.viewPath.isEmpty { - viewModel.viewPath.removeLast() - } + presentationMode.wrappedValue.dismiss() })