Add pagination to message screen.
This commit is contained in:
parent
0b9ed3a68a
commit
cedbd2b3c0
5 changed files with 94 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue