Merge branch 'develop' into feature/bma/scroll-to-unread-messages

This commit is contained in:
Benoit Marty
2026-07-06 13:36:28 +02:00
committed by GitHub
3 changed files with 21 additions and 2 deletions
@@ -9,8 +9,10 @@ package io.element.android.features.messages.impl.threads.list
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.produceState import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberCoroutineScope
import dev.zacsweers.metro.Inject import dev.zacsweers.metro.Inject
import io.element.android.features.messages.impl.timeline.factories.event.TimelineItemContentFactory import io.element.android.features.messages.impl.timeline.factories.event.TimelineItemContentFactory
@@ -18,9 +20,12 @@ import io.element.android.features.messages.impl.utils.messagesummary.MessageSum
import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.dateformatter.api.DateFormatter import io.element.android.libraries.dateformatter.api.DateFormatter
import io.element.android.libraries.dateformatter.api.DateFormatterMode import io.element.android.libraries.dateformatter.api.DateFormatterMode
import io.element.android.libraries.designsystem.components.avatar.AvatarData
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.room.JoinedRoom import io.element.android.libraries.matrix.api.room.JoinedRoom
import io.element.android.libraries.matrix.api.room.threads.ThreadListPaginationStatus import io.element.android.libraries.matrix.api.room.threads.ThreadListPaginationStatus
import io.element.android.libraries.matrix.ui.model.getAvatarData
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableList
@@ -95,6 +100,10 @@ class ThreadsListPresenter(
val roomInfo by room.roomInfoFlow.collectAsState() val roomInfo by room.roomInfoFlow.collectAsState()
val heroes by remember {
derivedStateOf { roomInfo.heroes.map { it.getAvatarData(AvatarSize.CurrentUserTopBar) }.toImmutableList() }
}
fun handleEvent(event: ThreadsListEvents) { fun handleEvent(event: ThreadsListEvents) {
when (event) { when (event) {
ThreadsListEvents.Paginate -> if ((paginationStatus as? ThreadListPaginationStatus.Idle)?.hasMoreToLoad == true) { ThreadsListEvents.Paginate -> if ((paginationStatus as? ThreadListPaginationStatus.Idle)?.hasMoreToLoad == true) {
@@ -115,6 +124,7 @@ class ThreadsListPresenter(
roomName = roomInfo.name ?: room.roomId.value, roomName = roomInfo.name ?: room.roomId.value,
roomAvatarUrl = roomInfo.avatarUrl, roomAvatarUrl = roomInfo.avatarUrl,
isRoomTombstoned = roomInfo.successorRoom != null, isRoomTombstoned = roomInfo.successorRoom != null,
heroes = heroes,
eventSink = ::handleEvent, eventSink = ::handleEvent,
) )
} }
@@ -125,6 +135,7 @@ data class ThreadsListState(
val roomName: String, val roomName: String,
val roomAvatarUrl: String?, val roomAvatarUrl: String?,
val isRoomTombstoned: Boolean, val isRoomTombstoned: Boolean,
val heroes: ImmutableList<AvatarData>,
val threads: ImmutableList<ThreadListRowItem>, val threads: ImmutableList<ThreadListRowItem>,
val eventSink: (ThreadsListEvents) -> Unit, val eventSink: (ThreadsListEvents) -> Unit,
) )
@@ -67,6 +67,7 @@ import io.element.android.libraries.matrix.api.timeline.item.event.TextMessageTy
import io.element.android.libraries.matrix.api.timeline.item.event.getAvatarUrl import io.element.android.libraries.matrix.api.timeline.item.event.getAvatarUrl
import io.element.android.libraries.matrix.api.timeline.item.event.getDisambiguatedDisplayName import io.element.android.libraries.matrix.api.timeline.item.event.getDisambiguatedDisplayName
import io.element.android.libraries.ui.strings.CommonStrings import io.element.android.libraries.ui.strings.CommonStrings
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
@@ -102,7 +103,10 @@ fun ThreadsListView(
url = state.roomAvatarUrl, url = state.roomAvatarUrl,
size = AvatarSize.CurrentUserTopBar, size = AvatarSize.CurrentUserTopBar,
), ),
avatarType = AvatarType.Room(isTombstoned = state.isRoomTombstoned), avatarType = AvatarType.Room(
heroes = state.heroes,
isTombstoned = state.isRoomTombstoned,
),
contentDescription = null, contentDescription = null,
) )
Column { Column {
@@ -323,6 +327,7 @@ internal fun ThreadsListViewPreview() {
roomId = RoomId("!room-id:server"), roomId = RoomId("!room-id:server"),
roomName = ROOM_NAME, roomName = ROOM_NAME,
roomAvatarUrl = null, roomAvatarUrl = null,
heroes = persistentListOf(),
threads = List(10) { aThreadListRowItem(threadId = ThreadId("\$thread-$it")) }.toImmutableList(), threads = List(10) { aThreadListRowItem(threadId = ThreadId("\$thread-$it")) }.toImmutableList(),
isRoomTombstoned = false, isRoomTombstoned = false,
eventSink = {}, eventSink = {},
+4 -1
View File
@@ -13,7 +13,10 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8 -XX:+UseG1GC # Matches the heap size CI already uses for release builds (see GRADLE_OPTS in
# .github/workflows/release.yml and nightly.yml) - a local `assembleRelease`/`bundleRelease`
# runs R8 on the full app and can run out of heap well before 4g on this codebase's size.
org.gradle.jvmargs=-Xmx8g -Dfile.encoding=UTF-8 -XX:+UseG1GC
# AndroidX package structure to make it clearer which packages are bundled with the # AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK # Android operating system, and which are packaged with your app"s APK