mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
MatrixRoom API refinement (#719)
- `syncUpdateFlow` becomes a `val` and always returns the same instance of the underlying `StateFlow` instead of different `Flow` instances to allow consumers not to remember the `Flow` and not to specify an unneeded initial value. - `timeline` becomes a `val` as it already always returns the same instance. - Amends calling code accordingly - Removes a few unneeded `val`s in `RustMatrixClient - Fixes a small bug in `MessagesPresenter` that allowed to sometime show a newly created room's name as "Empty room" (changes `LaunchedEffect(syncUpdateFlow)` to `LaunchedEffect(syncUpdateFlow.value)`)
This commit is contained in:
+2
-2
@@ -99,7 +99,7 @@ class MessagesPresenter @AssistedInject constructor(
|
||||
val customReactionState = customReactionPresenter.present()
|
||||
val retryState = retrySendMenuPresenter.present()
|
||||
|
||||
val syncUpdateFlow = room.syncUpdateFlow().collectAsState(0L)
|
||||
val syncUpdateFlow = room.syncUpdateFlow.collectAsState()
|
||||
val userHasPermissionToSendMessage by room.canSendEventAsState(type = MessageEventType.ROOM_MESSAGE, updateKey = syncUpdateFlow.value)
|
||||
val roomName: MutableState<String?> = rememberSaveable {
|
||||
mutableStateOf(null)
|
||||
@@ -112,7 +112,7 @@ class MessagesPresenter @AssistedInject constructor(
|
||||
|
||||
val snackbarMessage by snackbarDispatcher.collectSnackbarMessageAsState()
|
||||
|
||||
LaunchedEffect(syncUpdateFlow) {
|
||||
LaunchedEffect(syncUpdateFlow.value) {
|
||||
roomAvatar.value =
|
||||
AvatarData(
|
||||
id = room.roomId.value,
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ class TimelinePresenter @Inject constructor(
|
||||
room: MatrixRoom,
|
||||
) : Presenter<TimelineState> {
|
||||
|
||||
private val timeline = room.timeline()
|
||||
private val timeline = room.timeline
|
||||
|
||||
@Composable
|
||||
override fun present(): TimelineState {
|
||||
|
||||
Reference in New Issue
Block a user