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