🐛 Fix messages loading

This commit is contained in:
2024-09-16 19:50:49 +08:00
parent e11bf204af
commit 5941cb9fd5
5 changed files with 50 additions and 14 deletions

View File

@ -129,6 +129,14 @@ class MessagesFetchingProvider extends GetxController {
return await receiveEvent(remoteRecord);
}
Future<LocalMessageEventTableData?> getEventFromLocal(int id) async {
final database = Get.find<DatabaseProvider>().database;
final localRecord = await (database.select(database.localMessageEventTable)
..where((x) => x.id.equals(id)))
.getSingleOrNull();
return localRecord;
}
/// Pull the remote events to local database
Future<(List<Event>, int)?> pullRemoteEvents(Channel channel,
{String scope = 'global', take = 10, offset = 0}) async {