pollUpdated

suspend fun pollUpdated(options: PollUpdatedOptions)

Updates the poll state based on the provided options.

This function checks the poll's status and updates the state accordingly. If a new poll starts, it displays an alert and opens the poll modal for eligible members.

Parameters:

  • options: The PollUpdatedOptions containing details such as the poll data, member level, and update functions for the poll state.

Example:

val options = PollUpdatedOptions(
data = PollUpdatedData(poll = updatedPoll, status = "started"),
polls = currentPolls,
poll = currentPoll,
member = "user123",
islevel = "1",
showAlert = { alert -> Logger.d("PollUpdated", alert.message) },
updatePolls = { updatedPolls -> setPolls(updatedPolls) },
updatePoll = { updatedPoll -> setCurrentPoll(updatedPoll) },
updateIsPollModalVisible = { visible -> setIsPollModalVisible(visible) }
)

pollUpdated(options)