adding texting ability
This commit is contained in:
@@ -143,6 +143,12 @@ final class AuthSessionStore: ObservableObject, SessionStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: listener for getting user's sent and received messages
|
||||||
|
|
||||||
|
// TODO: listener for getting user's circle members
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// if we don't have a user, set our session to nil
|
// if we don't have a user, set our session to nil
|
||||||
self.user = nil
|
self.user = nil
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ struct FindFriendsView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
// list with search bar
|
// TODO: add search bar + have secondary sort
|
||||||
List {
|
List {
|
||||||
ForEach(contactsVM.contacts.sorted { $0.isExisting && !$1.isExisting }) { contact in
|
ForEach(contactsVM.contacts.sorted { $0.isExisting && !$1.isExisting }) { contact in
|
||||||
ListContactRow(contact: contact)
|
ListContactRow(contact: contact)
|
||||||
@@ -47,6 +47,8 @@ struct FindFriendsView_Previews: PreviewProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct ListContactRow: View {
|
struct ListContactRow: View {
|
||||||
var contact: ContactsViewModelContact
|
var contact: ContactsViewModelContact
|
||||||
|
|
||||||
@@ -56,6 +58,7 @@ struct ListContactRow: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if contact.isExisting { // add to circle
|
if contact.isExisting { // add to circle
|
||||||
|
// TODO: check if this contact is already in user's circle
|
||||||
HStack(alignment: .center, spacing: 0) {
|
HStack(alignment: .center, spacing: 0) {
|
||||||
Image(contact.user?.avatar ?? Avatars.avatarSystemNames[1])
|
Image(contact.user?.avatar ?? Avatars.avatarSystemNames[1])
|
||||||
.resizable()
|
.resizable()
|
||||||
@@ -99,6 +102,15 @@ struct ListContactRow: View {
|
|||||||
Button {
|
Button {
|
||||||
print("inviting user now")
|
print("inviting user now")
|
||||||
// text message to him/her
|
// text message to him/her
|
||||||
|
|
||||||
|
if contact.cnPhoneNumber != nil {
|
||||||
|
let sms: String = "sms://\(contact.cnPhoneNumber)&body=Join me on Nirvana! I sent you a message there! https://usenirvana.com"
|
||||||
|
let strUrl: String = sms.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
|
||||||
|
|
||||||
|
UIApplication.shared.open(URL(string: strUrl)!, options: [:], completionHandler: nil)
|
||||||
|
} else {
|
||||||
|
print("phone number is nil of contact")
|
||||||
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Label("Invite", systemImage: "paperplane")
|
Label("Invite", systemImage: "paperplane")
|
||||||
.font(.title2)
|
.font(.title2)
|
||||||
|
|||||||
Reference in New Issue
Block a user