File tree 6 files changed +9
-9
lines changed
main/java/im/vector/app/features/roomprofile/polls
test/java/im/vector/app/features/roomprofile/polls
6 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,11 @@ import javax.inject.Inject
24
24
25
25
class GetPollsUseCase @Inject constructor() {
26
26
27
- fun execute (filter : RoomPollsFilter ): Flow <List <PollSummary >> {
27
+ fun execute (filter : RoomPollsFilterType ): Flow <List <PollSummary >> {
28
28
// TODO unmock and add unit tests
29
29
return when (filter) {
30
- RoomPollsFilter .ACTIVE -> getActivePolls()
31
- RoomPollsFilter .ENDED -> emptyFlow()
30
+ RoomPollsFilterType .ACTIVE -> getActivePolls()
31
+ RoomPollsFilterType .ENDED -> emptyFlow()
32
32
}.map { it.sortedByDescending { poll -> poll.creationTimestamp } }
33
33
}
34
34
Original file line number Diff line number Diff line change @@ -19,5 +19,5 @@ package im.vector.app.features.roomprofile.polls
19
19
import im.vector.app.core.platform.VectorViewModelAction
20
20
21
21
sealed interface RoomPollsAction : VectorViewModelAction {
22
- data class SetFilter (val filter : RoomPollsFilter ) : RoomPollsAction
22
+ data class SetFilter (val filter : RoomPollsFilterType ) : RoomPollsAction
23
23
}
Original file line number Diff line number Diff line change 16
16
17
17
package im.vector.app.features.roomprofile.polls
18
18
19
- enum class RoomPollsFilter {
19
+ enum class RoomPollsFilterType {
20
20
ACTIVE ,
21
21
ENDED ,
22
22
}
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ class RoomPollsViewModel @AssistedInject constructor(
54
54
super .onCleared()
55
55
}
56
56
57
- private fun handleSetFilter (filter : RoomPollsFilter ) {
57
+ private fun handleSetFilter (filter : RoomPollsFilterType ) {
58
58
pollsCollectionJob?.cancel()
59
59
pollsCollectionJob = getPollsUseCase.execute(filter)
60
60
.onEach { setState { copy(polls = it) } }
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ import im.vector.app.core.platform.VectorBaseFragment
31
31
import im.vector.app.databinding.FragmentRoomPollsListBinding
32
32
import im.vector.app.features.roomprofile.polls.PollSummary
33
33
import im.vector.app.features.roomprofile.polls.RoomPollsAction
34
- import im.vector.app.features.roomprofile.polls.RoomPollsFilter
34
+ import im.vector.app.features.roomprofile.polls.RoomPollsFilterType
35
35
import im.vector.app.features.roomprofile.polls.RoomPollsViewModel
36
36
import timber.log.Timber
37
37
import javax.inject.Inject
@@ -73,7 +73,7 @@ class RoomActivePollsFragment :
73
73
74
74
override fun onResume () {
75
75
super .onResume()
76
- viewModel.handle(RoomPollsAction .SetFilter (RoomPollsFilter .ACTIVE ))
76
+ viewModel.handle(RoomPollsAction .SetFilter (RoomPollsFilterType .ACTIVE ))
77
77
}
78
78
79
79
override fun invalidate () = withState(viewModel) { viewState ->
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ class RoomPollsViewModelTest {
47
47
@Test
48
48
fun `given SetFilter action when handle then useCase is called with given filter and viewState is updated` () {
49
49
// Given
50
- val filter = RoomPollsFilter .ACTIVE
50
+ val filter = RoomPollsFilterType .ACTIVE
51
51
val action = RoomPollsAction .SetFilter (filter = filter)
52
52
val polls = listOf (givenAPollSummary())
53
53
every { fakeGetPollsUseCase.execute(any()) } returns flowOf(polls)
You can’t perform that action at this time.
0 commit comments