Add suggestions section to InvitePeopleView

This commit is contained in:
ganfra 2026-01-19 17:35:39 +01:00
parent 1070b55bb9
commit 660265e8d8
11 changed files with 227 additions and 48 deletions

View file

@ -31,6 +31,10 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
private const val MAX_SUGGESTIONS_COUNT = 5
@AssistedInject
class DefaultUserListPresenter(
@ -53,7 +57,10 @@ class DefaultUserListPresenter(
override fun present(): UserListState {
var recentDirectRooms by remember { mutableStateOf(emptyList<RecentDirectRoom>()) }
LaunchedEffect(Unit) {
recentDirectRooms = matrixClient.getRecentDirectRooms()
recentDirectRooms = matrixClient
.getRecentDirectRooms()
.take(MAX_SUGGESTIONS_COUNT)
.toList()
}
var isSearchActive by rememberSaveable { mutableStateOf(false) }
val selectedUsers by userListDataStore.selectedUsers.collectAsState(emptyList())