From c974715d234cf7de2d41b200025153fa73b392d5 Mon Sep 17 00:00:00 2001 From: talksik Date: Wed, 22 Dec 2021 01:03:05 -0800 Subject: [PATCH] small ui changes and publishing that dict to make sure it updates the ui when possible --- nirvana-ios/Services/AuthSessionStore.swift | 5 ++-- .../Views/Contacts/FindFriendsView.swift | 26 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/nirvana-ios/Services/AuthSessionStore.swift b/nirvana-ios/Services/AuthSessionStore.swift index f5cea78..68de559 100644 --- a/nirvana-ios/Services/AuthSessionStore.swift +++ b/nirvana-ios/Services/AuthSessionStore.swift @@ -37,7 +37,7 @@ final class AuthSessionStore: ObservableObject, SessionStore { var messagesArr: [Message] = [] // transformed data for the views - var friendMessagesDict: [String: [Message]] = [:] + @Published var friendMessagesDict: [String: [Message]] = [:] // TODO: temporary...should not have this here private var db = Firestore.firestore() @@ -50,7 +50,8 @@ final class AuthSessionStore: ObservableObject, SessionStore { init(isPreview: Bool) { let fakeUser = User(id: UUID().uuidString, nickname: "arjunya", phoneNumber: "+19302919293") - self.user = User() + self.user = fakeUser + let clientID = FirebaseApp.app()?.options.clientID self.GIDconfig = GIDConfiguration(clientID: clientID!) } diff --git a/nirvana-ios/Views/Contacts/FindFriendsView.swift b/nirvana-ios/Views/Contacts/FindFriendsView.swift index b17bb7c..b71400d 100644 --- a/nirvana-ios/Views/Contacts/FindFriendsView.swift +++ b/nirvana-ios/Views/Contacts/FindFriendsView.swift @@ -19,17 +19,25 @@ struct FindFriendsView: View { @State private var searchQuery: String = "" var body: some View { - NavigationView { - // TODO: add search bar + have secondary sort - List { - ForEach(searchItems, id: \.self) { key in - if let currContact = self.contactsVM.contacts[key] { - ListContactRow(contactsVM: self.contactsVM, contact: currContact) + ZStack { + WavesGlassBackgroundView() + + VStack { + Text("You must have someone in your phone contacts to add them. 🥬") + .font(.subheadline) + .foregroundColor(Color.gray) + + List { + ForEach(searchItems, id: \.self) { key in + if let currContact = self.contactsVM.contacts[key] { + ListContactRow(contactsVM: self.contactsVM, contact: currContact) + } + } } + .searchable(text: self.$searchQuery) } } - .searchable(text: self.$searchQuery) .navigationTitle("Find Friends") .navigationBarItems(trailing: Button(action: { dismiss() @@ -57,7 +65,7 @@ struct FindFriendsView: View { struct FindFriendsView_Previews: PreviewProvider { static var previews: some View { - FindFriendsView().environmentObject(AuthSessionStore()) + FindFriendsView().environmentObject(AuthSessionStore(isPreview: true)) } } @@ -71,7 +79,7 @@ struct ListContactRow: View { @State var showAlert = false @State var alertText = "🌱Confirm Arjun into Your Circle?" - @State var alertMessage = "Note: You can have a maximium of 12 people in your circle and you have 5 swaps left!" + @State var alertMessage = "Note: You can have a maximium of 12 people in your circle!" var body: some View { if contact.isExisting { // add to circle