1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-07-03 15:13:29 +00:00

Use the conversation messages cache before going online

This commit is contained in:
2019-04-27 09:24:29 +02:00
parent eaac6b1afa
commit 0579397ba7
4 changed files with 74 additions and 10 deletions

View File

@ -176,9 +176,16 @@ class ConversationsHelper {
/// the conversation.
/// Otherwise [lastMessageID] contains the ID of the last known message
Future<ConversationMessagesList> getNewMessages(
{@required int conversationID, int lastMessageID = 0}) async {
return await _downloadNewMessagesSingle(conversationID,
lastMessageID: lastMessageID);
{@required int conversationID,
int lastMessageID = 0,
bool online = true}) async {
if (online)
return await _downloadNewMessagesSingle(conversationID,
lastMessageID: lastMessageID);
else
return await _conversationMessagesDatabaseHelper
.getAllMessagesConversations(conversationID,
lastMessageID: lastMessageID);
}
/// Send a new message to the server