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

Automatically change the number of unread conversations

This commit is contained in:
2020-04-18 14:33:07 +02:00
parent a8c358fd58
commit 526f698bf4
4 changed files with 30 additions and 8 deletions

View File

@ -16,6 +16,13 @@ class NewNumberNotifsEvent {
NewNumberNotifsEvent(this.newNum);
}
/// New number of unread conversations
class NewNumberUnreadConversations {
final int newNum;
NewNumberUnreadConversations(this.newNum);
}
class EventsHelper {
static EventBus _mgr = EventBus();

View File

@ -80,10 +80,16 @@ class WebSocketHelper {
/// Process an unattended message
static _processUnattendedMessage(WsMessage msg) {
switch (msg.title) {
// New number of notifications
case "number_notifs":
EventsHelper.emit(NewNumberNotifsEvent(msg.data));
break;
// New number of unread conversations
case "number_unread_conversations":
EventsHelper.emit(NewNumberUnreadConversations(msg.data));
break;
default:
throw Exception("Unknown message type: ${msg.title}");
}