Rename Event of PollHistoryEvents

This commit is contained in:
Benoit Marty 2024-05-29 12:34:47 +02:00
parent ea63f2aa32
commit 7eb7e21d27
5 changed files with 16 additions and 16 deletions

View file

@ -21,7 +21,7 @@ import io.element.android.libraries.matrix.api.core.EventId
sealed interface PollHistoryEvents {
data object LoadMore : PollHistoryEvents
data class PollAnswerSelected(val pollStartId: EventId, val answerId: String) : PollHistoryEvents
data class PollEndClicked(val pollStartId: EventId) : PollHistoryEvents
data class OnFilterSelected(val filter: PollHistoryFilter) : PollHistoryEvents
data class SelectPollAnswer(val pollStartId: EventId, val answerId: String) : PollHistoryEvents
data class EndPoll(val pollStartId: EventId) : PollHistoryEvents
data class SelectFilter(val filter: PollHistoryFilter) : PollHistoryEvents
}

View file

@ -73,13 +73,13 @@ class PollHistoryPresenter @Inject constructor(
is PollHistoryEvents.LoadMore -> {
coroutineScope.loadMore(timeline)
}
is PollHistoryEvents.PollAnswerSelected -> appCoroutineScope.launch {
is PollHistoryEvents.SelectPollAnswer -> appCoroutineScope.launch {
sendPollResponseAction.execute(pollStartId = event.pollStartId, answerId = event.answerId)
}
is PollHistoryEvents.PollEndClicked -> appCoroutineScope.launch {
is PollHistoryEvents.EndPoll -> appCoroutineScope.launch {
endPollAction.execute(pollStartId = event.pollStartId)
}
is PollHistoryEvents.OnFilterSelected -> {
is PollHistoryEvents.SelectFilter -> {
activeFilter = event.filter
}
}

View file

@ -75,11 +75,11 @@ fun PollHistoryView(
}
fun onSelectAnswer(pollStartId: EventId, answerId: String) {
state.eventSink(PollHistoryEvents.PollAnswerSelected(pollStartId, answerId))
state.eventSink(PollHistoryEvents.SelectPollAnswer(pollStartId, answerId))
}
fun onEndPoll(pollStartId: EventId) {
state.eventSink(PollHistoryEvents.PollEndClicked(pollStartId))
state.eventSink(PollHistoryEvents.EndPoll(pollStartId))
}
Scaffold(
@ -111,7 +111,7 @@ fun PollHistoryView(
}
PollHistoryFilterButtons(
activeFilter = state.activeFilter,
onSelectFilter = { state.eventSink(PollHistoryEvents.OnFilterSelected(it)) },
onSelectFilter = { state.eventSink(PollHistoryEvents.SelectFilter(it)) },
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 8.dp),