mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
Refactor (delete lookingIntoFuture)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
7065b18d07
commit
6f4a24b28f
@ -264,7 +264,6 @@ class ChatController(args: Bundle) :
|
||||
private var mentionAutocomplete: Autocomplete<*>? = null
|
||||
var layoutManager: LinearLayoutManager? = null
|
||||
var pullChatMessagesPending = false
|
||||
private var lookingIntoFuture = false
|
||||
var newMessagesCount = 0
|
||||
var startCallFromNotification: Boolean? = null
|
||||
var startCallFromRoomSwitch: Boolean = false
|
||||
@ -2256,9 +2255,7 @@ class ChatController(args: Bundle) :
|
||||
val fieldMap = HashMap<String, Int>()
|
||||
fieldMap["includeLastKnown"] = 0
|
||||
|
||||
if (lookIntoFuture) {
|
||||
lookingIntoFuture = true
|
||||
} else if (isFirstMessagesProcessing) {
|
||||
if (!lookIntoFuture && isFirstMessagesProcessing) {
|
||||
if (currentConversation != null) {
|
||||
globalLastKnownFutureMessageId = currentConversation!!.lastReadMessage
|
||||
globalLastKnownPastMessageId = currentConversation!!.lastReadMessage
|
||||
@ -2266,13 +2263,14 @@ class ChatController(args: Bundle) :
|
||||
}
|
||||
}
|
||||
|
||||
val timeout = if (lookingIntoFuture) {
|
||||
val timeout = if (lookIntoFuture) {
|
||||
LOOKING_INTO_FUTURE_TIMEOUT
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
fieldMap["timeout"] = timeout
|
||||
fieldMap["limit"] = MESSAGE_PULL_LIMIT
|
||||
|
||||
if (lookIntoFuture) {
|
||||
fieldMap["lookIntoFuture"] = 1
|
||||
@ -2280,8 +2278,6 @@ class ChatController(args: Bundle) :
|
||||
fieldMap["lookIntoFuture"] = 0
|
||||
}
|
||||
|
||||
fieldMap["limit"] = MESSAGE_PULL_LIMIT
|
||||
|
||||
if (setReadMarker) {
|
||||
fieldMap["setReadMarker"] = 1
|
||||
} else {
|
||||
@ -2376,7 +2372,10 @@ class ChatController(args: Bundle) :
|
||||
}
|
||||
}
|
||||
|
||||
private fun processMessagesResponse(response: Response<*>, isFromTheFuture: Boolean) {
|
||||
private fun processMessagesResponse(
|
||||
response: Response<*>,
|
||||
isFromTheFuture: Boolean
|
||||
) {
|
||||
val xChatLastCommonRead = response.headers()["X-Chat-Last-Common-Read"]?.let {
|
||||
Integer.parseInt(it)
|
||||
}
|
||||
@ -2398,9 +2397,7 @@ class ChatController(args: Bundle) :
|
||||
|
||||
historyRead = true
|
||||
|
||||
if (!lookingIntoFuture && validSessionId()) {
|
||||
pullChatMessages(true)
|
||||
}
|
||||
pullChatMessages(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user