going back to old way...

the reason that auth would only work every other time is because it always worked, but my nav stack you send to next...i think it's a race, because the loading screen would try to show and bring it back to current page
This commit is contained in:
talksik
2021-12-20 19:40:03 -08:00
parent 504f463f6e
commit 1e597c48e6
2 changed files with 6 additions and 10 deletions
@@ -76,6 +76,7 @@ struct PhoneCodeVerificationView: View {
verificationCode: self.verificationCode
)
// TODO: bug one: not navigating after creating user...two: creating user with a random Id
// firebase will now verify the credential
Auth.auth().signIn(with: credential) { (res, err) in
// done with the response here, turn off loading screen
@@ -96,10 +97,10 @@ struct PhoneCodeVerificationView: View {
// firebase either created a new user or is giving back an existing user's id
let userId = res?.user.uid
let userPhoneNumber = res?.user.phoneNumber
print("user id that was authenticated is: \(userId)")
print("user id that was authenticated is: \(userPhoneNumber)")
print("firebase auth: user id that was authenticated is: \(userId)")
print("firebase auth: phone number that was authenticated is: \(userPhoneNumber)")
// if for some reason firebase couldn't get basic user details
// if for some reason firebase couldn't get auth details
if userId == nil || userPhoneNumber == nil {
self.toastText = "⚠️ Error with Verification"
self.toastSubMessage = "Code is invalid. Please try again or re-enter your phone number in the previous page."
@@ -112,7 +113,7 @@ struct PhoneCodeVerificationView: View {
self.phoneverificationViewModel.createOrUpdateUser(userId: userId!, phoneNumber: userPhoneNumber!)
// then sending to next page
self.navigationStack.push(OnboardingTrioView()) // verify code page
self.navigationStack.push(OnboardingTrioView())
}
} label: {
@@ -43,10 +43,6 @@ struct PhoneVerificationView: View {
OnboardingTemplateView(hdrText: "Let's get you verified", imgName: "undraw_my_password_d-6-kg", bottomActArea: AnyView(
VStack {
HStack {
PushView(destination: PhoneCodeVerificationView(), isActive: self.$navigateNext) {
}
Text("+\(ccode)")
.padding()
.background(.ultraThinMaterial)
@@ -116,8 +112,7 @@ struct PhoneVerificationView: View {
// 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
self.navigateNext.toggle()
self.navigationStack.push(PhoneCodeVerificationView()) // verify code page
}
} label: {
VStack {