diff --git a/nirvana-ios.xcodeproj/project.pbxproj b/nirvana-ios.xcodeproj/project.pbxproj index 61004bf..a21f1f4 100644 --- a/nirvana-ios.xcodeproj/project.pbxproj +++ b/nirvana-ios.xcodeproj/project.pbxproj @@ -66,6 +66,7 @@ 89F18AEA276E881900115B1E /* FirebaseStorageSwift-Beta in Frameworks */ = {isa = PBXBuildFile; productRef = 89F18AE9276E881900115B1E /* FirebaseStorageSwift-Beta */; }; 89F18AEC276E92BF00115B1E /* CustomExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F18AEB276E92BF00115B1E /* CustomExtensions.swift */; }; 89F18AEE276EB55C00115B1E /* ServiceState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F18AED276EB55C00115B1E /* ServiceState.swift */; }; + 89F18AF1276ECAA300115B1E /* RouterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F18AF0276ECAA300115B1E /* RouterView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -113,6 +114,7 @@ 89F1386C2767EB19006680ED /* SignInView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInView.swift; sourceTree = ""; }; 89F18AEB276E92BF00115B1E /* CustomExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomExtensions.swift; sourceTree = ""; }; 89F18AED276EB55C00115B1E /* ServiceState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceState.swift; sourceTree = ""; }; + 89F18AF0276ECAA300115B1E /* RouterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -197,6 +199,7 @@ 891A15F62765639B00B26659 /* Views */ = { isa = PBXGroup; children = ( + 89F18AEF276ECA9600115B1E /* Router */, 89AD5576276DEA9D001658E0 /* LogoHeader */, 89AD5571276DD77D001658E0 /* SplashView */, 89AD5570276DBBD4001658E0 /* EditProfile */, @@ -369,6 +372,14 @@ path = SignIn; sourceTree = ""; }; + 89F18AEF276ECA9600115B1E /* Router */ = { + isa = PBXGroup; + children = ( + 89F18AF0276ECAA300115B1E /* RouterView.swift */, + ); + path = Router; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -486,6 +497,7 @@ 89F05B9B276A87920002E9C7 /* ContactsViewModel.swift in Sources */, 89AD5573276DD790001658E0 /* SplashView.swift in Sources */, 89F18AEC276E92BF00115B1E /* CustomExtensions.swift in Sources */, + 89F18AF1276ECAA300115B1E /* RouterView.swift in Sources */, 89F18AEE276EB55C00115B1E /* ServiceState.swift in Sources */, 891A15E127653A7000B26659 /* nirvana_iosApp.swift in Sources */, 89BCABED276D2B05009E9B10 /* WavesGlassBackgroundView.swift in Sources */, diff --git a/nirvana-ios/ContentView.swift b/nirvana-ios/ContentView.swift index 9c01771..ad6187e 100644 --- a/nirvana-ios/ContentView.swift +++ b/nirvana-ios/ContentView.swift @@ -11,6 +11,7 @@ import NavigationStack struct ContentView: View { @EnvironmentObject var authSessionStore: AuthSessionStore + // welcome -> phone verification -> phone code verification -> onboarding trio -> first, last, avatar picker -> add contacts -> hub var body: some View { NavigationStackView { PhoneVerificationView() diff --git a/nirvana-ios/Repositories/FirestoreService.swift b/nirvana-ios/Repositories/FirestoreService.swift index a6af587..d703651 100644 --- a/nirvana-ios/Repositories/FirestoreService.swift +++ b/nirvana-ios/Repositories/FirestoreService.swift @@ -36,7 +36,7 @@ class FirestoreService { func createUser(user: User) { do { - let _ = try db.collection(Collection.users.rawValue).addDocument(from: user) + let _ = try db.collection(Collection.users.rawValue).document(user.id!).setData(from: user) } catch { print("error in creating user \(error.localizedDescription)") } diff --git a/nirvana-ios/Views/Contacts/ContactsView.swift b/nirvana-ios/Views/Contacts/ContactsView.swift index b221607..f376d14 100644 --- a/nirvana-ios/Views/Contacts/ContactsView.swift +++ b/nirvana-ios/Views/Contacts/ContactsView.swift @@ -8,8 +8,11 @@ import SwiftUI import Contacts import ContactsUI +import NavigationStack struct ContactsView: View { + @EnvironmentObject var navigationStack : NavigationStack + var testUsers:[TestUser] = [ TestUser(_profilePic: "liam", _firstN: "Liam", _lastN: "Digregorio"), TestUser(_profilePic: "heran", _firstN: "Heran", _lastN: "Patel"), @@ -41,6 +44,12 @@ struct ContactsView: View { Text(selectedContact != nil ? "Selected: \((selectedContact?.familyName)!) \((selectedContact?.givenName)!)" : "Nothing selected".localized) + Button { + self.navigationStack.push(InnerCircleView()) + } label: { + Text("go to hub") + } + Spacer() } .sheet(isPresented: self.$showPicker) { diff --git a/nirvana-ios/Views/EditProfile/EditProfileView.swift b/nirvana-ios/Views/EditProfile/EditProfileView.swift index 5c6fa2e..8dede6d 100644 --- a/nirvana-ios/Views/EditProfile/EditProfileView.swift +++ b/nirvana-ios/Views/EditProfile/EditProfileView.swift @@ -6,10 +6,17 @@ // import SwiftUI +import NavigationStack struct EditProfileView: View { + @EnvironmentObject var navigationStack: NavigationStack + var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + Button { + self.navigationStack.push(ContactsView()) + } label: { + + } } } diff --git a/nirvana-ios/Views/PhoneVerification/PhoneCodeVerificationView.swift b/nirvana-ios/Views/PhoneVerification/PhoneCodeVerificationView.swift index c171565..b1e1201 100644 --- a/nirvana-ios/Views/PhoneVerification/PhoneCodeVerificationView.swift +++ b/nirvana-ios/Views/PhoneVerification/PhoneCodeVerificationView.swift @@ -55,7 +55,7 @@ struct PhoneCodeVerificationView: View { print("started verification process of code") //disable focused textfield - self.focusedInputField.toggle() + self.focusedInputField = false // show loading screen self.isLoading.toggle() diff --git a/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift b/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift index 9de96f9..82d2a65 100644 --- a/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift +++ b/nirvana-ios/Views/PhoneVerification/PhoneVerificationView.swift @@ -79,7 +79,7 @@ struct PhoneVerificationView: View { let concatPhoneNumber = "+"+self.ccode+self.phoneNumber //disable focused textfield...important: draw the focus field out first and then the loading screen - self.focusedInputField.toggle() + self.focusedInputField = false //show loading screen self.isLoading.toggle() diff --git a/nirvana-ios/Views/PhoneVerification/PhoneVerificationViewModel.swift b/nirvana-ios/Views/PhoneVerification/PhoneVerificationViewModel.swift index e7ed51b..30c5d23 100644 --- a/nirvana-ios/Views/PhoneVerification/PhoneVerificationViewModel.swift +++ b/nirvana-ios/Views/PhoneVerification/PhoneVerificationViewModel.swift @@ -29,6 +29,7 @@ final class PhoneVerificationViewModel : ObservableObject { if user == nil {// if empty, create user - 1 result set cost..prolly higher cost print("creating new user with id: \(userId)") let newUser = User(id: userId, phoneNumber: phoneNumber) + print("verify the id stayed the same: \(newUser.id)") firestoreService.createUser(user: newUser) } else { // if not, change last logged in value // assign to nil so that server can fill it in diff --git a/nirvana-ios/Views/Router/RouterView.swift b/nirvana-ios/Views/Router/RouterView.swift new file mode 100644 index 0000000..dc2b914 --- /dev/null +++ b/nirvana-ios/Views/Router/RouterView.swift @@ -0,0 +1,26 @@ +// +// RouterView.swift +// nirvana-ios +// +// Created by Arjun Patel on 12/18/21. +// + +import SwiftUI + +// show the loading screen while we figure out where to send the user through the nav stack +struct RouterView: View { + // if not authenticated -> push to welcome + // if authenticated + // if no profile pic and name and all -> go through onboarding again + // if has everythign in place -> homeview and get talking/chatting + + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct RouterView_Previews: PreviewProvider { + static var previews: some View { + RouterView() + } +} diff --git a/nirvana-ios/Views/SplashView/SplashView.swift b/nirvana-ios/Views/SplashView/SplashView.swift index 08237ae..a730f75 100644 --- a/nirvana-ios/Views/SplashView/SplashView.swift +++ b/nirvana-ios/Views/SplashView/SplashView.swift @@ -19,14 +19,17 @@ struct SplashView: View { .foregroundColor(Color.white) .scaleEffect(self.scale) .animation(.easeIn(duration: 2).repeatForever(autoreverses: true)) + .ignoresSafeArea(.keyboard) } + .ignoresSafeArea(.keyboard) } .frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) .background(NirvanaColor.teal) .onAppear { self.scale = 1.3 } - .ignoresSafeArea(.all) + .ignoresSafeArea(.keyboard) + .edgesIgnoringSafeArea(.all) } } diff --git a/nirvana-ios/Views/Templates/OnboardingTemplateView.swift b/nirvana-ios/Views/Templates/OnboardingTemplateView.swift index 4f7cb75..bd3ed63 100644 --- a/nirvana-ios/Views/Templates/OnboardingTemplateView.swift +++ b/nirvana-ios/Views/Templates/OnboardingTemplateView.swift @@ -40,7 +40,7 @@ struct OnboardingTemplateView: View { var body: some View { ZStack { - // TODO: CAREFUL...this needs to be on top if any view is using this subview...otherwise elements will be dimmed and placed beneath this background + // CAREFUL...this needs to be on top if any view is using this subview...otherwise elements will be dimmed and placed beneath this background WavesGlassBackgroundView() VStack(spacing: 0) {