diff --git a/PingPong/Projects/Core/Common/Sources/ViewModel/CommonViewViewModel.swift b/PingPong/Projects/Core/Common/Sources/ViewModel/CommonViewViewModel.swift index 92135ff0..566be144 100644 --- a/PingPong/Projects/Core/Common/Sources/ViewModel/CommonViewViewModel.swift +++ b/PingPong/Projects/Core/Common/Sources/ViewModel/CommonViewViewModel.swift @@ -28,20 +28,21 @@ public class CommonViewViewModel: ObservableObject { } } - @Published public var isLoginCheck: Bool = false + @Published public var isLoginCheck: Bool = false { + didSet { + coreViewPath.removeAll() + viewPath.removeAll() + } + } @AppStorage("isLogin") public var isLogin: Bool = false { didSet { - self.isLoginCheck = isLogin + isLoginCheck = isLogin } } @Published public var viewPath: [ViewState] = [] - @Published public var coreViewPath: [CoreViewState] = [] { - didSet { - print("CoreViewPath: " ,coreViewPath) - } - } + @Published public var coreViewPath: [CoreViewState] = [] @Published public var firstUserPOPUP: Bool = false @@ -49,16 +50,8 @@ public class CommonViewViewModel: ObservableObject { @Published public var goToMainView: Bool = false @Published public var customTabs: [CustomTab] = [] - @Published public var selectedSourceArray: [Source] = [] { - didSet { - print(selectedSourceArray) - } - } - @Published public var selectedFlavorArray: [Flavor] = [] { - didSet { - print(selectedFlavorArray) - } - } + @Published public var selectedSourceArray: [Source] = [] + @Published public var selectedFlavorArray: [Flavor] = [] //MARK: 모달 관련 @Published public var offsetY: CGFloat = 30 diff --git a/PingPong/Projects/Feature/Archive/Sources/UI/View/ArchiveView.swift b/PingPong/Projects/Feature/Archive/Sources/UI/View/ArchiveView.swift index 2dc2b37c..11a6b6ae 100644 --- a/PingPong/Projects/Feature/Archive/Sources/UI/View/ArchiveView.swift +++ b/PingPong/Projects/Feature/Archive/Sources/UI/View/ArchiveView.swift @@ -35,9 +35,9 @@ public struct ArchiveView: View { public var body: some View { VStack(){ archiveHeader() - - staticsView(count: viewModel.bookmarkCards.count) - + if !viewModel.bookmarkCards.isEmpty { + staticsView(count: viewModel.bookmarkCards.count) + } if !viewModel.bookmarkCards.isEmpty { ScrollView(.vertical) { LazyVGrid(columns: columns) { diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/FavoriteWiseChoseView/SelectCharacterView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/FavoriteWiseChoseView/SelectCharacterView.swift index dbabaef6..bb36b9bd 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/FavoriteWiseChoseView/SelectCharacterView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/FavoriteWiseChoseView/SelectCharacterView.swift @@ -20,9 +20,9 @@ public struct SelectCharacterView: View { @StateObject var appState: OnBoardingAppState = OnBoardingAppState() @StateObject var authViewModel: AuthorizationViewModel = AuthorizationViewModel() - public init(viewModel: OnBoardingViewModel, commonViewModel: CommonViewViewModel) { + public init(viewModel: OnBoardingViewModel, commonViewViewModel: CommonViewViewModel) { self._viewModel = StateObject(wrappedValue: viewModel) - self._commonViewViewModel = StateObject(wrappedValue: commonViewModel) + self._commonViewViewModel = StateObject(wrappedValue: commonViewViewModel) } @Environment(\.presentationMode) var presentationMode diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/LoginSettingView/CompleteLoginView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/LoginSettingView/CompleteLoginView.swift index 10545002..320226aa 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/LoginSettingView/CompleteLoginView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/LoginSettingView/CompleteLoginView.swift @@ -15,15 +15,15 @@ import Model import Common public struct CompleteLoginView: View { - @StateObject private var commonViewModel: CommonViewViewModel + @StateObject private var commonViewViewModel: CommonViewViewModel @StateObject private var viewModel: OnBoardingViewModel @Environment(\.presentationMode) var presentationMode @StateObject var authViewModel: AuthorizationViewModel = AuthorizationViewModel() let columns = Array(repeating: GridItem(.flexible()), count: 3) - public init(viewModel: OnBoardingViewModel, commonViewModel: CommonViewViewModel) { + public init(viewModel: OnBoardingViewModel, commonViewViewModel: CommonViewViewModel) { self._viewModel = StateObject(wrappedValue: viewModel) - self._commonViewModel = StateObject(wrappedValue: commonViewModel) + self._commonViewViewModel = StateObject(wrappedValue: commonViewViewModel) } @@ -125,7 +125,7 @@ public struct CompleteLoginView: View { .foregroundColor(.basicWhite) .font(.system(size: 16)) .onTapGesture { - commonViewModel.viewPath.append(ViewState.isCompleteLogin) + commonViewViewModel.viewPath.append(ViewState.isCompleteLogin) //MARK: - 임시로 하드 코딩 나중에 로그인 성공하면 success action에 추가 //TODO: 회원가입 중간에 나가면 뷰깨지는 문제 해결 viewModel.completdSignUP = true 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 c852019a..f7734077 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/LoginView.swift @@ -58,13 +58,13 @@ public struct LoginView: View { case .isNickNameComplete: LoginJobSettingView(viewModel: self.viewModel, commonViewViewModel: commonViewViewModel) case .isJobSettingComplete: - CompleteLoginView(viewModel: self.viewModel, commonViewModel: self.commonViewViewModel) + CompleteLoginView(viewModel: self.viewModel, commonViewViewModel: self.commonViewViewModel) case .isCompleteLogin: FavoriteWiseChooseView(viewModel: self.viewModel, commonViewViewModel: commonViewViewModel) case .isStartChoiceFavorite: SelectCategoryView(viewModel: self.viewModel, commonViewViewModel: commonViewViewModel) case .isSelectedCategory: - SelectCharacterView(viewModel: self.viewModel, commonViewModel: commonViewViewModel) + SelectCharacterView(viewModel: self.viewModel, commonViewViewModel: commonViewViewModel) case .isSelectedCharacter: OnBoardingPushView(viewModel: self.viewModel, commonViewViewModel: commonViewViewModel) 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 8a9e8572..b0f3dbcd 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/MainView/OnBoardingLoginView.swift @@ -157,7 +157,7 @@ public struct OnBoardingLoginView: View { succesCompletion: { commonViewViewModel.isLogin = true - commonViewViewModel.viewPath.append(ViewState.isLoginned) + commonViewViewModel.isLoginCheck = true }, failLoginCompletion: { appState.signUPFaillPOPUP.toggle() diff --git a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/OnBoardingPushViiew/CompletOnBoardingView.swift b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/OnBoardingPushViiew/CompletOnBoardingView.swift index 7a82922c..a478c07a 100644 --- a/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/OnBoardingPushViiew/CompletOnBoardingView.swift +++ b/PingPong/Projects/Feature/OnBoarding/Sources/UI/View/OnBoardingPushViiew/CompletOnBoardingView.swift @@ -116,7 +116,6 @@ public struct CompletOnBoardingView: View { .onTapGesture { //MARK: - 취향 등록 api 성공 후 mainview 로직 - commonViewViewModel.viewPath.removeAll() commonViewViewModel.isLogin = true commonViewViewModel.isLoginCheck = true } diff --git a/PingPong/Projects/Feature/Profile/Sources/UI/View/MainView/ProfileView.swift b/PingPong/Projects/Feature/Profile/Sources/UI/View/MainView/ProfileView.swift index 85da64b5..d7b12bb2 100644 --- a/PingPong/Projects/Feature/Profile/Sources/UI/View/MainView/ProfileView.swift +++ b/PingPong/Projects/Feature/Profile/Sources/UI/View/MainView/ProfileView.swift @@ -159,7 +159,7 @@ public struct ProfileView: View { .foregroundColor(.basicBlack) } .onTapGesture { - backAction() + viewModel.coreViewPath.removeLast() } @@ -481,7 +481,6 @@ public struct ProfileView: View { .foregroundColor(.logoutText) } .onTapGesture { - viewModel.coreViewPath.removeAll() viewModel.isLogin = false viewModel.isLoginCheck = false 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 c7f48296..f4dd65f2 100644 --- a/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift +++ b/PingPong/Projects/Feature/Profile/Sources/UI/View/WithDraw/WithDrawView.swift @@ -61,7 +61,6 @@ struct WithDrawView: View { authViewModel.deleteAuth = true authViewModel.isDeletAuth = true viewModel.isLoginCheck = false - viewModel.coreViewPath.removeAll() profileViewModel.randomNickName = "" presentationMode.wrappedValue.dismiss()