diff --git a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt index f8055e66d..3e534beb3 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt @@ -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() } } 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 9e65b68b5..3ada67e65 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt @@ -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 diff --git a/app/src/main/java/com/nextcloud/talk/controllers/base/BaseController.kt b/app/src/main/java/com/nextcloud/talk/controllers/base/BaseController.kt index 6ccb4fe7c..8a8b6525a 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/base/BaseController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/base/BaseController.kt @@ -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!!!!") } }