mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
fix: only fetch latest messages on first join
This commit is contained in:
parent
00f28b7360
commit
44fc0fc2dd
@ -576,6 +576,7 @@ object OpenGroupApi {
|
|||||||
)
|
)
|
||||||
rooms.forEach { room ->
|
rooms.forEach { room ->
|
||||||
val infoUpdates = storage.getOpenGroup(room, server)?.infoUpdates ?: 0
|
val infoUpdates = storage.getOpenGroup(room, server)?.infoUpdates ?: 0
|
||||||
|
val lastMessageServerId = storage.getLastMessageServerID(room, server) ?: 0L
|
||||||
requests.add(
|
requests.add(
|
||||||
BatchRequestInfo(
|
BatchRequestInfo(
|
||||||
request = BatchRequest(
|
request = BatchRequest(
|
||||||
@ -587,7 +588,7 @@ object OpenGroupApi {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
requests.add(
|
requests.add(
|
||||||
if (shouldRetrieveRecentMessages) {
|
if (shouldRetrieveRecentMessages || lastMessageServerId == 0L) {
|
||||||
BatchRequestInfo(
|
BatchRequestInfo(
|
||||||
request = BatchRequest(
|
request = BatchRequest(
|
||||||
method = GET,
|
method = GET,
|
||||||
@ -597,7 +598,6 @@ object OpenGroupApi {
|
|||||||
responseType = object : TypeReference<List<Message>>(){}
|
responseType = object : TypeReference<List<Message>>(){}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
val lastMessageServerId = storage.getLastMessageServerID(room, server) ?: 0L
|
|
||||||
BatchRequestInfo(
|
BatchRequestInfo(
|
||||||
request = BatchRequest(
|
request = BatchRequest(
|
||||||
method = GET,
|
method = GET,
|
||||||
|
Loading…
Reference in New Issue
Block a user