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
|
private var mentionAutocomplete: Autocomplete<*>? = null
|
||||||
var layoutManager: LinearLayoutManager? = null
|
var layoutManager: LinearLayoutManager? = null
|
||||||
var pullChatMessagesPending = false
|
var pullChatMessagesPending = false
|
||||||
private var lookingIntoFuture = false
|
|
||||||
var newMessagesCount = 0
|
var newMessagesCount = 0
|
||||||
var startCallFromNotification: Boolean? = null
|
var startCallFromNotification: Boolean? = null
|
||||||
var startCallFromRoomSwitch: Boolean = false
|
var startCallFromRoomSwitch: Boolean = false
|
||||||
@ -2256,9 +2255,7 @@ class ChatController(args: Bundle) :
|
|||||||
val fieldMap = HashMap<String, Int>()
|
val fieldMap = HashMap<String, Int>()
|
||||||
fieldMap["includeLastKnown"] = 0
|
fieldMap["includeLastKnown"] = 0
|
||||||
|
|
||||||
if (lookIntoFuture) {
|
if (!lookIntoFuture && isFirstMessagesProcessing) {
|
||||||
lookingIntoFuture = true
|
|
||||||
} else if (isFirstMessagesProcessing) {
|
|
||||||
if (currentConversation != null) {
|
if (currentConversation != null) {
|
||||||
globalLastKnownFutureMessageId = currentConversation!!.lastReadMessage
|
globalLastKnownFutureMessageId = currentConversation!!.lastReadMessage
|
||||||
globalLastKnownPastMessageId = 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
|
LOOKING_INTO_FUTURE_TIMEOUT
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldMap["timeout"] = timeout
|
fieldMap["timeout"] = timeout
|
||||||
|
fieldMap["limit"] = MESSAGE_PULL_LIMIT
|
||||||
|
|
||||||
if (lookIntoFuture) {
|
if (lookIntoFuture) {
|
||||||
fieldMap["lookIntoFuture"] = 1
|
fieldMap["lookIntoFuture"] = 1
|
||||||
@ -2280,8 +2278,6 @@ class ChatController(args: Bundle) :
|
|||||||
fieldMap["lookIntoFuture"] = 0
|
fieldMap["lookIntoFuture"] = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldMap["limit"] = MESSAGE_PULL_LIMIT
|
|
||||||
|
|
||||||
if (setReadMarker) {
|
if (setReadMarker) {
|
||||||
fieldMap["setReadMarker"] = 1
|
fieldMap["setReadMarker"] = 1
|
||||||
} else {
|
} 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 {
|
val xChatLastCommonRead = response.headers()["X-Chat-Last-Common-Read"]?.let {
|
||||||
Integer.parseInt(it)
|
Integer.parseInt(it)
|
||||||
}
|
}
|
||||||
@ -2398,9 +2397,7 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
historyRead = true
|
historyRead = true
|
||||||
|
|
||||||
if (!lookingIntoFuture && validSessionId()) {
|
pullChatMessages(true)
|
||||||
pullChatMessages(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user