Skip to content

Release v2.1.0: live polls in comments - #45

Merged
winrid merged 4 commits into
mainfrom
comment-polls
Nov 16, 2026
Merged

winrid merged 4 commits into
mainfrom
comment-polls

Conversation

@winrid

@winrid winrid commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Brings the web widget's comment polls to the Android SDK.

What's included

  • Poll card on comments (PollCardView): option chips with result bars, percentages, a "your vote is in" pill, change vote, show/hide results, closes-at and privacy text, and a "See who voted" link. Matches the web design (comment-ui.polls.extension.ts).
  • Voting through PublicApi.votePoll, with web error mapping (poll-login-required, poll-closed, translated errors).
  • Live updates: POLL_UPDATE events patch only the counts (PollCardView.patchCounts) so bars animate in place, like web patchPollCounts. Option or close-date changes fall back to a full bind.
  • Who voted dialog (PollVotersDialog) with search and paging. Pager taps wait for the page in flight.
  • Poll builder in the composer toolbar (PollBuilderView), gated by pollCreation and site-admin status: question, 2 to 10 options, duration, require-vote-to-see-results, privacy, and web validation messages.
  • Theming: pollAccentColor plus poll color resources, documented in README.md and THEMING.md.
  • Strings for all 13 bundled locales, ported from fastcomments-localization comment-ui-polls.

Other fixes

  • CallbackWrapper parsed API errors with a plain Gson, which throws on the models' java.time fields, so every error code came back internal. It now uses the client's Gson.
  • broadcastIdsSent is now a bounded set (200 most recent) in both SDKs.
  • isSiteAdmin is now set from the load response.

Dependency

Bumps fastcomments (Java client) to 3.1.2: unknown response fields are ignored, and pubsub reconnects with backoff. Releases as v2.1.0.

Tests

  • Robolectric: PollCardViewTest, PollBuilderViewTest, PollDraftTest, PollHelperTest, PollVotersDialogTest, CallbackWrapperTest, BroadcastIdsTest
  • Integration against the real server: PollIntegrationTests (create, vote, change vote, live update across two SDKs, voters, login-required)
  • Espresso: PollUITests, 3/3 passing on Medium_Phone_API_36
  • spotlessCheck, lintDebug, :app:assembleDebug, assembleDebugAndroidTest pass

Readers vote on polls attached to comments and see results update live through poll-update events. The UI matches the web widget: option chips with result bars, a locked-results mode, a who-voted dialog, and a poll builder in the composer toolbar.

- Requires fastcomments-java 3.1.1 (votePoll, getPollVoters, typed PublicComment.poll)
- Live tally changes patch only the counts so bars animate in place
- CallbackWrapper parses API errors with the client's Gson so error codes survive
- Poll strings for all 13 bundled locales
- Robolectric, integration and Espresso tests
- Host the who-voted dialog in a DialogFragment so it survives rotation and process death on its page and search
- Save the composer's poll draft in BottomCommentInputView state; the builder's rows share ids, so it freezes its children
- Size the poll builder from the window minus system bars and keyboard on every layout
…on locked polls

- A locked poll that closes on screen offers Show results, which fetches the real counts; a failed fetch says so and can be retried, and a comment the fetch can't find says the results show on the next load.
- Callbacks that find their card recycled rebind the comment's row instead, so no card stays dimmed.
- Locked polls now receive live tallies; the card keeps them hidden until the viewer votes.
- Toolbar visibility, builder option reuse, voter dialog lifecycle and draft state survive configuration changes.
- Removed backspace-to-delete on empty options; the remove button is the only way to delete one.
- E2E helpers shared between SDK integration tests and app UI tests, which wait on SDK idling instead of sleeps.
@winrid winrid changed the title Add live polls to comments Release v2.1.0: live polls in comments Nov 16, 2026
@winrid
winrid merged commit 08cb32b into main Nov 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant