Refactor poll switch config and update multiple votes design and logic#6224
Refactor poll switch config and update multiple votes design and logic#6224
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThe pull request refactors the poll feature configuration system by replacing a factory-based switch list model with a declarative configuration object. It removes old PollSwitchItem infrastructure and introduces PollFeatureConfig and PollsConfig classes integrated into ChatConfig and ChatTheme. The CreatePollViewModel now manages individual toggle states instead of a mutable list, and PollSwitchList composable is converted to an internal state-driven component. Related tests and string resources are updated accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
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
🧹 Nitpick comments (3)
stream-chat-android-compose/src/main/res/values/strings.xml (1)
321-322: Avoid hardcoding the vote limits in the description.
PollSwitchListalready enforcesPollsConstants.MULTIPLE_ANSWERS_RANGE, so the"2–10"copy can drift from the actual bounds. A formatted string (%1$d–%2$d) passed from the composable keeps the text and validation in sync.♻️ Suggested shape
- <string name="stream_compose_poll_option_limit_votes_description">Choose between 2\u201310 options</string> + <string name="stream_compose_poll_option_limit_votes_description">Choose between %1$d\u2013%2$d votes</string>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-chat-android-compose/src/main/res/values/strings.xml` around lines 321 - 322, The string hardcodes "2–10" and can drift from PollsConstants.MULTIPLE_ANSWERS_RANGE; change the resource stream_compose_poll_option_limit_votes_description to a formatted string with placeholders (e.g. "%1$d–%2$d") and update the composable that renders this text (where PollSwitchList or its parent sets the description) to pass PollsConstants.MULTIPLE_ANSWERS_RANGE.first and .last (or equivalent bounds) into the formatted string so the UI text stays in sync with the validation constants.stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtilsTest.kt (2)
57-120: Add a bounds/manual-input case formaxVotesPerUserText.The new
pollConfigFrombranch now parses, clamps, and defaults invalid manual input, but this suite only covers already-valid values. A focused case for blank/non-numeric input and an out-of-range value would pin that behavior down.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtilsTest.kt` around lines 57 - 120, Add tests for pollConfigFrom that cover manual-input edge cases for maxVotesPerUserText: one test where maxVotesPerUserText is blank or non-numeric (e.g., "") and limitVotesEnabled = true to assert maxVotesAllowed becomes null or the default behavior, and one test where maxVotesPerUserText is out-of-range (e.g., "999" or "-1") to assert the value is clamped to the allowed bounds; construct CreatePollViewState with multipleVotesEnabled and limitVotesEnabled true, call pollConfigFrom(question, options, state) and assert the resulting PollConfig.maxVotesAllowed matches the expected clamped/default values while other fields (name, options, votingVisibility, enforceUniqueVote, allowUserSuggestedOptions, allowAnswers) remain as in existing tests.
27-28: Use backtick test names for these Kotlin tests.These new methods fall back to
test...naming, which is inconsistent with the test style used elsewhere in this module.As per coding guidelines,
**/src/test/**/*.kt: Use backtick test names (for example:funmessage list filters muted channels()) for readability.Also applies to: 57-57, 87-87
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtilsTest.kt` around lines 27 - 28, The test functions in AttachmentsPickerPollUtilsTest (notably testPollConfigWithAllDisabled and the two other test methods in this file) use Java-style names; rename them to Kotlin backtick-style descriptive names (e.g., replace testPollConfigWithAllDisabled with a backtick name like `poll config with all options disabled`) to match the project's test naming convention; update the function declarations and any references/imports accordingly so the tests still run under the same class (ensure the method signatures remain parameterless and annotated with `@Test`).
🤖 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/api/stream-chat-android-compose.api`:
- Around line 3520-3538: PollsConfig currently exposes PollFeatureConfig for
multipleVotes, anonymousPoll, allowComments, and suggestAnOption but does not
expose the new “limitVotes” child toggle, while CreatePollViewModel still keeps
limitVotes state outside the config; update the public PollsConfig API to
include a PollFeatureConfig field for limitVotes (add property, getter
getLimitVotes(), update constructors, componentN, copy and copy$default,
equals/hashCode/toString as needed) so consumers can configure limitVotes
alongside multipleVotes and the other child toggles and then use that field in
CreatePollViewModel instead of keeping limitVotes as an internal-only state.
- Around line 3084-3085: Add a CHANGELOG.md entry under
stream-chat-android-compose in the ⚠️ Changed or ❌ Removed section explaining
that the public PollSwitchItemFactory and any related factory types were removed
and replaced by the new ChatConfig.polls parameter backed by PollFeatureConfig
and PollsConfig; include a short migration snippet showing the old usage with
PollSwitchItemFactory and how to replace it with constructing/setting
ChatConfig.polls = PollsConfig(...) (mention PollFeatureConfig where applicable)
so Java/Kotlin integrators can map the factory pattern to the new config object
approach.
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModel.kt`:
- Around line 217-219: The current hasChanges(CreatePollViewState) only checks
question and option titles, so toggling switches or editing maxVotesPerUserText
doesn't register as changes; update hasChanges to also consider the boolean
switch fields (e.g., allowMultipleVotes / isAnonymous / allowComments — use the
actual property names on CreatePollViewState) and the maxVotesPerUserText
string, comparing each to the original/initial CreatePollViewState values (the
stored initial state field in the ViewModel, e.g., initialState or similar) so
any change to those switches or the maxVotesPerUserText returns true.
- Around line 118-121: The seed for switchItems must be the transformed current
state instead of emptyList(): when creating switchItems via .stateIn(scope =
viewModelScope, ...), set initialValue to the result of mapping _state.value
into the same switch-item list (or compute it upfront) so the first collector
sees the real switches; locate the switchItems/stateIn call and replace
initialValue = emptyList() with _state.value.let { /* build same switches from
it */ }. Also update hasChanges (and any helpers using initialState()) to
compare all toggle fields (multipleVotesEnabled, limitVotesEnabled,
maxVotesPerUserText, anonymousPollEnabled, suggestAnOptionEnabled,
allowCommentsEnabled) against their values in initialState() in addition to
question and optionItemList so toggling any of those marks the form as changed.
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchList.kt`:
- Around line 285-307: The stepper controls and numeric field lack accessibility
labels; update the StepperButton instances (the decrement and increment buttons)
to provide meaningful contentDescription/semantic labels (e.g., "Decrease votes
per person" and "Increase votes per person") and add a semantic
contentDescription or label for the BasicTextField (e.g., "Votes per person")
via its Modifier.semantics/clearAndSetSemantics so TalkBack can announce the
control and its purpose; ensure you use localized string resources and apply the
same changes to the other occurrence around the Block that uses
StepperButton/BasicTextField (the second instance noted).
---
Nitpick comments:
In `@stream-chat-android-compose/src/main/res/values/strings.xml`:
- Around line 321-322: The string hardcodes "2–10" and can drift from
PollsConstants.MULTIPLE_ANSWERS_RANGE; change the resource
stream_compose_poll_option_limit_votes_description to a formatted string with
placeholders (e.g. "%1$d–%2$d") and update the composable that renders this text
(where PollSwitchList or its parent sets the description) to pass
PollsConstants.MULTIPLE_ANSWERS_RANGE.first and .last (or equivalent bounds)
into the formatted string so the UI text stays in sync with the validation
constants.
In
`@stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtilsTest.kt`:
- Around line 57-120: Add tests for pollConfigFrom that cover manual-input edge
cases for maxVotesPerUserText: one test where maxVotesPerUserText is blank or
non-numeric (e.g., "") and limitVotesEnabled = true to assert maxVotesAllowed
becomes null or the default behavior, and one test where maxVotesPerUserText is
out-of-range (e.g., "999" or "-1") to assert the value is clamped to the allowed
bounds; construct CreatePollViewState with multipleVotesEnabled and
limitVotesEnabled true, call pollConfigFrom(question, options, state) and assert
the resulting PollConfig.maxVotesAllowed matches the expected clamped/default
values while other fields (name, options, votingVisibility, enforceUniqueVote,
allowUserSuggestedOptions, allowAnswers) remain as in existing tests.
- Around line 27-28: The test functions in AttachmentsPickerPollUtilsTest
(notably testPollConfigWithAllDisabled and the two other test methods in this
file) use Java-style names; rename them to Kotlin backtick-style descriptive
names (e.g., replace testPollConfigWithAllDisabled with a backtick name like
`poll config with all options disabled`) to match the project's test naming
convention; update the function declarations and any references/imports
accordingly so the tests still run under the same class (ensure the method
signatures remain parameterless and annotated with `@Test`).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6e089806-d152-484a-9853-3b8aebcddde4
⛔ Files ignored due to path filters (3)
stream-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_PollSwitchListTest_list_items.pngis excluded by!**/*.png
📒 Files selected for processing (21)
stream-chat-android-compose/api/stream-chat-android-compose.apistream-chat-android-compose/detekt-baseline.xmlstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtils.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/CreatePollViewModel.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModelFactory.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollOptionError.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/messages/attachments/poll/PollSwitchState.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatConfig.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatTheme.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_minus.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/messages/attachments/poll/PollSwitchInputErrorTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/util/DefaultPollSwitchItemFactoryTest.ktstream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/utils/PollsConstants.ktstream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/attachment/picker/poll/CreatePollViewModel.kt
💤 Files with no reviewable changes (7)
- stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchItem.kt
- stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/util/DefaultPollSwitchItemFactoryTest.kt
- stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchInputErrorTest.kt
- stream-chat-android-compose/detekt-baseline.xml
- stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatTheme.kt
- stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollOptionError.kt
- stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/PollSwitchItemFactory.kt
...n/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModel.kt
Outdated
Show resolved
Hide resolved
...n/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModel.kt
Show resolved
Hide resolved
...c/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchList.kt
Show resolved
Hide resolved
82834d9 to
890ff9f
Compare
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModel.kt (1)
205-206:⚠️ Potential issue | 🟠 MajorTrack toggle-only edits in
hasChanges.Line 205 still ignores the new toggle fields and
maxVotesPerPersonText. A user can change only these controls, close the screen, and lose the changes because the form still looks clean.💡 Suggested fix
private fun hasChanges(state: CreatePollViewState): Boolean { - return state.question.isNotBlank() || state.optionItemList.any { it.title.isNotBlank() } + val initial = initialState() + return state.question.isNotBlank() || + state.optionItemList.any { it.title.isNotBlank() } || + state.multipleVotes.enabled != initial.multipleVotes.enabled || + state.limitVotesPerPerson.enabled != initial.limitVotesPerPerson.enabled || + state.maxVotesPerPersonText != initial.maxVotesPerPersonText || + state.anonymousPoll.enabled != initial.anonymousPoll.enabled || + state.suggestAnOption.enabled != initial.suggestAnOption.enabled || + state.allowComments.enabled != initial.allowComments.enabled }🤖 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/CreatePollViewModel.kt` around lines 205 - 206, Update hasChanges to also consider the poll toggles and the maxVotesPerPersonText so toggle-only edits are detected: add checks for state.maxVotesPerPersonText.isNotBlank() and for each boolean toggle property on CreatePollViewState (the newly added toggle fields) in the return expression of hasChanges along with the existing question and option title checks; ensure the method inspects any per-option toggle flags if present on optionItemList as well so changing only toggle switches registers as a change.
🧹 Nitpick comments (4)
stream-chat-android-compose/api/stream-chat-android-compose.api (1)
3520-3537: RenamemaxVotesPerPersonto match the boolean toggle it actually configures.This property is a
PollFeatureConfig, so it controls the child switch state, not the numeric vote cap itself. As a public API name,maxVotesPerPersonreads like the actual integer limit and is easy to misuse from Java/Kotlin. Something likelimitVotes/limitVotesPerPersonwould better match the redesigned flow; otherwise consider exposing the numeric default separately.🤖 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` around lines 3520 - 3537, The PollsConfig public API exposes a misleading property named maxVotesPerPerson (a PollFeatureConfig) — rename it to limitVotesPerPerson (or limitVotesPerPerson) throughout the class (constructor parameters, property name, component3, copy/copy$default signatures, getMaxVotesPerPerson -> getLimitVotesPerPerson, and any synthetic constructors) so the name reflects it controls the child toggle rather than an integer; to preserve callers, add a deprecated getMaxVotesPerPerson() that delegates to the new getLimitVotesPerPerson() (and similarly preserve old copy/constructor overloads by forwarding to the renamed members) and update all internal usages to the new identifier.stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchList.kt (2)
75-86: Consider grouping parameters if this grows further.SonarCloud flags 8 parameters. The current design aligns directly with
CreatePollViewStatefields, which simplifies the call site inCreatePollScreen. If more toggles are added, consider introducing a dedicated state holder or passing the entireCreatePollViewState. For now, the trade-off is acceptable.🤖 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/PollSwitchList.kt` around lines 75 - 86, PollSwitchList currently accepts eight separate parameters which triggers SonarCloud's long-parameter-list flag; to address this, introduce a small value holder (e.g., PollSwitchState or reuse CreatePollViewState) that groups the toggle items and related callbacks (such as onMaxVotesChanged/onMaxVotesFocusLost and maxVotesPerPersonText) and update the PollSwitchList signature to take that single state object (or the existing CreatePollViewState) so callers (e.g., CreatePollScreen) pass one aggregated argument instead of many individual parameters.
151-158: Minor: Redundant border when background has same color.The border color
backgroundCoreSurfacematches the background, making the border effectively invisible. If this is intentional (for consistent spacing/structure), consider documenting it. Otherwise, the border can be removed.🤖 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/PollSwitchList.kt` around lines 151 - 158, The border in the Modifier chain inside PollSwitchList (the .border(width = 1.dp, color = ChatTheme.colors.backgroundCoreSurface, shape = RoundedCornerShape(StreamTokens.radiusXl)) call) is redundant because its color equals the background; remove that .border(...) call from the Modifier chain in PollSwitchList.kt to avoid a no-op border, or if the border is intentionally used for layout, replace the color with a visible token (e.g., ChatTheme.colors.border) or add a brief inline comment above the Modifier explaining the intentional use for spacing/structure.stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtilsTest.kt (1)
27-120: Optional: Consider backtick test names for readability.Per coding guidelines, test functions should use backtick names (e.g.,
fun `poll config with all disabled should produce expected defaults`()). However, if the existing codebase consistently uses camelCase, maintaining consistency may be preferable.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtilsTest.kt` around lines 27 - 120, The test names (testPollConfigWithAllDisabled, testPollConfigWithMultipleVotesNoLimit, testPollConfigWithAllEnabled) should use descriptive backtick method names for readability; rename each function to a backtick-style name (for example `poll config with all disabled should produce expected defaults`, `poll config with multiple votes no limit should produce expected config`, `poll config with all enabled should produce expected config`) while keeping the existing test bodies and assertions unchanged, or if the project prefers camelCase, leave the names as-is to preserve consistency.
🤖 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/CreatePollViewModel.kt`:
- Around line 209-210: The current hasError(CreatePollViewState) only checks
optionItemList.pollOptionError and misses validating max-votes input; update
hasError to also treat invalid max-votes as an error by returning true when
state.limitVotesPerPerson is true and the max-votes input is blank/out-of-range
or when a parsed/validated field (e.g., state.maxVotesPerPersonError or the
validation logic used by AttachmentsPickerPollUtils.pollConfigFrom) indicates
invalid input; locate hasError and incorporate the additional check so creation
is blocked when limitVotesPerPerson is enabled and max votes are invalid.
---
Duplicate comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModel.kt`:
- Around line 205-206: Update hasChanges to also consider the poll toggles and
the maxVotesPerPersonText so toggle-only edits are detected: add checks for
state.maxVotesPerPersonText.isNotBlank() and for each boolean toggle property on
CreatePollViewState (the newly added toggle fields) in the return expression of
hasChanges along with the existing question and option title checks; ensure the
method inspects any per-option toggle flags if present on optionItemList as well
so changing only toggle switches registers as a change.
---
Nitpick comments:
In `@stream-chat-android-compose/api/stream-chat-android-compose.api`:
- Around line 3520-3537: The PollsConfig public API exposes a misleading
property named maxVotesPerPerson (a PollFeatureConfig) — rename it to
limitVotesPerPerson (or limitVotesPerPerson) throughout the class (constructor
parameters, property name, component3, copy/copy$default signatures,
getMaxVotesPerPerson -> getLimitVotesPerPerson, and any synthetic constructors)
so the name reflects it controls the child toggle rather than an integer; to
preserve callers, add a deprecated getMaxVotesPerPerson() that delegates to the
new getLimitVotesPerPerson() (and similarly preserve old copy/constructor
overloads by forwarding to the renamed members) and update all internal usages
to the new identifier.
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchList.kt`:
- Around line 75-86: PollSwitchList currently accepts eight separate parameters
which triggers SonarCloud's long-parameter-list flag; to address this, introduce
a small value holder (e.g., PollSwitchState or reuse CreatePollViewState) that
groups the toggle items and related callbacks (such as
onMaxVotesChanged/onMaxVotesFocusLost and maxVotesPerPersonText) and update the
PollSwitchList signature to take that single state object (or the existing
CreatePollViewState) so callers (e.g., CreatePollScreen) pass one aggregated
argument instead of many individual parameters.
- Around line 151-158: The border in the Modifier chain inside PollSwitchList
(the .border(width = 1.dp, color = ChatTheme.colors.backgroundCoreSurface, shape
= RoundedCornerShape(StreamTokens.radiusXl)) call) is redundant because its
color equals the background; remove that .border(...) call from the Modifier
chain in PollSwitchList.kt to avoid a no-op border, or if the border is
intentionally used for layout, replace the color with a visible token (e.g.,
ChatTheme.colors.border) or add a brief inline comment above the Modifier
explaining the intentional use for spacing/structure.
In
`@stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtilsTest.kt`:
- Around line 27-120: The test names (testPollConfigWithAllDisabled,
testPollConfigWithMultipleVotesNoLimit, testPollConfigWithAllEnabled) should use
descriptive backtick method names for readability; rename each function to a
backtick-style name (for example `poll config with all disabled should produce
expected defaults`, `poll config with multiple votes no limit should produce
expected config`, `poll config with all enabled should produce expected config`)
while keeping the existing test bodies and assertions unchanged, or if the
project prefers camelCase, leave the names as-is to preserve consistency.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7315c480-ae0f-4220-a632-eb97f4b0b093
⛔ Files ignored due to path filters (5)
stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.channel.info_DirectChannelInfoContentTest_content.pngis excluded by!**/*.pngstream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.channel.info_DirectChannelInfoContentTest_content_in_dark_mode.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_PollSwitchListTest_list_items.pngis excluded by!**/*.png
📒 Files selected for processing (21)
stream-chat-android-compose/api/stream-chat-android-compose.apistream-chat-android-compose/detekt-baseline.xmlstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/AttachmentsPickerPollUtils.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/CreatePollViewModel.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModelFactory.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollOptionError.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/theme/ChatConfig.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatTheme.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_minus.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/messages/attachments/poll/PollSwitchInputErrorTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchListTest.ktstream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/util/DefaultPollSwitchItemFactoryTest.ktstream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/utils/PollsConstants.ktstream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/attachment/picker/poll/CreatePollViewModel.kt
💤 Files with no reviewable changes (7)
- stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatTheme.kt
- stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchInputErrorTest.kt
- stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/PollSwitchItemFactory.kt
- stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollOptionError.kt
- stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/PollSwitchItem.kt
- stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/util/DefaultPollSwitchItemFactoryTest.kt
- stream-chat-android-compose/detekt-baseline.xml
🚧 Files skipped from review as they are similar to previous changes (2)
- stream-chat-android-compose/src/main/res/drawable/stream_compose_ic_minus.xml
- stream-chat-android-compose/src/main/res/values/strings.xml



Goal
Replace
PollSwitchItemFactorywith a simplerPollsConfiginChatConfigand split the "multiple votes" switch into separate toggles for enabling multiple votes and limiting votes per person.Implementation
PollSwitchItem,PollSwitchInput,PollSwitchItemFactory, andPollOptionNumberExceedPollsConfig/PollFeatureConfigtoChatConfigto control feature visibility and defaultsPollSwitchStatesealed class and individual state fields in the ViewModelStepperinput🎨 UI Changes
Testing
PollConfigSummary by CodeRabbit
Release Notes
New Features
Bug Fixes & Improvements