From 7452c54b25bdd84e9ba7ece6410ff0be62f9d940 Mon Sep 17 00:00:00 2001 From: talksik Date: Mon, 20 Dec 2021 00:27:22 -0800 Subject: [PATCH] fixing routing and flow and keeping it simple for now to move on and make it robust without errors --- .../Views/AddBasicInfo/AddBasicInfoView.swift | 5 ++- .../Views/InnerCircle/InnerCircleView.swift | 2 -- .../Views/OnBoarding/OnboardingTrioView.swift | 2 +- nirvana-ios/Views/Router/RouterView.swift | 35 +++---------------- 4 files changed, 7 insertions(+), 37 deletions(-) diff --git a/nirvana-ios/Views/AddBasicInfo/AddBasicInfoView.swift b/nirvana-ios/Views/AddBasicInfo/AddBasicInfoView.swift index 295291c..b22bce5 100644 --- a/nirvana-ios/Views/AddBasicInfo/AddBasicInfoView.swift +++ b/nirvana-ios/Views/AddBasicInfo/AddBasicInfoView.swift @@ -69,6 +69,7 @@ struct AddBasicInfoView: View { .frame(width: 100, height: 100, alignment: .center) .blur(radius: self.selectedAvatarIndex == index ? 0 : 1) .scaleEffect(self.selectedAvatarIndex == index ? 1.3 : 1) + .background(self.selectedAvatarIndex == index ? Color.white.opacity(0.3) : Color.clear) .onTapGesture { print("selected another avatar: \(index)") @@ -105,9 +106,7 @@ struct AddBasicInfoView: View { print("attempting to save information") var updatedUser = self.authSessionStore.user updatedUser?.avatar = Avatars.avatarSystemNames[self.selectedAvatarIndex] - updatedUser?.nickname = self.nickname - - // TODO: I need these updated attributes to be listened to when loading the circle hub next + updatedUser?.nickname = self.nickname if updatedUser != nil { self.addInfoViewModel.updateUser(currUser: updatedUser!) diff --git a/nirvana-ios/Views/InnerCircle/InnerCircleView.swift b/nirvana-ios/Views/InnerCircle/InnerCircleView.swift index 9be8e03..0d91cfa 100644 --- a/nirvana-ios/Views/InnerCircle/InnerCircleView.swift +++ b/nirvana-ios/Views/InnerCircle/InnerCircleView.swift @@ -12,7 +12,6 @@ struct InnerCircleView: View { @EnvironmentObject var authSessionStore: AuthSessionStore @EnvironmentObject var navigationStack: NavigationStack - let universalSize = UIScreen.main.bounds // TESTING @@ -355,7 +354,6 @@ struct InnerCircleView: View { Button("Log out") { print("log out button clicked") - // have this send it self.authSessionStore.logOut() // once logged out, then the listener will listen and router view will take care of us thereafter diff --git a/nirvana-ios/Views/OnBoarding/OnboardingTrioView.swift b/nirvana-ios/Views/OnBoarding/OnboardingTrioView.swift index d8880de..c28c45e 100644 --- a/nirvana-ios/Views/OnBoarding/OnboardingTrioView.swift +++ b/nirvana-ios/Views/OnBoarding/OnboardingTrioView.swift @@ -53,7 +53,7 @@ struct OnboardingTrioView: View { Spacer() Button { - + self.navigationStack.push(AddBasicInfoView()) } label: { Text("Skip") .foregroundColor(NirvanaColor.dimTeal) diff --git a/nirvana-ios/Views/Router/RouterView.swift b/nirvana-ios/Views/Router/RouterView.swift index 629f433..89af021 100644 --- a/nirvana-ios/Views/Router/RouterView.swift +++ b/nirvana-ios/Views/Router/RouterView.swift @@ -16,43 +16,16 @@ enum NavigationPages { case circle } -// show the loading/splash screen while we figure out where to send the user through the nav stack - -// if not authenticated -> push to welcome -// if authenticated -// if no profile pic and name and all -> go through onboarding again -// if has everythign in place -> homeview and get talking/chatting - - -// Purpose: want to use programmatic and maintain the same nav stack but take the user to the right place struct RouterView: View { @EnvironmentObject var authSessionStore: AuthSessionStore @EnvironmentObject var navigationStack: NavigationStack var body: some View { - // authenticated and have user's data - if self.authSessionStore.sessionState == SessionState.isAuthenticated { - if self.authSessionStore.user != nil { - if self.authSessionStore.user?.nickname == nil && self.authSessionStore.user?.avatar == nil { - OnboardingTrioView() - .transition(.slide) - } else {// user is existing user/up and running user -> signs in is pushed nicely right to hub - InnerCircleView() - .transition(.slide) - } - } else { - OnboardingTrioView() - .transition(.slide) - } - - } else if self.authSessionStore.sessionState == SessionState.isLoggedOut { - // go to welcome page at which point they can go and follow the programmatic - // line to the sigin and so on and so forth + switch self.authSessionStore.sessionState { + case SessionState.isAuthenticated: + InnerCircleView() + case SessionState.isLoggedOut: WelcomeView() - .transition(.slide) - } else { - SplashView() - .transition(.slide) } } }