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:
parent
ed9f5e396c
commit
a630a5ae79
@ -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;
|
||||||
|
@ -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(
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user