slight problem with navigation...have to choose one or the other as I have too many controls everywhere

This commit is contained in:
talksik
2021-12-18 02:25:00 -08:00
parent 5ce958501a
commit 332be96743
7 changed files with 82 additions and 20 deletions
+12
View File
@@ -31,6 +31,7 @@
89288ECB27675B9F00E962C4 /* OnboardingTemplateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89288ECA27675B9F00E962C4 /* OnboardingTemplateView.swift */; };
89AD5573276DD790001658E0 /* SplashView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89AD5572276DD790001658E0 /* SplashView.swift */; };
89AD5575276DE724001658E0 /* PhoneCodeVerificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89AD5574276DE724001658E0 /* PhoneCodeVerificationView.swift */; };
89AD5578276DEAB3001658E0 /* LogoHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89AD5577276DEAB3001658E0 /* LogoHeaderView.swift */; };
89B46E71276893E200B74255 /* AuthSessionStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89B46E70276893E200B74255 /* AuthSessionStore.swift */; };
89BCABE2276B3CB0009E9B10 /* NavigationStack in Frameworks */ = {isa = PBXBuildFile; productRef = 89BCABE1276B3CB0009E9B10 /* NavigationStack */; };
89BCABE5276B3D58009E9B10 /* InnerCircleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89BCABE4276B3D58009E9B10 /* InnerCircleView.swift */; };
@@ -75,6 +76,7 @@
89288ECA27675B9F00E962C4 /* OnboardingTemplateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingTemplateView.swift; sourceTree = "<group>"; };
89AD5572276DD790001658E0 /* SplashView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashView.swift; sourceTree = "<group>"; };
89AD5574276DE724001658E0 /* PhoneCodeVerificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneCodeVerificationView.swift; sourceTree = "<group>"; };
89AD5577276DEAB3001658E0 /* LogoHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogoHeaderView.swift; sourceTree = "<group>"; };
89B46E70276893E200B74255 /* AuthSessionStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthSessionStore.swift; sourceTree = "<group>"; };
89BCABE4276B3D58009E9B10 /* InnerCircleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InnerCircleView.swift; sourceTree = "<group>"; };
89BCABE6276B3D64009E9B10 /* InnerCircleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InnerCircleViewModel.swift; sourceTree = "<group>"; };
@@ -164,6 +166,7 @@
891A15F62765639B00B26659 /* Views */ = {
isa = PBXGroup;
children = (
89AD5576276DEA9D001658E0 /* LogoHeader */,
89AD5571276DD77D001658E0 /* SplashView */,
89AD5570276DBBD4001658E0 /* New Group */,
89BCABEE276D2DD6009E9B10 /* PhoneVerification */,
@@ -262,6 +265,14 @@
path = SplashView;
sourceTree = "<group>";
};
89AD5576276DEA9D001658E0 /* LogoHeader */ = {
isa = PBXGroup;
children = (
89AD5577276DEAB3001658E0 /* LogoHeaderView.swift */,
);
path = LogoHeader;
sourceTree = "<group>";
};
89BCABDF276B3588009E9B10 /* InnerCircle */ = {
isa = PBXGroup;
children = (
@@ -413,6 +424,7 @@
89F05BA4276ACC060002E9C7 /* ContactService.swift in Sources */,
89B46E71276893E200B74255 /* AuthSessionStore.swift in Sources */,
891A15F9276563CA00B26659 /* WelcomeView.swift in Sources */,
89AD5578276DEAB3001658E0 /* LogoHeaderView.swift in Sources */,
89BDCDEF2769B50C00577829 /* ContactsView.swift in Sources */,
891A1611276590B000B26659 /* ChatsCarouselView.swift in Sources */,
89BDCDE527695DB900577829 /* NirvanaImage.swift in Sources */,
+6 -9
View File
@@ -13,16 +13,13 @@ struct ContentView: View {
var body: some View {
NavigationStackView {
// MARK: temporary
PhoneVerificationView()
// TODO: remove this commenting to enable natural user flow
// switch self.authSessionStore.sessionState {
// case SessionState.isAuthenticated:
// InnerCircleView()
// case SessionState.isLoggedOut:
// WelcomeView()
// }
switch self.authSessionStore.sessionState {
case SessionState.isAuthenticated:
InnerCircleView()
case SessionState.isLoggedOut:
WelcomeView()
}
}
}
}
@@ -6,9 +6,12 @@
//
import SwiftUI
import NavigationStack
struct InnerCircleView: View {
@EnvironmentObject var authSessionStore: AuthSessionStore
@EnvironmentObject var navigationStack: NavigationStack
let universalSize = UIScreen.main.bounds
@@ -344,7 +347,11 @@ struct InnerCircleView: View {
Button("Log out") {
print("log out button clicked")
authSessionStore.logOut()
// have this send it
self.authSessionStore.logOut()
// once logged out, then the listener will listen and change the page but we will go there first
self.navigationStack.push(ContentView())
}
Button("Friends") {
print("manage friends page")
@@ -0,0 +1,20 @@
//
// LogoHeaderView.swift
// nirvana-ios
//
// Created by Arjun Patel on 12/18/21.
//
import SwiftUI
struct LogoHeaderView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
struct LogoHeaderView_Previews: PreviewProvider {
static var previews: some View {
LogoHeaderView()
}
}
@@ -102,7 +102,7 @@ struct PhoneCodeVerificationView: View {
// then sending to next page
self.navigationStack.push(PhoneVerificationView()) // verify code page
self.navigationStack.push(OnboardingTrioView()) // verify code page
}
} label: {
@@ -6,10 +6,37 @@
//
import Foundation
import FirebaseAuth
final class PhoneVerificationViewModel : ObservableObject {
public func verifyPhoneAndSendSMS(phoneNumber: String) {
// TODO: do some string validation here
// do auth stuff from firebase
PhoneAuthProvider.provider()
.verifyPhoneNumber(phoneNumber, uiDelegate: nil) { verificationID, error in
print("firebase auth done, now running my callback")
// got a response...done loading... either error to show or next page
// self.isLoading.toggle()
// problem verifying number showing alert...maybe fake number or something from user
if error != nil {
// self.toastText = " Please try again."
// self.toastSubMessage = "There was an issue validating your phone number"
// self.showToast.toggle()
print((error?.localizedDescription)!)
return
}
// use this in the next screen to verify with the code provided
UserDefaults.standard.set(verificationID, forKey: "authVerificationID")
// self.navigationStack.push(PhoneCodeVerificationView()) // verify code page
}
}
}
@@ -6,8 +6,11 @@
//
import SwiftUI
import NavigationStack
struct OnboardingTrioView: View {
@EnvironmentObject var navigationStack: NavigationStack
var body: some View {
TabView {
OnboardingTemplateView(imgName: "undraw_through_the_park_lxnl", mainLeadingActText: "The path to living in the ", mainHighlightedActText: "present moment.", mainTrailingActText: "", subActText: "No more dopamine inducing news feeds. No profiles so no anxiety about the past or what others think.")
@@ -16,7 +19,9 @@ struct OnboardingTrioView: View {
OnboardingTemplateView(imgName: "undraw_connection_b-38-q", mainLeadingActText: "Be picky about your ", mainHighlightedActText: "inner circle.", mainTrailingActText: "", subActText: "You are who you hang out with. Maximum 8 people in your inner circle.", bottomActArea: AnyView(
VStack {
NavigationLink(destination: SignInView()) {
Button {
self.navigationStack.push(ContactsView())
} label: {
Text("Start Your Detox")
.bold()
.foregroundColor(NirvanaColor.white)
@@ -25,13 +30,7 @@ struct OnboardingTrioView: View {
.background(NirvanaColor.teal)
.clipShape(Capsule())
.shadow(radius:10)
}
NavigationLink(destination: WelcomeView()) {
Text("Go Back")
.bold()
.foregroundColor(NirvanaColor.teal)
}
}
}.padding(.bottom, 20)
)
)