working third person can now join the channel

This commit is contained in:
talksik
2022-01-01 18:11:34 -08:00
parent d5d0a9bc21
commit 6b3fcb0827
3 changed files with 15 additions and 13 deletions
@@ -200,17 +200,13 @@ class ConvoViewModel: NSObject, ObservableObject {
/** /**
Allow user to join an active convo Allow user to join an active convo
*/ */
func joinConvo() { func joinConvo(convoId: String) {
// ensure the convo is active and includes 2 people in it currently...shouldn't be shown if not anyway // ensure the convo is active and includes 2 people in it currently...shouldn't be shown if not anyway
// ensure that this user leaves all other channels // ensure that this user leaves all other channels
if self.isInCall() {
print("can't join another call, already in one")
return
}
let convo = self.relevantConvos.first {convo in let convo = self.relevantConvos.first {convo in
convo.id == self.selectedConvoId convo.id == convoId
} }
if convo == nil { if convo == nil {
+1 -1
View File
@@ -52,7 +52,7 @@ struct ConvosView: View {
// if not in a call already // if not in a call already
if !self.vm.isInCall() { if !self.vm.isInCall() {
self.vm.selectedConvoId = self.vm.relevantConvos[index].id! self.vm.selectedConvoId = self.vm.relevantConvos[index].id!
self.vm.joinConvo() self.vm.joinConvo(convoId: currConvo.id!)
return return
} }
@@ -115,13 +115,19 @@ struct CircleGridView: View {
.onTapGesture { .onTapGesture {
// if not in a call already // if not in a call already
if !self.convoVM.isInCall() { if !self.convoVM.isInCall() {
self.convoVM.selectedConvoId = self.convoVM.relevantConvos[value].id! print("joining convo now")
self.convoVM.joinConvo()
// if had selected an individual, don't want them in here anymore if let convoId = currConvo.id {
self.selectedFriendIndex = nil self.convoVM.selectedConvoId = convoId
self.convoVM.joinConvo(convoId: convoId)
// if had selected an individual, don't want them selected here anymore
self.selectedFriendIndex = nil
}
else {
print("no convo id to join")
}
return
} }
} }
.animation( .animation(