mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 04:29:45 +01:00
Merge pull request #2815 from nextcloud/bugfix/noid/reduceGetRoomRequests
Request RoomInfo every 30 sec instead 5sec when not waiting in lobby
This commit is contained in:
commit
96c1e581fb
@ -283,7 +283,7 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
var webSocketInstance: WebSocketInstance? = null
|
var webSocketInstance: WebSocketInstance? = null
|
||||||
|
|
||||||
var lobbyTimerHandler: Handler? = null
|
var getRoomInfoTimerHandler: Handler? = null
|
||||||
var pastPreconditionFailed = false
|
var pastPreconditionFailed = false
|
||||||
var futurePreconditionFailed = false
|
var futurePreconditionFailed = false
|
||||||
|
|
||||||
@ -353,11 +353,6 @@ class ChatController(args: Bundle) :
|
|||||||
private fun getRoomInfo() {
|
private fun getRoomInfo() {
|
||||||
logConversationInfos("getRoomInfo")
|
logConversationInfos("getRoomInfo")
|
||||||
|
|
||||||
val shouldRepeat = CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "webinary-lobby")
|
|
||||||
if (shouldRepeat) {
|
|
||||||
checkingLobbyStatus = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conversationUser != null) {
|
if (conversationUser != null) {
|
||||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
|
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
|
||||||
|
|
||||||
@ -401,13 +396,17 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
override fun onComplete() {
|
override fun onComplete() {
|
||||||
Log.d(TAG, "getRoomInfo - getRoom - onComplete: $startNanoTime")
|
Log.d(TAG, "getRoomInfo - getRoom - onComplete: $startNanoTime")
|
||||||
if (shouldRepeat) {
|
|
||||||
if (lobbyTimerHandler == null) {
|
val delayForRecursiveCall = if (shouldShowLobby()) {
|
||||||
lobbyTimerHandler = Handler()
|
GET_ROOM_INFO_DELAY_LOBBY
|
||||||
|
} else {
|
||||||
|
GET_ROOM_INFO_DELAY_NORMAL
|
||||||
}
|
}
|
||||||
|
|
||||||
lobbyTimerHandler?.postDelayed({ getRoomInfo() }, LOBBY_TIMER_DELAY)
|
if (getRoomInfoTimerHandler == null) {
|
||||||
|
getRoomInfoTimerHandler = Handler()
|
||||||
}
|
}
|
||||||
|
getRoomInfoTimerHandler?.postDelayed({ getRoomInfo() }, delayForRecursiveCall)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1337,7 +1336,8 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
private fun shouldShowLobby(): Boolean {
|
private fun shouldShowLobby(): Boolean {
|
||||||
if (currentConversation != null) {
|
if (currentConversation != null) {
|
||||||
return currentConversation?.lobbyState == Conversation.LobbyState.LOBBY_STATE_MODERATORS_ONLY &&
|
return CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "webinary-lobby") &&
|
||||||
|
currentConversation?.lobbyState == Conversation.LobbyState.LOBBY_STATE_MODERATORS_ONLY &&
|
||||||
currentConversation?.canModerate(conversationUser!!) == false &&
|
currentConversation?.canModerate(conversationUser!!) == false &&
|
||||||
!participantPermissions.canIgnoreLobby()
|
!participantPermissions.canIgnoreLobby()
|
||||||
}
|
}
|
||||||
@ -1381,10 +1381,6 @@ class ChatController(args: Bundle) :
|
|||||||
currentConversation?.isLobbyViewApplicable(conversationUser!!) == true &&
|
currentConversation?.isLobbyViewApplicable(conversationUser!!) == true &&
|
||||||
isAlive()
|
isAlive()
|
||||||
) {
|
) {
|
||||||
if (!checkingLobbyStatus) {
|
|
||||||
getRoomInfo()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldShowLobby()) {
|
if (shouldShowLobby()) {
|
||||||
binding?.lobby?.lobbyView?.visibility = View.VISIBLE
|
binding?.lobby?.lobbyView?.visibility = View.VISIBLE
|
||||||
binding?.messagesListView?.visibility = View.GONE
|
binding?.messagesListView?.visibility = View.GONE
|
||||||
@ -1880,8 +1876,8 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
checkingLobbyStatus = false
|
checkingLobbyStatus = false
|
||||||
|
|
||||||
if (lobbyTimerHandler != null) {
|
if (getRoomInfoTimerHandler != null) {
|
||||||
lobbyTimerHandler?.removeCallbacksAndMessages(null)
|
getRoomInfoTimerHandler?.removeCallbacksAndMessages(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conversationUser != null && isActivityNotChangingConfigurations() && isNotInCall()) {
|
if (conversationUser != null && isActivityNotChangingConfigurations() && isNotInCall()) {
|
||||||
@ -1993,8 +1989,6 @@ class ChatController(args: Bundle) :
|
|||||||
// onAttach() was called.
|
// onAttach() was called.
|
||||||
webSocketInstance?.getSignalingMessageReceiver()?.addListener(localParticipantMessageListener)
|
webSocketInstance?.getSignalingMessageReceiver()?.addListener(localParticipantMessageListener)
|
||||||
|
|
||||||
checkLobbyState()
|
|
||||||
|
|
||||||
if (isFirstMessagesProcessing) {
|
if (isFirstMessagesProcessing) {
|
||||||
pullChatMessages(0)
|
pullChatMessages(0)
|
||||||
} else {
|
} else {
|
||||||
@ -2034,7 +2028,7 @@ class ChatController(args: Bundle) :
|
|||||||
sessionIdAfterRoomJoined
|
sessionIdAfterRoomJoined
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
checkLobbyState()
|
|
||||||
if (isFirstMessagesProcessing) {
|
if (isFirstMessagesProcessing) {
|
||||||
pullChatMessages(0)
|
pullChatMessages(0)
|
||||||
} else {
|
} else {
|
||||||
@ -2078,8 +2072,8 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
checkingLobbyStatus = false
|
checkingLobbyStatus = false
|
||||||
|
|
||||||
if (lobbyTimerHandler != null) {
|
if (getRoomInfoTimerHandler != null) {
|
||||||
lobbyTimerHandler?.removeCallbacksAndMessages(null)
|
getRoomInfoTimerHandler?.removeCallbacksAndMessages(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (webSocketInstance != null && currentConversation != null) {
|
if (webSocketInstance != null && currentConversation != null) {
|
||||||
@ -3508,7 +3502,8 @@ class ChatController(args: Bundle) :
|
|||||||
private const val CONTENT_TYPE_LINK_PREVIEW: Byte = 6
|
private const val CONTENT_TYPE_LINK_PREVIEW: Byte = 6
|
||||||
private const val NEW_MESSAGES_POPUP_BUBBLE_DELAY: Long = 200
|
private const val NEW_MESSAGES_POPUP_BUBBLE_DELAY: Long = 200
|
||||||
private const val POP_CURRENT_CONTROLLER_DELAY: Long = 100
|
private const val POP_CURRENT_CONTROLLER_DELAY: Long = 100
|
||||||
private const val LOBBY_TIMER_DELAY: Long = 5000
|
private const val GET_ROOM_INFO_DELAY_NORMAL: Long = 30000
|
||||||
|
private const val GET_ROOM_INFO_DELAY_LOBBY: Long = 5000
|
||||||
private const val HTTP_CODE_OK: Int = 200
|
private const val HTTP_CODE_OK: Int = 200
|
||||||
private const val AGE_THRESHOLD_FOR_DELETE_MESSAGE: Int = 21600000 // (6 hours in millis = 6 * 3600 * 1000)
|
private const val AGE_THRESHOLD_FOR_DELETE_MESSAGE: Int = 21600000 // (6 hours in millis = 6 * 3600 * 1000)
|
||||||
private const val REQUEST_CODE_CHOOSE_FILE: Int = 555
|
private const val REQUEST_CODE_CHOOSE_FILE: Int = 555
|
||||||
|
Loading…
Reference in New Issue
Block a user