fixing bugs with the footer
This commit is contained in:
@@ -111,14 +111,19 @@ struct ConvoFooterView: View {
|
||||
x:0,
|
||||
y:self.convoVM.selectedConvoId == nil ? 150 : 0
|
||||
)
|
||||
.onChange(of: self.convoVM.selectedConvoId) {newConvoId in
|
||||
.onReceive(self.convoVM.$relevantConvos) {newConvos in
|
||||
// update meta data based on which convo was selected
|
||||
|
||||
if self.convoVM.selectedConvoId == nil {
|
||||
print("nothing to show as there is no convo selected")
|
||||
return
|
||||
}
|
||||
|
||||
// reset the selected options to start fresh
|
||||
self.convoRelativeTime = ""
|
||||
|
||||
self.selectedConvo = self.convoVM.relevantConvos.first {convo in
|
||||
convo.id == newConvoId
|
||||
self.selectedConvo = newConvos.first {convo in
|
||||
convo.id == self.convoVM.selectedConvoId
|
||||
}
|
||||
|
||||
// get relative start time of convo
|
||||
|
||||
@@ -94,6 +94,7 @@ class ConvoViewModel: NSObject, ObservableObject {
|
||||
}
|
||||
|
||||
// if convo receiver is me and I'm not in a call or this call already, then join in
|
||||
// TODO: also if I am added after a receiver was added, then join the call
|
||||
if convo!.receiverUserId == userId && !(self?.isInCall())!
|
||||
&& convo!.receiverEndedTimestamp == nil {
|
||||
self?.joinConvo(convo: convo!)
|
||||
@@ -217,6 +218,7 @@ class ConvoViewModel: NSObject, ObservableObject {
|
||||
|
||||
// TODO: if the convo has more than 10 people, stop user from joining...that's too expensive...
|
||||
|
||||
self.selectedConvoId = convoId
|
||||
let convoAgoraToken:String = convo!.agoraToken
|
||||
let channelName:String = convo!.id!
|
||||
|
||||
|
||||
@@ -467,7 +467,7 @@ extension CircleGridView {
|
||||
private func handleTap(gridItemIndex: Int, friendId: String) {
|
||||
print("tap gesture activated")
|
||||
|
||||
// if friend and I are online, start call immediately
|
||||
// if friend and I are online, start convo immediately with them
|
||||
if self.authSessionStore.relevantUsersDict[friendId]?.userStatus == .online
|
||||
&& self.authSessionStore.user?.userStatus == .online {
|
||||
self.convoVM.startConvo(friendId: friendId)
|
||||
@@ -475,6 +475,8 @@ extension CircleGridView {
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: if I am in a call and I am adding someone else online, then make them join my convo
|
||||
|
||||
// clearing the player to make room for this friend's convo or to deselect this user
|
||||
self.queuePlayer.removeAllItems()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user