From 504f463f6ee6bae0033a888135522d91983ffa12 Mon Sep 17 00:00:00 2001 From: talksik Date: Mon, 20 Dec 2021 19:31:59 -0800 Subject: [PATCH] fixing bug of auth not working every other time and resolving the issue with firestore service build errors --- .../xcshareddata/swiftpm/Package.resolved | 2 +- .../PhoneVerificationView.swift | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/nirvana-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/nirvana-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4535ef6..0e79264 100644 --- a/nirvana-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/nirvana-ios.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,7 +33,7 @@ "repositoryURL": "https://github.com/firebase/firebase-ios-sdk", "state": { "branch": "master", - "revision": "526f8ca35f9dcf3f1b0aeb94c995f058691b2c26", + "revision": "480178b0871217c5f4fd3dd3c3a309c78c1d5c4c", "version": null } }, diff --git a/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift b/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift index 82d2a65..9f78caf 100644 --- a/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift +++ b/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift @@ -32,6 +32,9 @@ struct PhoneVerificationView: View { @FocusState private var focusedInputField: Bool + + @State var navigateNext = false + // TODO: format the input so that it shows the parentheses and stuff (949)923-0445 var body: some View { ZStack(alignment: .topLeading) { @@ -40,6 +43,10 @@ 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) @@ -89,14 +96,14 @@ struct PhoneVerificationView: View { // TODO: do all of this in view model // do auth stuff from firebase PhoneAuthProvider.provider() - .verifyPhoneNumber(concatPhoneNumber, uiDelegate: nil) { verificationID, error in + .verifyPhoneNumber(concatPhoneNumber, 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 { + // turn off loading page...have an error to show + self.isLoading.toggle() + self.toastText = "⚠️ Please try again." self.toastSubMessage = "There was an issue validating your phone number" self.showToast.toggle() @@ -109,7 +116,8 @@ 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.navigationStack.push(PhoneCodeVerificationView()) // verify code page + self.navigateNext.toggle() } } label: { VStack {