mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-10 14:24:05 +01:00
Make lookIntoFuture parameter boolean
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
6b6dff9e43
commit
3d6674e35a
@ -1414,10 +1414,10 @@ class ChatController(args: Bundle) :
|
|||||||
binding?.messageInputView?.inputEditText?.visibility = View.VISIBLE
|
binding?.messageInputView?.inputEditText?.visibility = View.VISIBLE
|
||||||
if (isFirstMessagesProcessing && pastPreconditionFailed) {
|
if (isFirstMessagesProcessing && pastPreconditionFailed) {
|
||||||
pastPreconditionFailed = false
|
pastPreconditionFailed = false
|
||||||
pullChatMessages(0)
|
pullChatMessages(false)
|
||||||
} else if (futurePreconditionFailed) {
|
} else if (futurePreconditionFailed) {
|
||||||
futurePreconditionFailed = false
|
futurePreconditionFailed = false
|
||||||
pullChatMessages(1)
|
pullChatMessages(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2014,9 +2014,9 @@ class ChatController(args: Bundle) :
|
|||||||
webSocketInstance?.getSignalingMessageReceiver()?.addListener(localParticipantMessageListener)
|
webSocketInstance?.getSignalingMessageReceiver()?.addListener(localParticipantMessageListener)
|
||||||
|
|
||||||
if (isFirstMessagesProcessing) {
|
if (isFirstMessagesProcessing) {
|
||||||
pullChatMessages(0)
|
pullChatMessages(false)
|
||||||
} else {
|
} else {
|
||||||
pullChatMessages(1, 0)
|
pullChatMessages(true, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (webSocketInstance != null) {
|
if (webSocketInstance != null) {
|
||||||
@ -2054,9 +2054,9 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isFirstMessagesProcessing) {
|
if (isFirstMessagesProcessing) {
|
||||||
pullChatMessages(0)
|
pullChatMessages(false)
|
||||||
} else {
|
} else {
|
||||||
pullChatMessages(1)
|
pullChatMessages(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2234,7 +2234,7 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun pullChatMessages(lookIntoFuture: Int, setReadMarker: Int = 1, xChatLastCommonRead: Int? = null) {
|
fun pullChatMessages(lookIntoFuture: Boolean, setReadMarker: Int = 1, xChatLastCommonRead: Int? = null) {
|
||||||
if (!validSessionId()) {
|
if (!validSessionId()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2252,7 +2252,7 @@ class ChatController(args: Bundle) :
|
|||||||
val fieldMap = HashMap<String, Int>()
|
val fieldMap = HashMap<String, Int>()
|
||||||
fieldMap["includeLastKnown"] = 0
|
fieldMap["includeLastKnown"] = 0
|
||||||
|
|
||||||
if (lookIntoFuture > 0) {
|
if (lookIntoFuture) {
|
||||||
lookingIntoFuture = true
|
lookingIntoFuture = true
|
||||||
} else if (isFirstMessagesProcessing) {
|
} else if (isFirstMessagesProcessing) {
|
||||||
if (currentConversation != null) {
|
if (currentConversation != null) {
|
||||||
@ -2270,11 +2270,16 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
fieldMap["timeout"] = timeout
|
fieldMap["timeout"] = timeout
|
||||||
|
|
||||||
fieldMap["lookIntoFuture"] = lookIntoFuture
|
if (lookIntoFuture) {
|
||||||
|
fieldMap["lookIntoFuture"] = 1
|
||||||
|
} else {
|
||||||
|
fieldMap["lookIntoFuture"] = 0
|
||||||
|
}
|
||||||
|
|
||||||
fieldMap["limit"] = MESSAGE_PULL_LIMIT
|
fieldMap["limit"] = MESSAGE_PULL_LIMIT
|
||||||
fieldMap["setReadMarker"] = setReadMarker
|
fieldMap["setReadMarker"] = setReadMarker
|
||||||
|
|
||||||
val lastKnown = if (lookIntoFuture > 0) {
|
val lastKnown = if (lookIntoFuture) {
|
||||||
globalLastKnownFutureMessageId
|
globalLastKnownFutureMessageId
|
||||||
} else {
|
} else {
|
||||||
globalLastKnownPastMessageId
|
globalLastKnownPastMessageId
|
||||||
@ -2291,7 +2296,7 @@ class ChatController(args: Bundle) :
|
|||||||
apiVersion = ApiUtils.getChatApiVersion(conversationUser, intArrayOf(1))
|
apiVersion = ApiUtils.getChatApiVersion(conversationUser, intArrayOf(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookIntoFuture > 0) {
|
if (lookIntoFuture) {
|
||||||
Log.d(TAG, "pullChatMessages - pullChatMessages[lookIntoFuture > 0] - calling")
|
Log.d(TAG, "pullChatMessages - pullChatMessages[lookIntoFuture > 0] - calling")
|
||||||
ncApi.pullChatMessages(
|
ncApi.pullChatMessages(
|
||||||
credentials,
|
credentials,
|
||||||
@ -2311,7 +2316,7 @@ class ChatController(args: Bundle) :
|
|||||||
pullChatMessagesPending = false
|
pullChatMessagesPending = false
|
||||||
if (response.code() == HTTP_CODE_NOT_MODIFIED) {
|
if (response.code() == HTTP_CODE_NOT_MODIFIED) {
|
||||||
Log.d(TAG, "pullChatMessages - quasi recursive call to pullChatMessages")
|
Log.d(TAG, "pullChatMessages - quasi recursive call to pullChatMessages")
|
||||||
pullChatMessages(1, setReadMarker, xChatLastCommonRead)
|
pullChatMessages(true, setReadMarker, xChatLastCommonRead)
|
||||||
} else if (response.code() == HTTP_CODE_PRECONDITION_FAILED) {
|
} else if (response.code() == HTTP_CODE_PRECONDITION_FAILED) {
|
||||||
futurePreconditionFailed = true
|
futurePreconditionFailed = true
|
||||||
} else {
|
} else {
|
||||||
@ -2416,7 +2421,7 @@ class ChatController(args: Bundle) :
|
|||||||
historyRead = true
|
historyRead = true
|
||||||
|
|
||||||
if (!lookingIntoFuture && validSessionId()) {
|
if (!lookingIntoFuture && validSessionId()) {
|
||||||
pullChatMessages(1)
|
pullChatMessages(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2452,7 +2457,7 @@ class ChatController(args: Bundle) :
|
|||||||
adapter?.notifyDataSetChanged()
|
adapter?.notifyDataSetChanged()
|
||||||
|
|
||||||
if (validSessionId()) {
|
if (validSessionId()) {
|
||||||
pullChatMessages(1, 1, xChatLastCommonRead)
|
pullChatMessages(true, 1, xChatLastCommonRead)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2645,7 +2650,7 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
override fun onLoadMore(page: Int, totalItemsCount: Int) {
|
override fun onLoadMore(page: Int, totalItemsCount: Int) {
|
||||||
if (!historyRead && validSessionId()) {
|
if (!historyRead && validSessionId()) {
|
||||||
pullChatMessages(0)
|
pullChatMessages(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user