mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Display the list of unread conversations
This commit is contained in:
@ -4,6 +4,7 @@ import 'package:comunic/helpers/users_helper.dart';
|
||||
import 'package:comunic/helpers/websocket_helper.dart';
|
||||
import 'package:comunic/lists/conversation_messages_list.dart';
|
||||
import 'package:comunic/lists/conversations_list.dart';
|
||||
import 'package:comunic/lists/unread_conversations_list.dart';
|
||||
import 'package:comunic/lists/users_list.dart';
|
||||
import 'package:comunic/models/api_request.dart';
|
||||
import 'package:comunic/models/api_response.dart';
|
||||
@ -11,6 +12,7 @@ import 'package:comunic/models/conversation.dart';
|
||||
import 'package:comunic/models/conversation_message.dart';
|
||||
import 'package:comunic/models/displayed_content.dart';
|
||||
import 'package:comunic/models/new_conversation_message.dart';
|
||||
import 'package:comunic/models/unread_conversation.dart';
|
||||
import 'package:comunic/utils/account_utils.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
@ -385,6 +387,24 @@ class ConversationsHelper {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Get the list of unread conversations
|
||||
///
|
||||
/// Throws in case of failure
|
||||
static Future<UnreadConversationsList> getListUnread() async {
|
||||
final list = (await APIRequest.withLogin("conversations/get_list_unread")
|
||||
.execWithThrow())
|
||||
.getArray();
|
||||
|
||||
return UnreadConversationsList()
|
||||
..addAll(list.map((f) => UnreadConversation(
|
||||
id: f["id"],
|
||||
convName: f["conv_name"],
|
||||
lastActive: f["last_active"],
|
||||
userID: f["userID"],
|
||||
message: f["message"],
|
||||
)));
|
||||
}
|
||||
|
||||
/// Register a conversation : ask the server to notify about updates to the
|
||||
/// conversation through WebSocket
|
||||
Future<void> registerConversationEvents(int id) async {
|
||||
|
Reference in New Issue
Block a user