Add pagination to message screen.

This commit is contained in:
天クマ 2026-07-16 21:26:32 -03:00
commit cedbd2b3c0
5 changed files with 94 additions and 9 deletions

View file

@ -1,4 +1,4 @@
import { loadChatsSorted, loadLatestMessages, loadMedia, upsertChats, upsertMedia, upsertMessages } from "./db.js";
import { loadChatsSorted, loadLatestMessages, loadMedia, loadOlderMessages, upsertChats, upsertMedia, upsertMessages } from "./db.js";
import { waha } from "./waha.js";
let online = false;
@ -107,6 +107,14 @@ export async function getChatMessages(chatId) {
}
}
export async function getMoreChatMessages(chatId, oldestTimestamp, oldestId, limit = 50) {
if (online) {
return waha.getChatMessages(chatId, oldestTimestamp);
} else {
return await loadOlderMessages(chatId, oldestTimestamp, oldestId);
}
}
export async function getChatPicture(chatId) {
if (online) {
return await waha.getChatPicture(chatId);