brute force database to end call

This commit is contained in:
talksik
2021-12-31 02:54:11 -08:00
parent ca586f8331
commit 70c2ad8621
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -30,6 +30,7 @@ struct Convo: Identifiable, Codable {
@ServerTimestamp var startedTimestamp: Date?
var endedTimestamp: Date?
var receiverEndedTimestamp: Date?
}
//struct DetailConvo: Convo {
@@ -87,7 +87,8 @@ class ConvoViewModel: NSObject, ObservableObject {
}
// TODO: if convo receiver is me and I'm not in a call or this call already, then join in
if convo!.receiverUserId == userId && !(self?.isInCall())! {
if convo!.receiverUserId == userId && !(self?.isInCall())!
&& convo!.receiverEndedTimestamp == nil {
self?.joinConvo(convo: convo!)
}
@@ -261,6 +262,9 @@ class ConvoViewModel: NSObject, ObservableObject {
if updatedConvo!.users.count == 1 && updatedConvo!.users[0] == userId {
updatedConvo!.state = .complete
updatedConvo!.endedTimestamp = Date()
} // if I am second to last, the last guy is a loner
else if updatedConvo!.users.count == 2 && updatedConvo!.users.contains(userId!) {
updatedConvo!.receiverEndedTimestamp = Date()
}
let updatedUsers: [String] = updatedConvo!.users.filter{ arrUserId in