mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 04:49:21 +00:00
Handle conversation deleted event
This commit is contained in:
parent
f9db9aa632
commit
fb80f3bd52
@ -80,11 +80,18 @@ class DeletedConversationMessageEvent {
|
||||
}
|
||||
|
||||
/// Remove user from conversation
|
||||
class RemovedUserFromConversation {
|
||||
class RemovedUserFromConversationEvent {
|
||||
final int convID;
|
||||
final int userID;
|
||||
|
||||
RemovedUserFromConversation(this.convID, this.userID);
|
||||
RemovedUserFromConversationEvent(this.convID, this.userID);
|
||||
}
|
||||
|
||||
/// Deleted conversation
|
||||
class DeletedConversationEvent {
|
||||
final int convID;
|
||||
|
||||
DeletedConversationEvent(this.convID);
|
||||
}
|
||||
|
||||
/// User joined call event
|
||||
|
@ -170,10 +170,15 @@ class WebSocketHelper {
|
||||
|
||||
// Removed user from conversation
|
||||
case "removed_user_from_conv":
|
||||
EventsHelper.emit(RemovedUserFromConversation(
|
||||
EventsHelper.emit(RemovedUserFromConversationEvent(
|
||||
msg.data["conv_id"], msg.data["user_id"]));
|
||||
break;
|
||||
|
||||
// Conversation deleted
|
||||
case "deleted_conversation":
|
||||
EventsHelper.emit(DeletedConversationEvent(msg.data));
|
||||
break;
|
||||
|
||||
// A user joined a call
|
||||
case "user_joined_call":
|
||||
EventsHelper.emit(
|
||||
|
@ -186,11 +186,17 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
|
||||
}
|
||||
});
|
||||
|
||||
this.listen<RemovedUserFromConversation>((ev) {
|
||||
this.listen<RemovedUserFromConversationEvent>((ev) {
|
||||
if (ev.userID == userID() && ev.convID == widget.conversationID) {
|
||||
setState(() => _error = ErrorLevel.MAJOR);
|
||||
}
|
||||
});
|
||||
|
||||
this.listen<DeletedConversationEvent>((ev) {
|
||||
if (ev.convID == widget.conversationID) {
|
||||
setState(() => _error = ErrorLevel.MAJOR);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Free resources when this conversation widget is no longer required
|
||||
|
Loading…
Reference in New Issue
Block a user