From f0edd4ca51449f3bba7eb3d713956e4db2001605 Mon Sep 17 00:00:00 2001 From: aforge Date: Sun, 26 Feb 2023 19:15:20 -0800 Subject: [PATCH] Fetch messages from server using Topic.missingRange. (cherry picked from commit a8266bcc1de9ebf13cc28b0f6771a3df4db45a69) --- TinodeSDK/ComTopic.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/TinodeSDK/ComTopic.swift b/TinodeSDK/ComTopic.swift index 53c11b0a..bb85d7f1 100644 --- a/TinodeSDK/ComTopic.swift +++ b/TinodeSDK/ComTopic.swift @@ -128,9 +128,7 @@ public class ComTopic: Topic { // Not enough messages in cache to fullfill the request, call the server. // Use query builder to get cached message ranges. - // 'since' is inclusive (>=), 'before' is exclusive (<). - let (since, before) = forward ? (lastLoadedSeq + 1, nil) : (nil, lastLoadedSeq) - let query = metaGetBuilder().withData(since: since, before: before, limit: remainingCount) + let query = metaGetBuilder().withEarlierData(limit: limit) getMeta(query: query.build()) .thenApply({ _ in // Read message page from DB.