Private
Public Access
1
0

ChatRepository: Bump up sync limit a bit

This commit is contained in:
2024-03-19 00:55:43 -07:00
parent 09294e7da9
commit 66c2752096
2 changed files with 3 additions and 3 deletions

View File

@@ -92,6 +92,6 @@ class MessageListViewModel @Inject constructor(
} }
fun synchronize() = viewModelScope.launch { fun synchronize() = viewModelScope.launch {
repository.synchronizeConversation(conversation!!) repository.synchronizeConversation(conversation!!, limit = 100)
} }
} }

View File

@@ -173,10 +173,10 @@ class ChatRepository(
_errorEncounteredChannel.emit(Error.ConnectionError(e)) _errorEncounteredChannel.emit(Error.ConnectionError(e))
} }
suspend fun synchronizeConversation(conversation: Conversation) = try { suspend fun synchronizeConversation(conversation: Conversation, limit: Int = 15) = try {
// TODO: Should only fetch messages after the last GUID we know about. // TODO: Should only fetch messages after the last GUID we know about.
// But keep in mind that outgoing message GUIDs are fake... // But keep in mind that outgoing message GUIDs are fake...
val messages = fetchMessages(conversation, limit = 15) val messages = fetchMessages(conversation, limit = limit)
database.writeMessages(messages, conversation) database.writeMessages(messages, conversation)
} catch (e: java.lang.Exception) { } catch (e: java.lang.Exception) {
_errorEncounteredChannel.emit(Error.ConnectionError(e)) _errorEncounteredChannel.emit(Error.ConnectionError(e))