1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Handle user removed from conversation events

This commit is contained in:
Pierre HUBERT 2021-03-13 12:16:57 +01:00
parent ed9f5e396c
commit a630a5ae79
3 changed files with 21 additions and 0 deletions

View File

@ -79,6 +79,14 @@ class DeletedConversationMessageEvent {
DeletedConversationMessageEvent(this.msg); DeletedConversationMessageEvent(this.msg);
} }
/// Remove user from conversation
class RemovedUserFromConversation {
final int convID;
final int userID;
RemovedUserFromConversation(this.convID, this.userID);
}
/// User joined call event /// User joined call event
class UserJoinedCallEvent { class UserJoinedCallEvent {
final int callID; final int callID;

View File

@ -168,6 +168,12 @@ class WebSocketHelper {
ConversationsHelper.apiToConversationMessage(msg.data))); ConversationsHelper.apiToConversationMessage(msg.data)));
break; break;
// Removed user from conversation
case "removed_user_from_conv":
EventsHelper.emit(RemovedUserFromConversation(
msg.data["conv_id"], msg.data["user_id"]));
break;
// A user joined a call // A user joined a call
case "user_joined_call": case "user_joined_call":
EventsHelper.emit( EventsHelper.emit(

View File

@ -18,6 +18,7 @@ import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/ui/widgets/safe_state.dart'; import 'package:comunic/ui/widgets/safe_state.dart';
import 'package:comunic/ui/widgets/scroll_watcher.dart'; import 'package:comunic/ui/widgets/scroll_watcher.dart';
import 'package:comunic/ui/widgets/user_writing_in_conv_notifier.dart'; import 'package:comunic/ui/widgets/user_writing_in_conv_notifier.dart';
import 'package:comunic/utils/account_utils.dart';
import 'package:comunic/utils/date_utils.dart'; import 'package:comunic/utils/date_utils.dart';
import 'package:comunic/utils/files_utils.dart'; import 'package:comunic/utils/files_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
@ -184,6 +185,12 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
setState(() => _messages.removeMsg(ev.msg.id)); setState(() => _messages.removeMsg(ev.msg.id));
} }
}); });
this.listen<RemovedUserFromConversation>((ev) {
if (ev.userID == userID() && ev.convID == widget.conversationID) {
setState(() => _error = ErrorLevel.MAJOR);
}
});
} }
/// Free resources when this conversation widget is no longer required /// Free resources when this conversation widget is no longer required