mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
add logging to examine issue #2181
# reproduce: 1. click in chat where someone is mentioned. 2. click on the mention 3. go back to first chat # result: validSessionId() can be false in onDetach for the second chat when going back to first chat -> leaveRoom is not executed -> disposable is not disposed -> getRoomInfo() continues to execute for old controller -> e.g. appbar infos can be wrong (wrong avatar/title) Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
b16a89349b
commit
943dfa2a83
@ -363,11 +363,13 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
Log.d(TAG, "onBackPressed")
|
||||
if (router!!.getControllerWithTag(LockedController.TAG) != null) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!router!!.handleBack()) {
|
||||
Log.d(TAG, "back press was not handled by top controller. call onBackPressed...")
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
@ -336,6 +336,8 @@ class ChatController(args: Bundle) :
|
||||
}
|
||||
|
||||
private fun getRoomInfo() {
|
||||
logConversationInfos("getRoomInfo")
|
||||
|
||||
val shouldRepeat = CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "webinary-lobby")
|
||||
if (shouldRepeat) {
|
||||
checkingLobbyStatus = true
|
||||
@ -358,11 +360,9 @@ class ChatController(args: Bundle) :
|
||||
override fun onNext(roomOverall: RoomOverall) {
|
||||
Log.d(TAG, "getRoomInfo - getRoom - got response: $startNanoTime")
|
||||
currentConversation = roomOverall.ocs!!.data
|
||||
Log.d(
|
||||
TAG,
|
||||
"getRoomInfo. token: " + currentConversation?.token +
|
||||
" sessionId: " + currentConversation?.sessionId
|
||||
)
|
||||
|
||||
logConversationInfos("getRoomInfo#onNext")
|
||||
|
||||
loadAvatarForStatusBar()
|
||||
setTitle()
|
||||
participantPermissions = ParticipantPermissions(conversationUser, currentConversation!!)
|
||||
@ -1739,11 +1739,8 @@ class ChatController(args: Bundle) :
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
override fun onAttach(view: View) {
|
||||
super.onAttach(view)
|
||||
Log.d(
|
||||
TAG,
|
||||
"onAttach: Controller: " + System.identityHashCode(this).toString() +
|
||||
" Activity: " + System.identityHashCode(activity).toString()
|
||||
)
|
||||
logConversationInfos("onAttach")
|
||||
|
||||
eventBus.register(this)
|
||||
|
||||
if (conversationUser?.userId != "?" &&
|
||||
@ -1831,11 +1828,8 @@ class ChatController(args: Bundle) :
|
||||
|
||||
override fun onDetach(view: View) {
|
||||
super.onDetach(view)
|
||||
Log.d(
|
||||
TAG,
|
||||
"onDetach: Controller: " + System.identityHashCode(this).toString() +
|
||||
" Activity: " + System.identityHashCode(activity).toString()
|
||||
)
|
||||
|
||||
logConversationInfos("onDetach")
|
||||
|
||||
eventBus.unregister(this)
|
||||
|
||||
@ -1851,9 +1845,15 @@ class ChatController(args: Bundle) :
|
||||
|
||||
if (conversationUser != null && isActivityNotChangingConfigurations() && isNotInCall()) {
|
||||
ApplicationWideCurrentRoomHolder.getInstance().clear()
|
||||
// why is sessionId = 0 here ?!?! this causes that leaveRoom is not executed and callbacks continue to
|
||||
// receive which causes bugs!!!
|
||||
if (inConversation && validSessionId()) {
|
||||
leaveRoom()
|
||||
} else {
|
||||
Log.e(TAG, "not leaving room (inConversation is false and/or validSessionId is false)")
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "not leaving room...")
|
||||
}
|
||||
|
||||
if (mentionAutocomplete != null && mentionAutocomplete!!.isPopupShowing) {
|
||||
@ -1993,7 +1993,8 @@ class ChatController(args: Bundle) :
|
||||
}
|
||||
|
||||
private fun leaveRoom() {
|
||||
Log.d(TAG, "leaveRoom")
|
||||
logConversationInfos("leaveRoom")
|
||||
|
||||
var apiVersion = 1
|
||||
// FIXME Fix API checking with guests?
|
||||
if (conversationUser != null) {
|
||||
@ -3412,6 +3413,18 @@ class ChatController(args: Bundle) :
|
||||
)
|
||||
}
|
||||
|
||||
private fun logConversationInfos(methodName: String) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, " | -----------------------------------------------")
|
||||
Log.d(TAG, " | method: $methodName")
|
||||
Log.d(TAG, " | ChatController: " + System.identityHashCode(this).toString())
|
||||
Log.d(TAG, " | roomToken: $roomToken")
|
||||
Log.d(TAG, " | currentConversation?.displayName: ${currentConversation?.displayName}")
|
||||
Log.d(TAG, " | currentConversation?.sessionId: ${currentConversation?.sessionId}")
|
||||
Log.d(TAG, " | -----------------------------------------------")
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "ChatController"
|
||||
private const val CONTENT_TYPE_SYSTEM_MESSAGE: Byte = 1
|
||||
|
@ -245,6 +245,9 @@ abstract class BaseController(@LayoutRes var layoutRes: Int, args: Bundle? = nul
|
||||
calculateValidParentController()
|
||||
}
|
||||
actionBar!!.title = title
|
||||
Log.d(TAG, "setTitle: $title")
|
||||
} else {
|
||||
Log.d(TAG, "title was not set!!!!")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user