Fix: allow to render a TimelinePoll even if the poll is loading

This commit is contained in:
Nicolas Mauri
2023-04-25 09:48:11 +02:00
parent 257e256761
commit 5926dad024
8 changed files with 61 additions and 7 deletions
@@ -31,7 +31,7 @@ class TimelinePollViewModel: TimelinePollViewModelType, TimelinePollViewModelPro
// MARK: - Setup
init(timelinePollDetails: TimelinePollDetails) {
super.init(initialViewState: TimelinePollViewState(poll: timelinePollDetails, bindings: TimelinePollViewStateBindings()))
super.init(initialViewState: TimelinePollViewState(poll: timelinePollDetails, bindings: TimelinePollViewStateBindings(pollState: .loading)))
}
// MARK: - Public
@@ -58,6 +58,10 @@ class TimelinePollViewModel: TimelinePollViewModelType, TimelinePollViewModelPro
state.poll = pollDetails
}
func updateWithPollState(_ pollState: TimelinePollState) {
state.bindings.pollState = pollState
}
func showAnsweringFailure() {
state.bindings.alertInfo = AlertInfo(id: .failedSubmittingAnswer,
title: VectorL10n.pollTimelineVoteNotRegisteredTitle,