diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListEvents.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListEvent.kt similarity index 85% rename from features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListEvents.kt rename to features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListEvent.kt index f33bb2df00..865db3212a 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListEvents.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListEvent.kt @@ -10,7 +10,7 @@ package io.element.android.features.roomdetails.impl.members import io.element.android.libraries.matrix.api.room.RoomMember -sealed interface RoomMemberListEvents { - data class ChangeSelectedSection(val section: SelectedSection) : RoomMemberListEvents - data class RoomMemberSelected(val roomMember: RoomMember) : RoomMemberListEvents +sealed interface RoomMemberListEvent { + data class ChangeSelectedSection(val section: SelectedSection) : RoomMemberListEvent + data class RoomMemberSelected(val roomMember: RoomMember) : RoomMemberListEvent } diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenter.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenter.kt index 7ad98a373d..f47f12f446 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenter.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenter.kt @@ -125,11 +125,11 @@ class RoomMemberListPresenter( } } - fun handleEvent(event: RoomMemberListEvents) { + fun handleEvent(event: RoomMemberListEvent) { when (event) { - is RoomMemberListEvents.RoomMemberSelected -> + is RoomMemberListEvent.RoomMemberSelected -> roomModerationState.eventSink(ShowActionsForUser(event.roomMember.toMatrixUser())) - is RoomMemberListEvents.ChangeSelectedSection -> selectedSection = event.section + is RoomMemberListEvent.ChangeSelectedSection -> selectedSection = event.section } } diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListState.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListState.kt index 3cc795a8db..6d52db6c87 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListState.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListState.kt @@ -25,7 +25,7 @@ data class RoomMemberListState( val canInvite: Boolean, val selectedSection: SelectedSection, val moderationState: RoomMemberModerationState, - val eventSink: (RoomMemberListEvents) -> Unit, + val eventSink: (RoomMemberListEvent) -> Unit, ) { val showBannedSection: Boolean = moderationState.permissions.canBan && roomMembers.dataOrNull()?.banned?.isNotEmpty() == true } diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListStateProvider.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListStateProvider.kt index 63dfec56e5..bc077feb6a 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListStateProvider.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListStateProvider.kt @@ -85,7 +85,7 @@ internal fun aRoomMemberListState( selectedSection: SelectedSection = SelectedSection.MEMBERS, searchQuery: String = "", canInvite: Boolean = false, - eventSink: (RoomMemberListEvents) -> Unit = {}, + eventSink: (RoomMemberListEvent) -> Unit = {}, ) = RoomMemberListState( roomMembers = roomMembers, filteredRoomMembers = roomMembers.map { it.filter(searchQuery) }, diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListView.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListView.kt index bc37bbbe74..146d2f7952 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListView.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListView.kt @@ -25,8 +25,6 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.SingleChoiceSegmentedButtonRow import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.pluralStringResource @@ -68,7 +66,7 @@ fun RoomMemberListView( modifier: Modifier = Modifier, ) { fun onSelectUser(roomMember: RoomMember) { - state.eventSink(RoomMemberListEvents.RoomMemberSelected(roomMember)) + state.eventSink(RoomMemberListEvent.RoomMemberSelected(roomMember)) } Scaffold( @@ -100,7 +98,7 @@ fun RoomMemberListView( selectedSection = state.selectedSection, showBannedSection = state.showBannedSection, searchQuery = state.searchQuery.text.toString(), - onSelectedSectionChange = { state.eventSink(RoomMemberListEvents.ChangeSelectedSection(it)) }, + onSelectedSectionChange = { state.eventSink(RoomMemberListEvent.ChangeSelectedSection(it)) }, onSelectUser = ::onSelectUser, ) } diff --git a/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenterTest.kt b/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenterTest.kt index 028d4b2781..48f0e791a3 100644 --- a/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenterTest.kt +++ b/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenterTest.kt @@ -66,7 +66,7 @@ class RoomMemberListPresenterTest { skipItems(1) val loadedState = awaitItem() assertThat(loadedState.showBannedSection).isTrue() - loadedState.eventSink(RoomMemberListEvents.ChangeSelectedSection(SelectedSection.BANNED)) + loadedState.eventSink(RoomMemberListEvent.ChangeSelectedSection(SelectedSection.BANNED)) val bannedSectionState = awaitItem() assertThat(bannedSectionState.selectedSection).isEqualTo(SelectedSection.BANNED) // Now update the room members to have no banned users @@ -188,7 +188,7 @@ class RoomMemberListPresenterTest { ) presenter.test { skipItems(1) - awaitItem().eventSink(RoomMemberListEvents.RoomMemberSelected(anInvitedVictor())) + awaitItem().eventSink(RoomMemberListEvent.RoomMemberSelected(anInvitedVictor())) } } }