PollAnswersViewController

class PollAnswersViewController(pollId: String, chatClient: ChatClient = ChatClient.instance(), scope: CoroutineScope, cachedAnswers: () -> List<Answer> = { emptyList() })

Controller for the paginated list of a poll's answers (comments), newest first.

Answers cast, edited or removed while the list is open are applied to it.

Parameters

pollId

The id of the poll whose answers are listed.

chatClient

The ChatClient used to query the answers and observe events.

scope

The CoroutineScope the controller lives in. Cancelling it stops observing events.

cachedAnswers

Provides the answers already known locally, shown if the first page fails to load.

Constructors

Link copied to clipboard
constructor(pollId: String, chatClient: ChatClient = ChatClient.instance(), scope: CoroutineScope, cachedAnswers: () -> List<Answer> = { emptyList() })

Properties

Link copied to clipboard
val events: SharedFlow<PollAnswersViewEvent>

One shot events triggered by the controller.

Link copied to clipboard
val state: StateFlow<PollAnswersViewState>

The current state of the poll answers view.

Functions

Link copied to clipboard

Handles a PollAnswersViewAction coming from the View layer.