making some fixes little things especially for the updating of user and setting right id for document in users collection
This commit is contained in:
@@ -66,6 +66,7 @@
|
|||||||
89F18AEA276E881900115B1E /* FirebaseStorageSwift-Beta in Frameworks */ = {isa = PBXBuildFile; productRef = 89F18AE9276E881900115B1E /* FirebaseStorageSwift-Beta */; };
|
89F18AEA276E881900115B1E /* FirebaseStorageSwift-Beta in Frameworks */ = {isa = PBXBuildFile; productRef = 89F18AE9276E881900115B1E /* FirebaseStorageSwift-Beta */; };
|
||||||
89F18AEC276E92BF00115B1E /* CustomExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F18AEB276E92BF00115B1E /* CustomExtensions.swift */; };
|
89F18AEC276E92BF00115B1E /* CustomExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F18AEB276E92BF00115B1E /* CustomExtensions.swift */; };
|
||||||
89F18AEE276EB55C00115B1E /* ServiceState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F18AED276EB55C00115B1E /* ServiceState.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 */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@@ -113,6 +114,7 @@
|
|||||||
89F1386C2767EB19006680ED /* SignInView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInView.swift; sourceTree = "<group>"; };
|
89F1386C2767EB19006680ED /* SignInView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInView.swift; sourceTree = "<group>"; };
|
||||||
89F18AEB276E92BF00115B1E /* CustomExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomExtensions.swift; sourceTree = "<group>"; };
|
89F18AEB276E92BF00115B1E /* CustomExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomExtensions.swift; sourceTree = "<group>"; };
|
||||||
89F18AED276EB55C00115B1E /* ServiceState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceState.swift; sourceTree = "<group>"; };
|
89F18AED276EB55C00115B1E /* ServiceState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceState.swift; sourceTree = "<group>"; };
|
||||||
|
89F18AF0276ECAA300115B1E /* RouterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterView.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -197,6 +199,7 @@
|
|||||||
891A15F62765639B00B26659 /* Views */ = {
|
891A15F62765639B00B26659 /* Views */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
89F18AEF276ECA9600115B1E /* Router */,
|
||||||
89AD5576276DEA9D001658E0 /* LogoHeader */,
|
89AD5576276DEA9D001658E0 /* LogoHeader */,
|
||||||
89AD5571276DD77D001658E0 /* SplashView */,
|
89AD5571276DD77D001658E0 /* SplashView */,
|
||||||
89AD5570276DBBD4001658E0 /* EditProfile */,
|
89AD5570276DBBD4001658E0 /* EditProfile */,
|
||||||
@@ -369,6 +372,14 @@
|
|||||||
path = SignIn;
|
path = SignIn;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
89F18AEF276ECA9600115B1E /* Router */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
89F18AF0276ECAA300115B1E /* RouterView.swift */,
|
||||||
|
);
|
||||||
|
path = Router;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
@@ -486,6 +497,7 @@
|
|||||||
89F05B9B276A87920002E9C7 /* ContactsViewModel.swift in Sources */,
|
89F05B9B276A87920002E9C7 /* ContactsViewModel.swift in Sources */,
|
||||||
89AD5573276DD790001658E0 /* SplashView.swift in Sources */,
|
89AD5573276DD790001658E0 /* SplashView.swift in Sources */,
|
||||||
89F18AEC276E92BF00115B1E /* CustomExtensions.swift in Sources */,
|
89F18AEC276E92BF00115B1E /* CustomExtensions.swift in Sources */,
|
||||||
|
89F18AF1276ECAA300115B1E /* RouterView.swift in Sources */,
|
||||||
89F18AEE276EB55C00115B1E /* ServiceState.swift in Sources */,
|
89F18AEE276EB55C00115B1E /* ServiceState.swift in Sources */,
|
||||||
891A15E127653A7000B26659 /* nirvana_iosApp.swift in Sources */,
|
891A15E127653A7000B26659 /* nirvana_iosApp.swift in Sources */,
|
||||||
89BCABED276D2B05009E9B10 /* WavesGlassBackgroundView.swift in Sources */,
|
89BCABED276D2B05009E9B10 /* WavesGlassBackgroundView.swift in Sources */,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import NavigationStack
|
|||||||
struct ContentView: View {
|
struct ContentView: View {
|
||||||
@EnvironmentObject var authSessionStore: AuthSessionStore
|
@EnvironmentObject var authSessionStore: AuthSessionStore
|
||||||
|
|
||||||
|
// welcome -> phone verification -> phone code verification -> onboarding trio -> first, last, avatar picker -> add contacts -> hub
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStackView {
|
NavigationStackView {
|
||||||
PhoneVerificationView()
|
PhoneVerificationView()
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class FirestoreService {
|
|||||||
|
|
||||||
func createUser(user: User) {
|
func createUser(user: User) {
|
||||||
do {
|
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 {
|
} catch {
|
||||||
print("error in creating user \(error.localizedDescription)")
|
print("error in creating user \(error.localizedDescription)")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,11 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Contacts
|
import Contacts
|
||||||
import ContactsUI
|
import ContactsUI
|
||||||
|
import NavigationStack
|
||||||
|
|
||||||
struct ContactsView: View {
|
struct ContactsView: View {
|
||||||
|
@EnvironmentObject var navigationStack : NavigationStack
|
||||||
|
|
||||||
var testUsers:[TestUser] = [
|
var testUsers:[TestUser] = [
|
||||||
TestUser(_profilePic: "liam", _firstN: "Liam", _lastN: "Digregorio"),
|
TestUser(_profilePic: "liam", _firstN: "Liam", _lastN: "Digregorio"),
|
||||||
TestUser(_profilePic: "heran", _firstN: "Heran", _lastN: "Patel"),
|
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)
|
Text(selectedContact != nil ? "Selected: \((selectedContact?.familyName)!) \((selectedContact?.givenName)!)" : "Nothing selected".localized)
|
||||||
|
|
||||||
|
Button {
|
||||||
|
self.navigationStack.push(InnerCircleView())
|
||||||
|
} label: {
|
||||||
|
Text("go to hub")
|
||||||
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.sheet(isPresented: self.$showPicker) {
|
.sheet(isPresented: self.$showPicker) {
|
||||||
|
|||||||
@@ -6,10 +6,17 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import NavigationStack
|
||||||
|
|
||||||
struct EditProfileView: View {
|
struct EditProfileView: View {
|
||||||
|
@EnvironmentObject var navigationStack: NavigationStack
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
Button {
|
||||||
|
self.navigationStack.push(ContactsView())
|
||||||
|
} label: {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ struct PhoneCodeVerificationView: View {
|
|||||||
print("started verification process of code")
|
print("started verification process of code")
|
||||||
|
|
||||||
//disable focused textfield
|
//disable focused textfield
|
||||||
self.focusedInputField.toggle()
|
self.focusedInputField = false
|
||||||
|
|
||||||
// show loading screen
|
// show loading screen
|
||||||
self.isLoading.toggle()
|
self.isLoading.toggle()
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ struct PhoneVerificationView: View {
|
|||||||
let concatPhoneNumber = "+"+self.ccode+self.phoneNumber
|
let concatPhoneNumber = "+"+self.ccode+self.phoneNumber
|
||||||
|
|
||||||
//disable focused textfield...important: draw the focus field out first and then the loading screen
|
//disable focused textfield...important: draw the focus field out first and then the loading screen
|
||||||
self.focusedInputField.toggle()
|
self.focusedInputField = false
|
||||||
|
|
||||||
//show loading screen
|
//show loading screen
|
||||||
self.isLoading.toggle()
|
self.isLoading.toggle()
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ final class PhoneVerificationViewModel : ObservableObject {
|
|||||||
if user == nil {// if empty, create user - 1 result set cost..prolly higher cost
|
if user == nil {// if empty, create user - 1 result set cost..prolly higher cost
|
||||||
print("creating new user with id: \(userId)")
|
print("creating new user with id: \(userId)")
|
||||||
let newUser = User(id: userId, phoneNumber: phoneNumber)
|
let newUser = User(id: userId, phoneNumber: phoneNumber)
|
||||||
|
print("verify the id stayed the same: \(newUser.id)")
|
||||||
firestoreService.createUser(user: newUser)
|
firestoreService.createUser(user: newUser)
|
||||||
} else { // if not, change last logged in value
|
} else { // if not, change last logged in value
|
||||||
// assign to nil so that server can fill it in
|
// assign to nil so that server can fill it in
|
||||||
|
|||||||
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,14 +19,17 @@ struct SplashView: View {
|
|||||||
.foregroundColor(Color.white)
|
.foregroundColor(Color.white)
|
||||||
.scaleEffect(self.scale)
|
.scaleEffect(self.scale)
|
||||||
.animation(.easeIn(duration: 2).repeatForever(autoreverses: true))
|
.animation(.easeIn(duration: 2).repeatForever(autoreverses: true))
|
||||||
|
.ignoresSafeArea(.keyboard)
|
||||||
}
|
}
|
||||||
|
.ignoresSafeArea(.keyboard)
|
||||||
}
|
}
|
||||||
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
|
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
|
||||||
.background(NirvanaColor.teal)
|
.background(NirvanaColor.teal)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
self.scale = 1.3
|
self.scale = 1.3
|
||||||
}
|
}
|
||||||
.ignoresSafeArea(.all)
|
.ignoresSafeArea(.keyboard)
|
||||||
|
.edgesIgnoringSafeArea(.all)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ struct OnboardingTemplateView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack {
|
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()
|
WavesGlassBackgroundView()
|
||||||
|
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user