Show decryption error on TimelinePollView

This commit is contained in:
Alfonso Grillo
2022-12-23 12:08:25 +01:00
parent c946009c24
commit 359f44cb30
6 changed files with 19 additions and 3 deletions
@@ -152,7 +152,8 @@ struct TimelinePollAnswerOptionButton_Previews: PreviewProvider {
totalAnswerCount: 100,
type: type,
maxAllowedSelections: 1,
hasBeenEdited: false)
hasBeenEdited: false,
hasDecryptionError: false)
}
static func buildAnswerOption(text: String = "Test", selected: Bool, winner: Bool = false) -> TimelinePollAnswerOption {
@@ -49,6 +49,7 @@ struct TimelinePollView: View {
.fixedSize(horizontal: false, vertical: true)
Text(totalVotesString)
.lineLimit(2)
.font(theme.fonts.footnote)
.foregroundColor(theme.colors.tertiaryContent)
}
@@ -62,6 +63,10 @@ struct TimelinePollView: View {
private var totalVotesString: String {
let poll = viewModel.viewState.poll
if poll.hasDecryptionError, poll.totalAnswerCount > 0 {
return VectorL10n.pollTimelineDecryptionError
}
if poll.closed {
if poll.totalAnswerCount == 1 {
return VectorL10n.pollTimelineTotalFinalResultsOneVote