diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt index 120e80a1b6..81968ab13a 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt @@ -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) { + } } } diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt index c4d7376c55..9dd41e4cea 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt @@ -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) { + } } } }