Fix checking lobby state from chat controller while in a call

The chat controller gets the room information again and again to check
whether the lobby is enabled and update the UI as needed. This loop is
stopped when the chat controller is detached, but only if no call is
active; if a call is active the room information will still be got again
and again, even if the chat controller is detached.

To solve that now getting the room information is simply stopped when
the chat controller is detached, no matter if there is an active call or
not, and started again when joining the room, which is done when the
chat controller is attached.

However, this is just a quick fix that does not solve the issue in all
cases; the loop can still continue during calls, for example if the
request to get the information is sent before detaching the controller
and the response is received once the controller was detached, as that
would start the timer again.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-09-18 14:24:26 +02:00
parent 53e3543839
commit 5513f9c88f

View file

@ -1818,6 +1818,12 @@ class ChatController(args: Bundle) :
activity?.findViewById<View>(R.id.toolbar)?.setOnClickListener(null)
}
checkingLobbyStatus = false
if (lobbyTimerHandler != null) {
lobbyTimerHandler?.removeCallbacksAndMessages(null)
}
if (conversationUser != null && isActivityNotChangingConfigurations() && isNotInCall()) {
ApplicationWideCurrentRoomHolder.getInstance().clear()
if (inConversation && validSessionId()) {
@ -1952,6 +1958,7 @@ class ChatController(args: Bundle) :
currentConversation?.sessionId
)
}
checkLobbyState()
if (isFirstMessagesProcessing) {
pullChatMessages(0)
} else {