From 1e597c48e64bbf5e85e7b804ffa8a9138f1b1c21 Mon Sep 17 00:00:00 2001 From: talksik Date: Mon, 20 Dec 2021 19:40:03 -0800 Subject: [PATCH] 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 --- .../PhoneVerification/PhoneCodeVerificationView.swift | 9 +++++---- .../Views/PhoneVerification/PhoneVerificationView.swift | 7 +------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/nirvana-ios/Views/PhoneVerification/PhoneCodeVerificationView.swift b/nirvana-ios/Views/PhoneVerification/PhoneCodeVerificationView.swift index b1e1201..0c0a7a9 100644 --- a/nirvana-ios/Views/PhoneVerification/PhoneCodeVerificationView.swift +++ b/nirvana-ios/Views/PhoneVerification/PhoneCodeVerificationView.swift @@ -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: { diff --git a/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift b/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift index 9f78caf..359084b 100644 --- a/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift +++ b/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift @@ -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 {