1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Handles join / leave events

This commit is contained in:
2020-04-20 14:24:35 +02:00
parent 9154fe47e1
commit 08d357fc72
4 changed files with 44 additions and 1 deletions

View File

@ -70,6 +70,22 @@ class DeletedConversationMessageEvent {
DeletedConversationMessageEvent(this.msg);
}
/// User joined call event
class UserJoinedCallEvent {
final int callID;
final int userID;
UserJoinedCallEvent(this.callID, this.userID);
}
/// User left call event
class UserLeftCallEvent {
final int callID;
final int userID;
UserLeftCallEvent(this.callID, this.userID);
}
class EventsHelper {
static EventBus _mgr = EventBus();

View File

@ -161,6 +161,18 @@ class WebSocketHelper {
ConversationsHelper.apiToConversationMessage(msg.data)));
break;
// A user joined a call
case "user_joined_call":
EventsHelper.emit(
UserJoinedCallEvent(msg.data["callID"], msg.data["userID"]));
break;
// A user left a call
case "user_left_call":
EventsHelper.emit(
UserLeftCallEvent(msg.data["callID"], msg.data["userID"]));
break;
default:
throw Exception("Unknown message type: ${msg.title}");
}