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

feat(ui, core, localization): Add Poll attachment interactor #2052

Merged
merged 61 commits into from
Dec 24, 2024

Conversation

xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Nov 21, 2024

This pull request includes significant updates to the poll feature in the stream_chat package, focusing on enhancing poll functionality and improving data consistency. The changes introduce new methods for managing polls, update existing methods to use synchronization locks, and modify data models to better reflect poll states and votes.

Enhancements to Poll Functionality:

  • Added new methods for managing polls, including deletePoll, closePoll, createPollOption, castPollVote, addPollAnswer, removePollVote, and queryPollVotes in the Channel class. These methods are synchronized using _pollLock and _pollVoteLock to ensure thread safety. [1] [2] [3]

Data Model Updates:

  • Updated the Poll class to replace answers and votesByOption with latestAnswers and latestVotesByOption respectively. Added new computed properties latestVotes, ownVotes, and ownAnswers to provide clearer access to poll data. [1] [2] [3] [4] [5] [6]

Synchronization Improvements:

  • Introduced _pollLock and _pollVoteLock in the Channel class to synchronize poll-related operations, ensuring that poll actions are thread-safe. [1] [2] [3]

Event Handling:

  • Added new event type pollDeleted to the EventType class to handle poll deletion events.

Testing and Documentation:

  • Updated tests in poll_test.dart to reflect changes in the Poll data model, ensuring that the new properties and methods are correctly tested. [1] [2] [3]
  • Added a new file poll_voting_mode.dart to define different voting modes for polls, enhancing the flexibility of poll configurations.

These changes collectively enhance the robustness and flexibility of poll management within the stream_chat package, ensuring better data integrity and improved functionality.

@xsahil03x xsahil03x marked this pull request as draft November 21, 2024 13:15
@xsahil03x xsahil03x marked this pull request as ready for review December 9, 2024 14:01
Base automatically changed from feat/polls-attachment-composer to master December 11, 2024 14:10
…idget

# Conflicts:
#	packages/stream_chat/lib/src/client/channel.dart
#	packages/stream_chat/lib/src/core/models/poll.dart
#	packages/stream_chat/lib/src/core/models/poll.g.dart
#	packages/stream_chat/lib/src/event_type.dart
#	packages/stream_chat/lib/stream_chat.dart
#	packages/stream_chat/test/src/core/models/poll_test.dart
#	packages/stream_chat_flutter/lib/src/localization/translations.dart
#	packages/stream_chat_flutter/lib/src/message_input/attachment_picker/options/stream_poll_creator.dart
#	packages/stream_chat_flutter/lib/src/message_input/attachment_picker/stream_attachment_picker.dart
#	packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart
#	packages/stream_chat_flutter/lib/src/theme/poll_creator_theme.dart
#	packages/stream_chat_flutter/lib/src/theme/stream_chat_theme.dart
#	packages/stream_chat_flutter/test/src/goldens/poll_option_reorderable_list_view_dark.png
#	packages/stream_chat_flutter/test/src/goldens/poll_option_reorderable_list_view_light.png
#	packages/stream_chat_flutter/test/src/goldens/stream_poll_creator_dialog_dark.png
#	packages/stream_chat_flutter/test/src/goldens/stream_poll_creator_dialog_light.png
#	packages/stream_chat_flutter/test/src/goldens/stream_poll_creator_full_screen_dialog_dark.png
#	packages/stream_chat_flutter/test/src/goldens/stream_poll_creator_full_screen_dialog_light.png
#	packages/stream_chat_flutter_core/lib/stream_chat_flutter_core.dart
#	packages/stream_chat_localizations/example/lib/add_new_lang.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart
#	packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart
#	packages/stream_chat_localizations/test/translations_test.dart
xsahil03x and others added 8 commits December 23, 2024 21:42
…idget

# Conflicts:
#	packages/stream_chat_flutter/test/src/gallery/gallery_header_test.dart
#	packages/stream_chat_flutter/test/src/goldens/gallery_header_0.png
#	packages/stream_chat_flutter/test/src/goldens/poll_option_reorderable_list_view_dark.png
#	packages/stream_chat_flutter/test/src/goldens/poll_option_reorderable_list_view_light.png
#	packages/stream_chat_flutter/test/src/goldens/stream_poll_creator_dialog_dark.png
#	packages/stream_chat_flutter/test/src/goldens/stream_poll_creator_dialog_light.png
#	packages/stream_chat_flutter/test/src/goldens/stream_poll_creator_full_screen_dialog_dark.png
#	packages/stream_chat_flutter/test/src/goldens/stream_poll_creator_full_screen_dialog_light.png
#	packages/stream_chat_flutter/test/src/poll/poll_option_reorderable_list_view_test.dart
#	packages/stream_chat_flutter/test/src/poll/poll_question_text_field_test.dart
#	packages/stream_chat_flutter/test/src/poll/stream_poll_creator_dialog_test.dart
#	packages/stream_chat_localizations/CHANGELOG.md
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

Attention: Patch coverage is 53.18656% with 808 lines in your changes missing coverage. Please review.

Project coverage is 60.59%. Comparing base (714a194) to head (c3f9988).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...t_flutter/lib/src/theme/poll_interactor_theme.dart 16.88% 128 Missing ⚠️
...core/lib/src/stream_poll_vote_list_controller.dart 0.00% 96 Missing ⚠️
...utter/lib/src/theme/poll_results_dialog_theme.dart 21.64% 76 Missing ⚠️
.../lib/src/poll/stream_poll_option_votes_dialog.dart 0.00% 65 Missing ⚠️
...tter/lib/src/poll/stream_poll_comments_dialog.dart 0.00% 59 Missing ⚠️
.../lib/src/theme/poll_option_votes_dialog_theme.dart 18.57% 57 Missing ⚠️
...l_vote_scroll_view/stream_poll_vote_list_view.dart 0.00% 54 Missing ⚠️
...tter/lib/src/theme/poll_comments_dialog_theme.dart 19.67% 49 Missing ⚠️
packages/stream_chat/lib/src/client/channel.dart 0.00% 48 Missing ⚠️
...utter/lib/src/theme/poll_options_dialog_theme.dart 26.78% 41 Missing ⚠️
... and 17 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2052      +/-   ##
==========================================
- Coverage   61.14%   60.59%   -0.56%     
==========================================
  Files         336      356      +20     
  Lines       20152    21846    +1694     
==========================================
+ Hits        12322    13237     +915     
- Misses       7830     8609     +779     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

sachaarbonel
sachaarbonel previously approved these changes Dec 24, 2024
Copy link
Member

@sachaarbonel sachaarbonel left a comment

Choose a reason for hiding this comment

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

LGTM

@xsahil03x xsahil03x merged commit 337074e into master Dec 24, 2024
13 of 15 checks passed
@xsahil03x xsahil03x deleted the feat/poll-message-widget branch December 24, 2024 16:27
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.

4 participants