Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AND-65] Fix crash and improve error handling in poll creation. #5630

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

VelikovPetar
Copy link
Contributor

🎯 Goal

  • Fixes the crash happening when the user tries to create a poll with an empty value entered for "Multiple answers". We now disable the "Create" button, if the "Multiple answers" is checked, but the entered value is empty
  • Add a "min" value of 1 for the "Multiple answers" field, because the createPoll operation will fail if the submitted value is 0.

🛠 Implementation details

  • Add checks for empty switch fields when checking if the "Create poll" button is enabled
  • Add minValue in the PollSwitchInput to include lower bounds validation

🎨 UI Changes

Before After
crash.mp4
crash-fixed.mp4

🧪 Testing

  1. Open compose sample
  2. Open channel
  3. Open attachments and select poll
  4. Enter poll question, answers, and toggle "Multiple answers"
  5. Delete any input from the "Multiple answers" field
  6. The "Create" button should be disabled, therefore preventing the crash

Copy link
Contributor

github-actions bot commented Feb 12, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.17 MB 3.17 MB 0.00 MB 🟢
stream-chat-android-offline 3.38 MB 3.38 MB 0.00 MB 🟢
stream-chat-android-ui-components 7.86 MB 7.86 MB 0.00 MB 🟢
stream-chat-android-compose 8.75 MB 8.75 MB -0.00 MB 🚀

@VelikovPetar VelikovPetar marked this pull request as ready for review February 12, 2025 17:13
@VelikovPetar VelikovPetar requested a review from a team as a code owner February 12, 2025 17:13
@JcMinarro JcMinarro enabled auto-merge (squash) February 12, 2025 21:20
@JcMinarro JcMinarro force-pushed the bug/fix-crash-in-poll-creation branch from 48c79ba to 9b2efd6 Compare February 12, 2025 21:20
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
9.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@JcMinarro JcMinarro merged commit 44f8f49 into develop Feb 12, 2025
11 of 12 checks passed
@JcMinarro JcMinarro deleted the bug/fix-crash-in-poll-creation branch February 12, 2025 23:48
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.

2 participants