mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 18:05:36 +03:00
Protect call to suspend fun
This commit is contained in:
parent
18cef243a1
commit
c08868bc3c
3 changed files with 15 additions and 20 deletions
|
@ -1,4 +1,10 @@
|
||||||
Changes in Element 1.1.5 (2021-XX-XX)
|
Changes in Element 1.1.6 (2021-04-16)
|
||||||
|
===================================================
|
||||||
|
|
||||||
|
Bugfix 🐛:
|
||||||
|
- Fix crash on the timeline
|
||||||
|
|
||||||
|
Changes in Element 1.1.5 (2021-04-15)
|
||||||
===================================================
|
===================================================
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
|
|
|
@ -178,10 +178,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
updateShowDialerOptionState()
|
updateShowDialerOptionState()
|
||||||
room.getRoomSummaryLive()
|
room.getRoomSummaryLive()
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
tryOrNull { room.markAsRead(ReadService.MarkAsReadParams.READ_RECEIPT) }
|
||||||
room.markAsRead(ReadService.MarkAsReadParams.READ_RECEIPT)
|
|
||||||
} catch (_: Exception) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Inform the SDK that the room is displayed
|
// Inform the SDK that the room is displayed
|
||||||
session.onRoomDisplayed(initialState.roomId)
|
session.onRoomDisplayed(initialState.roomId)
|
||||||
|
@ -546,10 +543,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
if (trackUnreadMessages.getAndSet(false)) {
|
if (trackUnreadMessages.getAndSet(false)) {
|
||||||
mostRecentDisplayedEvent?.root?.eventId?.also {
|
mostRecentDisplayedEvent?.root?.eventId?.also {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
tryOrNull { room.setReadMarker(it) }
|
||||||
room.setReadMarker(it)
|
|
||||||
} catch (_: Exception) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mostRecentDisplayedEvent = null
|
mostRecentDisplayedEvent = null
|
||||||
|
@ -1254,7 +1248,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
bufferedMostRecentDisplayedEvent.root.eventId?.let { eventId ->
|
bufferedMostRecentDisplayedEvent.root.eventId?.let { eventId ->
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
room.setReadReceipt(eventId)
|
tryOrNull { room.setReadReceipt(eventId) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1263,10 +1257,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
private fun handleMarkAllAsRead() {
|
private fun handleMarkAllAsRead() {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
tryOrNull { room.markAsRead(ReadService.MarkAsReadParams.BOTH) }
|
||||||
room.markAsRead(ReadService.MarkAsReadParams.BOTH)
|
|
||||||
} catch (_: Exception) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.extensions.vectorComponent
|
import im.vector.app.core.extensions.vectorComponent
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
import org.matrix.android.sdk.api.session.room.Room
|
import org.matrix.android.sdk.api.session.room.Room
|
||||||
import org.matrix.android.sdk.api.session.room.read.ReadService
|
import org.matrix.android.sdk.api.session.room.read.ReadService
|
||||||
|
@ -78,7 +79,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
val room = session.getRoom(roomId)
|
val room = session.getRoom(roomId)
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
room.join()
|
tryOrNull { room.join() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +90,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
val room = session.getRoom(roomId)
|
val room = session.getRoom(roomId)
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
room.leave()
|
tryOrNull { room.leave() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,10 +101,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
val room = session.getRoom(roomId)
|
val room = session.getRoom(roomId)
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
try {
|
tryOrNull { room.markAsRead(ReadService.MarkAsReadParams.READ_RECEIPT) }
|
||||||
room.markAsRead(ReadService.MarkAsReadParams.READ_RECEIPT)
|
|
||||||
} catch (_: Exception) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue