mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Add ability to cancel a pending vote.
This commit is contained in:
committed by
Cody Henthorne
parent
08eca9ac27
commit
91b70038e6
@@ -11,6 +11,5 @@ data class PollOption(
|
||||
val id: Long,
|
||||
val text: String,
|
||||
val voters: List<Voter>,
|
||||
val isSelected: Boolean = false,
|
||||
val isPending: Boolean = false
|
||||
val voteState: VoteState = VoteState.NONE
|
||||
) : Parcelable
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.thoughtcrime.securesms.polls
|
||||
|
||||
/**
|
||||
* Tracks general state information when a user votes in a poll. Vote states are specific to an option in a poll
|
||||
* eg. in a poll with three options, each option can have a different states like (PENDING_ADD, ADDED, NONE)
|
||||
*/
|
||||
enum class VoteState(val value: Int) {
|
||||
|
||||
/** We have no information on the vote state */
|
||||
NONE(0),
|
||||
|
||||
/** Vote is in the process of being removed */
|
||||
PENDING_REMOVE(1),
|
||||
|
||||
/** Vote is in the process of being added */
|
||||
PENDING_ADD(2),
|
||||
|
||||
/** Vote was removed */
|
||||
REMOVED(3),
|
||||
|
||||
/** Vote was added */
|
||||
ADDED(4);
|
||||
|
||||
companion object {
|
||||
fun fromValue(value: Int) = VoteState.entries.first { it.value == value }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user