diff --git a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryEvents.kt b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryEvents.kt index edc848da41..c2f3f98d11 100644 --- a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryEvents.kt +++ b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryEvents.kt @@ -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 } diff --git a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryPresenter.kt b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryPresenter.kt index 981fe00c32..b1579d6cdb 100644 --- a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryPresenter.kt +++ b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryPresenter.kt @@ -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 } } diff --git a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryView.kt b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryView.kt index cfa88244b3..d9bb9e5e10 100644 --- a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryView.kt +++ b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/history/PollHistoryView.kt @@ -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), diff --git a/features/poll/impl/src/test/kotlin/io/element/android/features/poll/impl/history/PollHistoryPresenterTest.kt b/features/poll/impl/src/test/kotlin/io/element/android/features/poll/impl/history/PollHistoryPresenterTest.kt index 638f9e6ff0..652aafef4f 100644 --- a/features/poll/impl/src/test/kotlin/io/element/android/features/poll/impl/history/PollHistoryPresenterTest.kt +++ b/features/poll/impl/src/test/kotlin/io/element/android/features/poll/impl/history/PollHistoryPresenterTest.kt @@ -99,12 +99,12 @@ class PollHistoryPresenterTest { }.test { awaitItem().also { state -> assertThat(state.activeFilter).isEqualTo(PollHistoryFilter.ONGOING) - state.eventSink(PollHistoryEvents.OnFilterSelected(PollHistoryFilter.PAST)) + state.eventSink(PollHistoryEvents.SelectFilter(PollHistoryFilter.PAST)) } skipItems(1) awaitItem().also { state -> assertThat(state.activeFilter).isEqualTo(PollHistoryFilter.PAST) - state.eventSink(PollHistoryEvents.OnFilterSelected(PollHistoryFilter.ONGOING)) + state.eventSink(PollHistoryEvents.SelectFilter(PollHistoryFilter.ONGOING)) } awaitItem().also { state -> assertThat(state.activeFilter).isEqualTo(PollHistoryFilter.ONGOING) @@ -125,10 +125,10 @@ class PollHistoryPresenterTest { presenter.present() }.test { val state = awaitItem() - state.eventSink(PollHistoryEvents.PollEndClicked(AN_EVENT_ID)) + state.eventSink(PollHistoryEvents.EndPoll(AN_EVENT_ID)) runCurrent() endPollAction.verifyExecutionCount(1) - state.eventSink(PollHistoryEvents.PollAnswerSelected(AN_EVENT_ID, "answer")) + state.eventSink(PollHistoryEvents.SelectPollAnswer(AN_EVENT_ID, "answer")) runCurrent() sendPollResponseAction.verifyExecutionCount(1) cancelAndConsumeRemainingEvents() diff --git a/features/poll/impl/src/test/kotlin/io/element/android/features/poll/impl/history/PollHistoryViewTest.kt b/features/poll/impl/src/test/kotlin/io/element/android/features/poll/impl/history/PollHistoryViewTest.kt index 0ef2e42b7d..946796ab61 100644 --- a/features/poll/impl/src/test/kotlin/io/element/android/features/poll/impl/history/PollHistoryViewTest.kt +++ b/features/poll/impl/src/test/kotlin/io/element/android/features/poll/impl/history/PollHistoryViewTest.kt @@ -114,7 +114,7 @@ class PollHistoryViewTest { eventsRecorder.assertEmpty() rule.clickOn(CommonStrings.action_ok) eventsRecorder.assertSingle( - PollHistoryEvents.PollEndClicked(eventId) + PollHistoryEvents.EndPoll(eventId) ) } @@ -142,7 +142,7 @@ class PollHistoryViewTest { ) rule.onNodeWithText(answer.text).performClick() eventsRecorder.assertSingle( - PollHistoryEvents.PollAnswerSelected(eventId, answer.id) + PollHistoryEvents.SelectPollAnswer(eventId, answer.id) ) } @@ -156,7 +156,7 @@ class PollHistoryViewTest { ) rule.clickOn(R.string.screen_polls_history_filter_past) eventsRecorder.assertSingle( - PollHistoryEvents.OnFilterSelected(filter = PollHistoryFilter.PAST) + PollHistoryEvents.SelectFilter(filter = PollHistoryFilter.PAST) ) }