Error handling

Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
This commit is contained in:
Dominic Fischer 2021-03-29 19:48:26 +01:00
parent f8718e397c
commit 42166c1c0f
2 changed files with 16 additions and 4 deletions

View File

@ -182,7 +182,10 @@ class RoomDetailViewModel @AssistedInject constructor(
updateShowDialerOptionState()
room.getRoomSummaryLive()
viewModelScope.launch {
room.markAsRead(ReadService.MarkAsReadParams.READ_RECEIPT)
try {
room.markAsRead(ReadService.MarkAsReadParams.READ_RECEIPT)
} catch (_: Exception) {
}
}
// Inform the SDK that the room is displayed
session.onRoomDisplayed(initialState.roomId)
@ -549,7 +552,10 @@ class RoomDetailViewModel @AssistedInject constructor(
if (trackUnreadMessages.getAndSet(false)) {
mostRecentDisplayedEvent?.root?.eventId?.also {
viewModelScope.launch {
room.setReadMarker(it)
try {
room.setReadMarker(it)
} catch (_: Exception) {
}
}
}
mostRecentDisplayedEvent = null
@ -1262,7 +1268,10 @@ class RoomDetailViewModel @AssistedInject constructor(
private fun handleMarkAllAsRead() {
viewModelScope.launch {
room.markAsRead(ReadService.MarkAsReadParams.BOTH)
try {
room.markAsRead(ReadService.MarkAsReadParams.BOTH)
} catch (_: Exception) {
}
}
}

View File

@ -93,7 +93,10 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
val room = session.getRoom(roomId)
if (room != null) {
GlobalScope.launch {
room.markAsRead(ReadService.MarkAsReadParams.READ_RECEIPT)
try {
room.markAsRead(ReadService.MarkAsReadParams.READ_RECEIPT)
} catch (_: Exception) {
}
}
}
}