CreatePollViewModel

ViewModel class for creating a poll. It handles the creation of the poll and its configuration.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
val maxAnswerError: StateFlow<Int?>

The error message for the maximum number of answers allowed.

Link copied to clipboard
val options: StateFlow<List<PollAnswer>>

The options for the poll.

Link copied to clipboard
val pollConfig: StateFlow<PollConfig?>

The poll configuration. If the poll is not ready to be created, it will be null.

Link copied to clipboard
val pollIsReady: StateFlow<Boolean>

Indicates if the poll is ready to be created.

Functions

Link copied to clipboard

Create a new empty option for the poll.

Link copied to clipboard

Create a new poll config.

Link copied to clipboard

Update the text of the option. If the text already exists in another option, it will set the duplicate error to true.

Link copied to clipboard

Set the title of the poll.

Link copied to clipboard
fun setAllowMultipleVotes(allowMultipleVotes: Boolean)

Set if the poll allows multiple votes.

Link copied to clipboard
fun setAnnonymousPoll(annonymousPoll: Boolean)

Set if the poll is annonymous.

Link copied to clipboard
fun setMaxAnswer(maxAnswer: Int?)

Set the maximum number of answers allowed.

Link copied to clipboard
fun setSuggestAnOption(suggestAnOption: Boolean)

Set if the poll allows users to suggest new options.

Inherited functions

Link copied to clipboard
open fun addCloseable(closeable: AutoCloseable)
fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard