brute force database to end call
This commit is contained in:
@@ -30,6 +30,7 @@ struct Convo: Identifiable, Codable {
|
|||||||
|
|
||||||
@ServerTimestamp var startedTimestamp: Date?
|
@ServerTimestamp var startedTimestamp: Date?
|
||||||
var endedTimestamp: Date?
|
var endedTimestamp: Date?
|
||||||
|
var receiverEndedTimestamp: Date?
|
||||||
}
|
}
|
||||||
|
|
||||||
//struct DetailConvo: Convo {
|
//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
|
// 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!)
|
self?.joinConvo(convo: convo!)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,6 +262,9 @@ class ConvoViewModel: NSObject, ObservableObject {
|
|||||||
if updatedConvo!.users.count == 1 && updatedConvo!.users[0] == userId {
|
if updatedConvo!.users.count == 1 && updatedConvo!.users[0] == userId {
|
||||||
updatedConvo!.state = .complete
|
updatedConvo!.state = .complete
|
||||||
updatedConvo!.endedTimestamp = Date()
|
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
|
let updatedUsers: [String] = updatedConvo!.users.filter{ arrUserId in
|
||||||
|
|||||||
Reference in New Issue
Block a user