nice addition of contacts basic list

This commit is contained in:
talksik
2021-12-15 02:26:15 -08:00
parent 351bebf3d1
commit 3e7f2e7f74
4 changed files with 140 additions and 6 deletions
+16
View File
@@ -35,6 +35,8 @@
89BDCDE72769616600577829 /* UIImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89BDCDE62769616600577829 /* UIImage+Extension.swift */; };
89BDCDEA27697F9C00577829 /* UserMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89BDCDE927697F9C00577829 /* UserMenu.swift */; };
89BDCDEC2769918D00577829 /* OnboardingTrioView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89BDCDEB2769918D00577829 /* OnboardingTrioView.swift */; };
89BDCDEF2769B50C00577829 /* ContactsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89BDCDEE2769B50C00577829 /* ContactsView.swift */; };
89BDCDF12769E64200577829 /* Firestore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89BDCDF02769E64200577829 /* Firestore.swift */; };
89D99D2E2766FD6B00237814 /* Liquid in Frameworks */ = {isa = PBXBuildFile; productRef = 89D99D2D2766FD6B00237814 /* Liquid */; };
89F1386D2767EB19006680ED /* SignInView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F1386C2767EB19006680ED /* SignInView.swift */; };
89F138702767F55F006680ED /* GoogleSignIn in Frameworks */ = {isa = PBXBuildFile; productRef = 89F1386F2767F55F006680ED /* GoogleSignIn */; };
@@ -67,6 +69,8 @@
89BDCDE62769616600577829 /* UIImage+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Extension.swift"; sourceTree = "<group>"; };
89BDCDE927697F9C00577829 /* UserMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserMenu.swift; sourceTree = "<group>"; };
89BDCDEB2769918D00577829 /* OnboardingTrioView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingTrioView.swift; sourceTree = "<group>"; };
89BDCDEE2769B50C00577829 /* ContactsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsView.swift; sourceTree = "<group>"; };
89BDCDF02769E64200577829 /* Firestore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Firestore.swift; sourceTree = "<group>"; };
89F1386C2767EB19006680ED /* SignInView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -140,6 +144,7 @@
891A15F62765639B00B26659 /* Views */ = {
isa = PBXGroup;
children = (
89BDCDED2769B3EB00577829 /* Contacts */,
89F1386B2767EB07006680ED /* SignIn */,
892179E22765FE93001E6C60 /* FooterControlsView */,
891A16052765726800B26659 /* Templates */,
@@ -186,6 +191,7 @@
891A15FC276566B800B26659 /* constants.swift */,
89BDCDE427695DB900577829 /* NirvanaImage.swift */,
89BDCDE62769616600577829 /* UIImage+Extension.swift */,
89BDCDF02769E64200577829 /* Firestore.swift */,
);
path = Globals;
sourceTree = "<group>";
@@ -232,6 +238,14 @@
path = UserMenu;
sourceTree = "<group>";
};
89BDCDED2769B3EB00577829 /* Contacts */ = {
isa = PBXGroup;
children = (
89BDCDEE2769B50C00577829 /* ContactsView.swift */,
);
path = Contacts;
sourceTree = "<group>";
};
89F1386B2767EB07006680ED /* SignIn */ = {
isa = PBXGroup;
children = (
@@ -334,6 +348,7 @@
89288ECB27675B9F00E962C4 /* OnboardingTemplateView.swift in Sources */,
89B46E71276893E200B74255 /* AuthSessionStore.swift in Sources */,
891A15F9276563CA00B26659 /* WelcomeView.swift in Sources */,
89BDCDEF2769B50C00577829 /* ContactsView.swift in Sources */,
891A1611276590B000B26659 /* ChatsCarouselView.swift in Sources */,
89BDCDE527695DB900577829 /* NirvanaImage.swift in Sources */,
891A16132765A44300B26659 /* ChatsCarouselViewModel.swift in Sources */,
@@ -345,6 +360,7 @@
891A15FD276566B800B26659 /* constants.swift in Sources */,
89BDCDE72769616600577829 /* UIImage+Extension.swift in Sources */,
89F1386D2767EB19006680ED /* SignInView.swift in Sources */,
89BDCDF12769E64200577829 /* Firestore.swift in Sources */,
891A160E27657CEA00B26659 /* User.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
+7 -6
View File
@@ -12,12 +12,13 @@ struct ContentView: View {
var body: some View {
ZStack {
switch self.authSessionStore.sessionState {
case SessionState.isAuthenticated:
HomeView()
case SessionState.isLoggedOut:
WelcomeView()
}
ContactsView() // TEMPORARY FOR TESTING
// switch self.authSessionStore.sessionState {
// case SessionState.isAuthenticated:
// HomeView()
// case SessionState.isLoggedOut:
// WelcomeView()
// }
}.animation(.default, value:authSessionStore.sessionState)
}
}
+34
View File
@@ -0,0 +1,34 @@
//
// Firestore.swift
// nirvana-ios
//
// Created by Arjun Patel on 12/15/21.
//
import Foundation
public class Firestore {
// public struct User: Codable {
// let id: String
// let firstName: String
// let lastName: String?
// let mainPhoneNumber: String?
// let emailAddress:String?
// let photoUrl:String?
//
// let lastLoggedInTimestamp: Date
// let createdTimestamp: Date
// }
//
// public struct Messages: Codable {
// let id: String
// let senderId: String
// let receiverId: String
//
// let sentTimestamp:Date
// let listenedTimestamp:Date
// let audioDataUrl:String
//
// }
}
@@ -0,0 +1,83 @@
//
// ContactsView.swift
// nirvana-ios
//
// Created by Arjun Patel on 12/14/21.
//
import SwiftUI
struct ContactsView: View {
var testUsers:[TestUser] = [
TestUser(_profilePic: "liam", _firstN: "Liam", _lastN: "Digregorio"),
TestUser(_profilePic: "heran", _firstN: "Heran", _lastN: "Patel"),
TestUser(_profilePic: "sarth", _firstN: "Sarth", _lastN: "Shah"),
TestUser(_profilePic: "kevin", _firstN: "Kevin", _lastN: "Le"),
TestUser(_profilePic: "rohan", _firstN: "Rohan", _lastN: "Chadha")
]
var body: some View {
List {
ForEach(testUsers) { user in
let fullName = "\(user.firstName) \(user.lastName)"
IndividualContactView(name: fullName, imageName: user.profilePictureUrl)
}
}
}
}
struct ContactsView_Previews: PreviewProvider {
static var previews: some View {
ContactsView().environmentObject(AuthSessionStore())
}
}
private struct IndividualContactView: View {
var name: String
var imageName: String
@Namespace private var animation
@State var addedUser = false
var body: some View {
HStack(alignment: .center, spacing: 0) {
Image(imageName)
.resizable()
.scaledToFit()
.clipShape(Circle())
.frame(width: 40, height: 40)
.padding(.trailing, 10)
Text(name)
.font(.headline)
Spacer()
VStack {
if addedUser {
Label("Added", systemImage: "person.crop.circle.fill.badge.checkmark")
.font(.title2)
.foregroundColor(NirvanaColor.solidTeal)
.labelStyle(IconOnlyLabelStyle())
.matchedGeometryEffect(id: "add-contact", in: animation)
} else {
Button {
print("pressed add button")
} label: {
Label("Add", systemImage: "plus.circle")
.font(.title2)
.foregroundColor(NirvanaColor.solidTeal)
.labelStyle(IconOnlyLabelStyle())
.matchedGeometryEffect(id: "add-contact", in: animation)
}
}
}.onTapGesture {
withAnimation(Animation.interpolatingSpring(stiffness: 300, damping: 30)) {
self.addedUser.toggle()
}
}
}
}
}