favorite : apply pr review remarks
This commit is contained in:
parent
fc706bb9d6
commit
6ef50081bd
6 changed files with 23 additions and 44 deletions
|
|
@ -20,5 +20,5 @@ sealed interface RoomDetailsEvent {
|
|||
data object LeaveRoom : RoomDetailsEvent
|
||||
data object MuteNotification : RoomDetailsEvent
|
||||
data object UnmuteNotification : RoomDetailsEvent
|
||||
data class SetIsFavorite(val isFavorite: Boolean) : RoomDetailsEvent
|
||||
data class SetFavorite(val isFavorite: Boolean) : RoomDetailsEvent
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class RoomDetailsPresenter @Inject constructor(
|
|||
client.notificationSettingsService().unmuteRoom(room.roomId, room.isEncrypted, room.isOneToOne)
|
||||
}
|
||||
}
|
||||
is RoomDetailsEvent.SetIsFavorite -> {
|
||||
is RoomDetailsEvent.SetFavorite -> {
|
||||
scope.launch {
|
||||
room.setIsFavorite(event.isFavorite)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ fun RoomDetailsView(
|
|||
FavoriteSection(
|
||||
isFavorite = state.isFavorite,
|
||||
onFavoriteChanges = {
|
||||
state.eventSink(RoomDetailsEvent.SetIsFavorite(it))
|
||||
state.eventSink(RoomDetailsEvent.SetFavorite(it))
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -438,9 +438,9 @@ class RoomDetailsPresenterTests {
|
|||
val presenter = createRoomDetailsPresenter(room = room)
|
||||
presenter.test {
|
||||
val initialState = awaitItem()
|
||||
initialState.eventSink(RoomDetailsEvent.SetIsFavorite(true))
|
||||
initialState.eventSink(RoomDetailsEvent.SetFavorite(true))
|
||||
assertThat(room.setIsFavoriteCalls).isEqualTo(listOf(true))
|
||||
initialState.eventSink(RoomDetailsEvent.SetIsFavorite(false))
|
||||
initialState.eventSink(RoomDetailsEvent.SetFavorite(false))
|
||||
assertThat(room.setIsFavoriteCalls).isEqualTo(listOf(true, false))
|
||||
cancelAndIgnoreRemainingEvents()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue