Skip to content

Conversation

VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Oct 10, 2025

🎯 Goal

  • Exposes CreatePollScreen so that it can used independently from the AttachmentsPickerPollTabFactory
  • Fixes poll creation state not being restored after an orientation change

🛠 Implementation details

  • Extract CreatePollScreen as a standalone composable
  • Create an internal CreatePollViewModel and move all state management from CreatePollScreen to the ViewModel
  • AttachmentsPicker composable: Now reads the selected state from the viewModel instead of using remember
  • Small UI improvement: Highlight the selected tab icon for Poll and Location attachments

🎨 UI Changes

Before After
before.mp4
after.mp4

🧪 Testing

  1. Open compose sample app
  2. Open channel
  3. Open attachment picker
  4. Tap on Poll tab
  5. Enter some values
  6. Rotate the screen
  7. The data should be preserved (and the create poll button should create the poll)

Copy link
Contributor

github-actions bot commented Oct 10, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.22 MB 3.22 MB 0.00 MB 🟢
stream-chat-android-offline 3.45 MB 3.45 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.54 MB 10.54 MB 0.00 MB 🟢
stream-chat-android-compose 12.75 MB 12.76 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar changed the title Expose CreatePollScreen and fix state restoration. Expose CreatePollScreen and fix state restoration Oct 10, 2025
@VelikovPetar VelikovPetar requested a review from Copilot October 10, 2025 09:51
@VelikovPetar VelikovPetar marked this pull request as ready for review October 10, 2025 09:51
@VelikovPetar VelikovPetar requested a review from a team as a code owner October 10, 2025 09:51
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR exposes the CreatePollScreen composable as a standalone component and fixes state restoration issues for poll creation across orientation changes.

  • Extracts CreatePollScreen from the attachment picker factory into a standalone composable
  • Implements a CreatePollViewModel with proper state management for configuration preservation
  • Adds visual improvements by highlighting selected tab icons for Poll and Location attachments

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
CreatePollScreen.kt New standalone composable extracted from attachment picker factory
CreatePollViewModel.kt New ViewModel handling poll creation state with proper lifecycle management
CreatePollViewModelTest.kt Comprehensive test suite for the new ViewModel
CreatePollViewModelFactory.kt Factory for creating ViewModel instances with configuration switches
AttachmentsPickerPollTabFactory.kt Refactored to use the new CreatePollScreen composable
AttachmentsPicker.kt Updated to use ViewModel state instead of local remember state
LocationPickerTabFactory.kt Added highlighted icon for selected state
stream-chat-android-compose.api API surface addition for the new public CreatePollScreen function
CHANGELOG.md Documentation of the new feature and bug fix

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

…reate_poll_screen_and_fix_state_restoration' into feature/AND-831_AND_832_expose_create_poll_screen_and_fix_state_restoration
…l_screen_and_fix_state_restoration

# Conflicts:
#	CHANGELOG.md
Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

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