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:
@@ -76,6 +76,7 @@ struct PhoneCodeVerificationView: View {
|
|||||||
verificationCode: self.verificationCode
|
verificationCode: self.verificationCode
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO: bug one: not navigating after creating user...two: creating user with a random Id
|
||||||
// firebase will now verify the credential
|
// firebase will now verify the credential
|
||||||
Auth.auth().signIn(with: credential) { (res, err) in
|
Auth.auth().signIn(with: credential) { (res, err) in
|
||||||
// done with the response here, turn off loading screen
|
// 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
|
// firebase either created a new user or is giving back an existing user's id
|
||||||
let userId = res?.user.uid
|
let userId = res?.user.uid
|
||||||
let userPhoneNumber = res?.user.phoneNumber
|
let userPhoneNumber = res?.user.phoneNumber
|
||||||
print("user id that was authenticated is: \(userId)")
|
print("firebase auth: user id that was authenticated is: \(userId)")
|
||||||
print("user id that was authenticated is: \(userPhoneNumber)")
|
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 {
|
if userId == nil || userPhoneNumber == nil {
|
||||||
self.toastText = "⚠️ Error with Verification"
|
self.toastText = "⚠️ Error with Verification"
|
||||||
self.toastSubMessage = "Code is invalid. Please try again or re-enter your phone number in the previous page."
|
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!)
|
self.phoneverificationViewModel.createOrUpdateUser(userId: userId!, phoneNumber: userPhoneNumber!)
|
||||||
|
|
||||||
// then sending to next page
|
// then sending to next page
|
||||||
self.navigationStack.push(OnboardingTrioView()) // verify code page
|
self.navigationStack.push(OnboardingTrioView())
|
||||||
}
|
}
|
||||||
|
|
||||||
} label: {
|
} label: {
|
||||||
|
|||||||
@@ -43,10 +43,6 @@ struct PhoneVerificationView: View {
|
|||||||
OnboardingTemplateView(hdrText: "Let's get you verified", imgName: "undraw_my_password_d-6-kg", bottomActArea: AnyView(
|
OnboardingTemplateView(hdrText: "Let's get you verified", imgName: "undraw_my_password_d-6-kg", bottomActArea: AnyView(
|
||||||
VStack {
|
VStack {
|
||||||
HStack {
|
HStack {
|
||||||
PushView(destination: PhoneCodeVerificationView(), isActive: self.$navigateNext) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Text("+\(ccode)")
|
Text("+\(ccode)")
|
||||||
.padding()
|
.padding()
|
||||||
.background(.ultraThinMaterial)
|
.background(.ultraThinMaterial)
|
||||||
@@ -116,8 +112,7 @@ struct PhoneVerificationView: View {
|
|||||||
// use this in the next screen to verify with the code provided
|
// use this in the next screen to verify with the code provided
|
||||||
UserDefaults.standard.set(verificationID, forKey: "authVerificationID")
|
UserDefaults.standard.set(verificationID, forKey: "authVerificationID")
|
||||||
|
|
||||||
// self.navigationStack.push(PhoneCodeVerificationView()) // verify code page
|
self.navigationStack.push(PhoneCodeVerificationView()) // verify code page
|
||||||
self.navigateNext.toggle()
|
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
VStack {
|
VStack {
|
||||||
|
|||||||
Reference in New Issue
Block a user