Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
WalkthroughPoll-related Jetpack Compose UI components are restructured: public APIs simplified by removing layout control parameters (lazyListState, itemHeightSize, itemInnerPadding), Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchItem.kt (1)
23-41:⚠️ Potential issue | 🟡 MinorAdd thread/state notes to this public API KDoc.
PollSwitchItem’s public contract changed (new requireddescription), but the KDoc still omits thread expectations and state behavior notes required for public APIs.As per coding guidelines,
**/*.kt: "Document public APIs with KDoc, including thread expectations and state notes".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchItem.kt` around lines 23 - 41, Update the KDoc for the public data class PollSwitchItem to include thread and state notes: document that PollSwitchItem is immutable and safe to read from any thread but must be created/updated from the UI/main thread when used in Compose state, explain how its properties (title, description, enabled, key, pollSwitchInput, pollOptionError) affect composition/recomposition and that consumers should treat pollSwitchInput as optional UI-only state, and note any lifecycle/ownership expectations (e.g., keys should be stable across recompositions). Reference PollSwitchItem, its properties, and the immutability contract in the KDoc so callers know thread-safety and state update rules.
🧹 Nitpick comments (1)
stream-chat-android-compose/api/stream-chat-android-compose.api (1)
1922-1922: Consider temporary compatibility overloads (or explicit migration notes) for these public API breaks.Line 1922, Line 2378, Line 2421 through Line 2432, and Line 2443 change public signatures/constructor shape and will break existing SDK consumers (including destructuring of
PollSwitchItem).
If v7 is intentionally breaking, please ensure migration guidance is shipped alongside; otherwise, a short deprecation window with bridging overloads would reduce upgrade friction.Also applies to: 2378-2378, 2421-2432, 2443-2443
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-chat-android-compose/api/stream-chat-android-compose.api` at line 1922, Public API signatures were changed for PollOptionInput and the PollSwitchItem destructuring/constructors, breaking binary/source compatibility for SDK consumers; restore temporary compatibility by adding overloads with the previous parameter shapes (or companion factory functions) that forward to the new implementations, and add explicit `@Deprecated` migration shims with clear deprecation messages pointing to the new parameter order/types so consumers get a compile-time hint; reference the public symbols PollOptionInput and PollSwitchItem (and any constructors/factory methods) when adding these bridging overloads or deprecation wrappers, and include a short migration note in the library changelog/release notes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollScreen.kt`:
- Around line 75-137: Add a Paparazzi snapshot test that covers the redesigned
CreatePollScreen Scaffold layout to prevent visual regressions: create a Compose
UI test (matching **/stream-chat-android-compose/**/*Test.kt) that composes
CreatePollScreen (or directly composes the Scaffold with PollCreationHeader,
PollQuestionInput, PollOptionList, PollSwitchList and the discard dialog state)
using Paparazzi, capture snapshots for default and scroll states, and include
assertions or snapshot dumps to verify header/content spacing and scroll
composition; run and include results of verifyPaparazziDebug in CI. Ensure the
test toggles isShowingDiscardDialog to cover PollCreationDiscardDialog and
exercises enabled/disabled states of PollCreationHeader (enabledCreation) to
cover variations.
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollOptionList.kt`:
- Around line 159-175: The decorationBox lambda in PollOptionList.kt fails to
call innerTextField() when item.pollOptionError != null and
item.title.isBlank(), causing the text field to not render; update the
decorationBox logic (the lambda that references item.pollOptionError, item.title
and innerTextField) so every conditional path calls innerTextField() — keep the
branch that shows the error message (Text with item.pollOptionError.message) for
non-blank titles, and for the case where pollOptionError exists but title is
blank, ensure innerTextField() is still invoked (e.g., show only
innerTextField() or show the error then innerTextField()) so the field always
renders.
- Around line 76-125: The AddPollOptionButton is currently placed after the
Column's closing brace, making it a sibling instead of a child; move the
AddPollOptionButton call inside the Column (e.g., just before the Column's
closing brace) so it becomes a child of the Column used in PollOptionList,
preserve its onClick logic that updates optionItemList and calls
onQuestionsChanged, and keep any Modifier/padding/spacing consistent with the
Column's layout (maintain or adjust Modifier and Arrangement to match
surrounding elements).
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchList.kt`:
- Around line 74-80: The composable currently passes the mutable
SnapshotStateList (switchItemList) into the ViewModel via onSwitchesChanged
which causes state aliasing; change the call site in
PollSwitchList/PollSwitchListItem so you pass an immutable copy (e.g.,
switchItemList.toList()) instead of the raw switchItemList whenever calling
onSwitchesChanged, and ensure the CreatePollViewModel.updateSwitches continues
to accept an immutable List so it stores a copy rather than a mutable reference.
In `@stream-chat-android-compose/src/main/res/values/strings.xml`:
- Line 299: Fix the grammar in the user-facing string resource
stream_compose_poll_option_discard_dialog_description by replacing "Are you sure
want to discard your poll?" with the correct phrasing "Are you sure you want to
discard your poll?"; update this value in strings.xml (and any localized copies)
so the dialog reads correctly.
---
Outside diff comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchItem.kt`:
- Around line 23-41: Update the KDoc for the public data class PollSwitchItem to
include thread and state notes: document that PollSwitchItem is immutable and
safe to read from any thread but must be created/updated from the UI/main thread
when used in Compose state, explain how its properties (title, description,
enabled, key, pollSwitchInput, pollOptionError) affect composition/recomposition
and that consumers should treat pollSwitchInput as optional UI-only state, and
note any lifecycle/ownership expectations (e.g., keys should be stable across
recompositions). Reference PollSwitchItem, its properties, and the immutability
contract in the KDoc so callers know thread-safety and state update rules.
---
Nitpick comments:
In `@stream-chat-android-compose/api/stream-chat-android-compose.api`:
- Line 1922: Public API signatures were changed for PollOptionInput and the
PollSwitchItem destructuring/constructors, breaking binary/source compatibility
for SDK consumers; restore temporary compatibility by adding overloads with the
previous parameter shapes (or companion factory functions) that forward to the
new implementations, and add explicit `@Deprecated` migration shims with clear
deprecation messages pointing to the new parameter order/types so consumers get
a compile-time hint; reference the public symbols PollOptionInput and
PollSwitchItem (and any constructors/factory methods) when adding these bridging
overloads or deprecation wrappers, and include a short migration note in the
library changelog/release notes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: dcd65a08-974e-44dc-a44e-4796befce340
⛔ Files ignored due to path filters (10)
stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.poll_PollOptionInputTest_empty_input.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.poll_PollOptionInputTest_with_input.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages.attachments.poll_CreatePollScreenTest_dark_mode.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages.attachments.poll_CreatePollScreenTest_light_mode.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages.attachments.poll_PollCreationHeaderTest_disabled.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages.attachments.poll_PollCreationHeaderTest_enabled.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages.attachments.poll_PollOptionListTest_blank_items.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages.attachments.poll_PollOptionListTest_duplicated_error.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages.attachments.poll_PollOptionListTest_empty_list.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages.attachments.poll_PollSwitchListTest_list_items.pngis excluded by!**/*.png
📒 Files selected for processing (15)
stream-chat-android-compose/api/stream-chat-android-compose.apistream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollOptionInput.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollScreen.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollCreationHeader.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollOptionList.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollQuestionInput.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchItem.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchList.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/PollSwitchItemFactory.ktstream-chat-android-compose/src/main/res/drawable/stream_compose_ic_circle_minus.xmlstream-chat-android-compose/src/main/res/drawable/stream_compose_ic_drag_handle.xmlstream-chat-android-compose/src/main/res/values/strings.xmlstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtilsTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModelTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/util/DefaultPollSwitchItemFactoryTest.kt
💤 Files with no reviewable changes (1)
- stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollCreationHeader.kt
...main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollScreen.kt
Show resolved
Hide resolved
...c/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollOptionList.kt
Show resolved
Hide resolved
...c/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollOptionList.kt
Show resolved
Hide resolved
...c/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchList.kt
Show resolved
Hide resolved
b47e335 to
5122dd7
Compare
VelikovPetar
left a comment
There was a problem hiding this comment.
One small comment about a snapshot test, otherwise looks pretty good!
...ges/io.getstream.chat.android.compose.ui.components.poll_PollOptionInputTest_empty_input.png
Outdated
Show resolved
Hide resolved
5122dd7 to
7adaa8e
Compare
|


Goal
Update the poll creation screen to match the new Figma designs.
Note: the "Multiple votes" parent-child toggle (with stepper) is intentionally not included here. The current
PollSwitchItem/PollSwitchItemFactoryabstraction needs to be restructured first to remove unnecessary customization overhead (aligning with how the iOS SDKs handle this). That refactor will come in a follow-up PR.Implementation
LazyColumnwithReorderableColumnfor options, to simplify the logicdescriptionfield toPollSwitchItem, shown below each switch titlePollOptionInputAPI: removeshape/innerPaddingparams, makedescriptionrequiredtranslatable="false"from stringsUI Changes
Testing
Check the poll creation flow in the sample app.
Summary by CodeRabbit
New Features
Improvements