More diagnostic logging

Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
This commit is contained in:
Dariusz Olszewski 2022-01-15 20:29:56 +01:00 committed by Marcel Hibbe
parent b10d0cb98a
commit b88530da6f
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -311,6 +311,7 @@ class ChatController(args: Bundle) :
if (conversationUser != null) { if (conversationUser != null) {
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1)) val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
Log.d(TAG, "getRoomInfo - getRoomAPI - calling")
ncApi?.getRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, conversationUser.baseUrl, roomToken)) ncApi?.getRoom(credentials, ApiUtils.getUrlForRoom(apiVersion, conversationUser.baseUrl, roomToken))
?.subscribeOn(Schedulers.io()) ?.subscribeOn(Schedulers.io())
?.observeOn(AndroidSchedulers.mainThread()) ?.observeOn(AndroidSchedulers.mainThread())
@ -321,6 +322,7 @@ class ChatController(args: Bundle) :
@Suppress("Detekt.TooGenericExceptionCaught") @Suppress("Detekt.TooGenericExceptionCaught")
override fun onNext(roomOverall: RoomOverall) { override fun onNext(roomOverall: RoomOverall) {
Log.d(TAG, "getRoomInfo - getRoomAPI - got response")
currentConversation = roomOverall.ocs.data currentConversation = roomOverall.ocs.data
Log.d( Log.d(
TAG, TAG,
@ -369,6 +371,7 @@ class ChatController(args: Bundle) :
apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1)) apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
} }
Log.d(TAG, "handleFromNotification - getRooms - calling")
ncApi?.getRooms(credentials, ApiUtils.getUrlForRooms(apiVersion, conversationUser?.baseUrl)) ncApi?.getRooms(credentials, ApiUtils.getUrlForRooms(apiVersion, conversationUser?.baseUrl))
?.subscribeOn(Schedulers.io())?.observeOn(AndroidSchedulers.mainThread()) ?.subscribeOn(Schedulers.io())?.observeOn(AndroidSchedulers.mainThread())
?.subscribe(object : Observer<RoomsOverall> { ?.subscribe(object : Observer<RoomsOverall> {
@ -377,6 +380,7 @@ class ChatController(args: Bundle) :
} }
override fun onNext(roomsOverall: RoomsOverall) { override fun onNext(roomsOverall: RoomsOverall) {
Log.d(TAG, "handleFromNotification - getRooms - got response")
for (conversation in roomsOverall.ocs.data) { for (conversation in roomsOverall.ocs.data) {
if (roomId == conversation.roomId) { if (roomId == conversation.roomId) {
roomToken = conversation.token roomToken = conversation.token
@ -1550,6 +1554,7 @@ class ChatController(args: Bundle) :
cancelNotificationsForCurrentConversation() cancelNotificationsForCurrentConversation()
Log.d(TAG, "onAttach inConversation: " + inConversation.toString() + " wasDetached: " + wasDetached.toString())
if (inConversation) { if (inConversation) {
if (wasDetached) { if (wasDetached) {
currentConversation?.sessionId = "0" currentConversation?.sessionId = "0"
@ -1642,6 +1647,7 @@ class ChatController(args: Bundle) :
} }
private fun joinRoomWithPassword() { private fun joinRoomWithPassword() {
Log.d(TAG, "joinRoomWithPassword start: " + (currentConversation == null).toString())
if (currentConversation == null || if (currentConversation == null ||
TextUtils.isEmpty(currentConversation?.sessionId) || TextUtils.isEmpty(currentConversation?.sessionId) ||
@ -1653,6 +1659,7 @@ class ChatController(args: Bundle) :
apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1)) apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
} }
Log.d(TAG, "joinRoomWithPassword - joinRoom - calling")
ncApi?.joinRoom( ncApi?.joinRoom(
credentials, credentials,
ApiUtils.getUrlForParticipantsActive(apiVersion, conversationUser?.baseUrl, roomToken), ApiUtils.getUrlForParticipantsActive(apiVersion, conversationUser?.baseUrl, roomToken),
@ -1668,6 +1675,7 @@ class ChatController(args: Bundle) :
@Suppress("Detekt.TooGenericExceptionCaught") @Suppress("Detekt.TooGenericExceptionCaught")
override fun onNext(roomOverall: RoomOverall) { override fun onNext(roomOverall: RoomOverall) {
Log.d(TAG, "joinRoomWithPassword - joinRoom - got response")
inConversation = true inConversation = true
currentConversation?.sessionId = roomOverall.ocs.data.sessionId currentConversation?.sessionId = roomOverall.ocs.data.sessionId
@ -1735,6 +1743,7 @@ class ChatController(args: Bundle) :
apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1)) apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
} }
Log.d(TAG, "leaveRoom - leaveRoom - calling")
ncApi?.leaveRoom( ncApi?.leaveRoom(
credentials, credentials,
ApiUtils.getUrlForParticipantsActive( ApiUtils.getUrlForParticipantsActive(
@ -1751,6 +1760,7 @@ class ChatController(args: Bundle) :
} }
override fun onNext(genericOverall: GenericOverall) { override fun onNext(genericOverall: GenericOverall) {
Log.d(TAG, "leaveRoom - leaveRoom - got response")
checkingLobbyStatus = false checkingLobbyStatus = false
if (lobbyTimerHandler != null) { if (lobbyTimerHandler != null) {
@ -1767,6 +1777,7 @@ class ChatController(args: Bundle) :
} }
if (!isDestroyed && !isBeingDestroyed && !wasDetached) { if (!isDestroyed && !isBeingDestroyed && !wasDetached) {
Log.d(TAG, "leaveRoom - leaveRoom - popCurrentController")
router.popCurrentController() router.popCurrentController()
} }
} }
@ -1938,6 +1949,7 @@ class ChatController(args: Bundle) :
if (lookIntoFuture > 0) { if (lookIntoFuture > 0) {
val finalTimeout = timeout val finalTimeout = timeout
Log.d(TAG, "pullChatMessages - pullChatMessages[lookIntoFuture > 0] - calling")
ncApi?.pullChatMessages( ncApi?.pullChatMessages(
credentials, credentials,
ApiUtils.getUrlForChat(apiVersion, conversationUser?.baseUrl, roomToken), fieldMap ApiUtils.getUrlForChat(apiVersion, conversationUser?.baseUrl, roomToken), fieldMap
@ -1952,8 +1964,10 @@ class ChatController(args: Bundle) :
@Suppress("Detekt.TooGenericExceptionCaught") @Suppress("Detekt.TooGenericExceptionCaught")
override fun onNext(response: Response<*>) { override fun onNext(response: Response<*>) {
Log.d(TAG, "pullChatMessages - pullChatMessages[lookIntoFuture > 0] - got response")
try { try {
if (response.code() == 304) { if (response.code() == 304) {
Log.d(TAG, "pullChatMessages - quasi recursive call to pullChatMessages")
pullChatMessages(1, setReadMarker, xChatLastCommonRead) pullChatMessages(1, setReadMarker, xChatLastCommonRead)
} else if (response.code() == 412) { } else if (response.code() == 412) {
futurePreconditionFailed = true futurePreconditionFailed = true
@ -1976,6 +1990,7 @@ class ChatController(args: Bundle) :
} }
}) })
} else { } else {
Log.d(TAG, "pullChatMessages - pullChatMessages[lookIntoFuture <= 0] - calling")
ncApi?.pullChatMessages( ncApi?.pullChatMessages(
credentials, credentials,
ApiUtils.getUrlForChat(apiVersion, conversationUser?.baseUrl, roomToken), fieldMap ApiUtils.getUrlForChat(apiVersion, conversationUser?.baseUrl, roomToken), fieldMap
@ -1990,6 +2005,7 @@ class ChatController(args: Bundle) :
@Suppress("Detekt.TooGenericExceptionCaught") @Suppress("Detekt.TooGenericExceptionCaught")
override fun onNext(response: Response<*>) { override fun onNext(response: Response<*>) {
Log.d(TAG, "pullChatMessages - pullChatMessages[lookIntoFuture <= 0] - got response")
try { try {
if (response.code() == 412) { if (response.code() == 412) {
pastPreconditionFailed = true pastPreconditionFailed = true