From 5513f9c88f92cb269ca626b1d4a2aa1211b546da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Sun, 18 Sep 2022 14:24:26 +0200 Subject: [PATCH] Fix checking lobby state from chat controller while in a call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../java/com/nextcloud/talk/controllers/ChatController.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt index ddc8c5460..2df485518 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt @@ -1818,6 +1818,12 @@ class ChatController(args: Bundle) : activity?.findViewById(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 {