Skip to content

Conversation

VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Oct 15, 2025

🎯 Goal

Implements poll and poll options management operations on the LLC.
Added:

  • ChatClient.getPoll(pollId: String)
  • ChatClient.partialUpdatePoll(pollId: String, set: Map<String, Any>, unset: List<String>)
  • ChatClient.createPollOption(pollId: String, option: CreatePollOptionRequest)
  • ChatClient.updatePollOption(pollId: String, option: UpdatePollOptionRequest)
  • ChatClient.deletePollOption(pollId: String, optionId: String)
  • ChatClient.queryPollVotes(pollId: String, filter: FilterObject?, limit: Int?, next: String?, sort: QuerySorter<Vote>?)
  • ChatClient.queryPolls(filter: FilterObject?, limit: Int?, next: String?, sort: QuerySorter<Poll>?)
  • PollConfig (used in ChatClient.sendPoll) constructor which accepts extra data for the poll and the poll options

Deprecated:

  • PollConfig constructor without extra data
  • ChatClient.suggestPollOption in favour of ChatClient.createPollOption

Resolves: https://linear.app/stream/issue/AND-793/align-llc-polls-api
Docs PR: https://github.com/GetStream/docs-content/pull/690

🛠 Implementation details

Implements the missing poll-related operations, alongside the Retrofit APIs, network/domain models, and offline storage updates. Replaces the usage of the deprecated methods with the new ones.

Resolves:
https://linear.app/stream/issue/AND-793/align-llc-polls-api

🎨 UI Changes

NA

🧪 Testing

Standard poll testing:

  1. Create a poll (with different options)
  2. Add / Change / Delete votes
  3. Add comment
  4. Create option
  5. Close poll
    Ensure everything works fine

For the new endpoints - they are not linked to the UI, so you need to manually call them and verify they return the expected results.

# Conflicts:
#	stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/MoshiChatApi.kt
#	stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt
#	stream-chat-android-client/src/test/java/io/getstream/chat/android/client/Mother.kt
Copy link
Contributor

DB Entities have been updated. Do we need to upgrade DB Version?
Modified Entities :

stream-chat-android-offline/src/main/java/io/getstream/chat/android/offline/repository/domain/message/internal/Poll.kt

Copy link
Contributor

github-actions bot commented Oct 15, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.22 MB 3.24 MB 0.02 MB 🟢
stream-chat-android-offline 3.45 MB 3.46 MB 0.01 MB 🟢
stream-chat-android-ui-components 10.54 MB 10.55 MB 0.01 MB 🟢
stream-chat-android-compose 12.76 MB 12.78 MB 0.02 MB 🟢

@VelikovPetar VelikovPetar requested a review from Copilot October 20, 2025 12:19
@VelikovPetar VelikovPetar marked this pull request as ready for review October 20, 2025 12:19
@VelikovPetar VelikovPetar requested a review from a team as a code owner October 20, 2025 12:19
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 implements missing polls LLC (Low Level Client) operations to provide comprehensive poll and poll option management capabilities. The PR adds several new endpoints while maintaining backward compatibility through deprecation warnings.

Key changes include:

  • Addition of poll CRUD operations including get, partial update, and query endpoints
  • Implementation of poll option lifecycle management (create, update, delete)
  • Enhanced poll creation with support for extra data on both polls and options
  • Proper offline storage updates and network/domain model extensions

Reviewed Changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
stream-chat-android-ui-components/.../CreatePollViewModel.kt Updates poll creation to use PollOption objects instead of plain strings
stream-chat-android-ui-common/.../MessageListController.kt Replaces deprecated suggestPollOption with createPollOption
stream-chat-android-previewdata/.../PreviewPollData.kt Adds missing poll properties for preview data consistency
stream-chat-android-offline/.../PollsMapperTest.kt New comprehensive test suite for poll entity mapping
stream-chat-android-offline/.../PollsMapper.kt New mapper for poll entity conversions with proper domain mapping
stream-chat-android-offline/.../Poll.kt Enhanced poll entity with additional fields for complete data storage
stream-chat-android-offline/.../MessageMapper.kt Removes duplicate poll mapping code in favor of dedicated mapper
stream-chat-android-offline/.../ChatDatabase.kt Database schema version bump to accommodate new poll fields
stream-chat-android-core/.../Mother.kt Updates test data factory to include new poll properties
stream-chat-android-core/.../Poll.kt Enhanced poll models with extra data support and comparable field providers
stream-chat-android-client/.../ChatClient.kt Adds comprehensive poll management API methods with proper deprecation

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

Copy link

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