From 9f12a67ca469728254c2cfe27dd735fea9a881ad Mon Sep 17 00:00:00 2001 From: kate-signal Date: Mon, 20 Oct 2025 14:27:07 -0400 Subject: [PATCH] Better UI for No Votes --- .../Polls/PollDetailsViewController.swift | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Signal/src/ViewControllers/Polls/PollDetailsViewController.swift b/Signal/src/ViewControllers/Polls/PollDetailsViewController.swift index 387bacc701..220c8a7521 100644 --- a/Signal/src/ViewControllers/Polls/PollDetailsViewController.swift +++ b/Signal/src/ViewControllers/Polls/PollDetailsViewController.swift @@ -117,6 +117,14 @@ struct PollDetailsView: View { .padding(.vertical, 1) .padding(.horizontal, 4) } + if option.acis.count == 0 { + Text(OWSLocalizedString( + "POLL_NO_VOTES", + comment: "String to display when a poll has no votes" + )) + .font(.body) + .foregroundColor(Color.Signal.secondaryLabel) + } } header: { // TODO: add star icon to winning option if poll is ended HStack { @@ -124,17 +132,19 @@ struct PollDetailsView: View { .font(.body) .fontWeight(.medium) Spacer() - Text( - String( - format: OWSLocalizedString( - "POLL_VOTE_COUNT", - tableName: "PluralAware", - comment: "Count indicating number of votes for this option. Embeds {{number of votes}}" - ), - option.acis.count + if option.acis.count > 0 { + Text( + String( + format: OWSLocalizedString( + "POLL_VOTE_COUNT", + tableName: "PluralAware", + comment: "Count indicating number of votes for this option. Embeds {{number of votes}}" + ), + option.acis.count + ) ) - ) - .font(.body) + .font(.body) + } } } }