Skip to content

[Polls] Comments + Suggestions + Anonymous Polls + LLC Fixes #3398

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

Merged
merged 29 commits into from
Aug 28, 2024

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Aug 27, 2024

🔗 Issue Links

https://stream-io.atlassian.net/browse/PBE-4287
Resolves https://stream-io.atlassian.net/browse/PBE-5113
Resolves https://stream-io.atlassian.net/browse/PBE-4299

🎯 Goal

Implements the following Polls UIKit feature:

  • Poll Comments
  • Poll Suggestions
  • Anonymous Polls

It also fixes the following LLC issues:

  • Fixes poll events resetting the poll.latestAnswers, which would cause the "Add a comment" button to disappear
  • Fixes the first page of the vote list being cleared since it used offset instead of the cursor to check if it was the first page
  • Fixes the vote list server sorting from oldest to newest instead of newest to oldest
  • Fixed PollVoteListQuery.pollId not limiting the votes query to the given poll id

🛠 Implementation

The comments are populated from the poll.answers data which are also votes. An answer is a PollVote with isAnswer = true. This is a bit confusing at the moment, but it is how the backend API works at the moment.

New PollCommentListVC structure:

graph LR
    PollCommentListVC --> PollCommentListSectionHeaderView
    PollCommentListVC  --> PollCommentListItemCell
    PollCommentListItemCell --> PollCommentListItemView --> PollResultsVoteItemView
    PollCommentListVC  --> PollCommentListTableFooterView
Loading

🧪 Manual Testing Notes

Only some minor testing is required by the reviewer. Full QA should be done on the final PR.

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • Changelog is updated with new localization keys
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (docusaurus, tutorial, CMS)

@nuno-vieira nuno-vieira added 🎨 SDK: StreamChatUI Tasks related to the StreamChatUI SDK ✅ Feature An issue or PR related to a feature labels Aug 27, 2024
@nuno-vieira nuno-vieira requested a review from a team as a code owner August 27, 2024 15:39
Copy link

github-actions bot commented Aug 27, 2024

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@nuno-vieira nuno-vieira changed the base branch from develop to add/polls-ui-base August 27, 2024 15:43
@Stream-SDK-Bot
Copy link
Collaborator

SDK Size

title develop branch diff status
StreamChat 6.76 MB 6.8 MB +34 KB 🟢
StreamChatUI 4.41 MB 4.7 MB +288 KB 🟡

@Stream-SDK-Bot
Copy link
Collaborator

SDK Performance

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 0.0 ms 100.0% 🔼 🟢
Duration 2.6 s 2.55 s 1.92% 🔼 🟢
Hitch time ratio 4 ms per s 0.0 ms per s 100.0% 🔼 🟢
Frame rate 75 fps 78.15 fps 4.2% 🔼 🟢
Number of hitches 1 0.0 100.0% 🔼 🟢
ChannelList Hitches total duration 12.5 ms 12.52 ms -0.16% 🔽 🟡
Duration 2.6 s 2.54 s 2.31% 🔼 🟢
Hitch time ratio 5 ms per s 4.94 ms per s 1.2% 🔼 🟢
Frame rate 72 fps 74.22 fps 3.08% 🔼 🟢
Number of hitches 1.2 1.0 16.67% 🔼 🟢

@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Aug 27, 2024

SDK Size

title develop branch diff status
StreamChat 6.76 MB 6.8 MB +34 KB 🟢
StreamChatUI 4.41 MB 4.71 MB +304 KB 🟡

…entListVC/PollCommentListSectionFooterView.swift
Copy link
Contributor

@martinmitrevski martinmitrevski left a comment

Choose a reason for hiding this comment

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

looks good, there's only a bug with the "suggest option" button visibility

CHANGELOG.md Outdated
- `message.polls.button.showAll`
- `message.polls.votes`
- `message.polls.results-title`
- `polls.subtitle.selectOne`
Copy link
Contributor

Choose a reason for hiding this comment

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

This is becoming too big, and making the changelog not really readable - can we shorten it? Possible ideas, move it into an array in one line and use wildcard at the end to group keys (E.g. polls.subtitle.*).

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated, let me know what you think 👍

"message.polls.button.showAll" = "Show all";
"polls.button.show-all" = "Show all";
/// Shown in the message poll results on the button to add a new suggestion.
"polls.button.suggest-option" = "Suggest an Option";
Copy link
Contributor

Choose a reason for hiding this comment

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

This button is shown even when the vote is ended

Copy link
Member Author

Choose a reason for hiding this comment

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

Done 👍 Fixed it also for comments

- `alert.poll.end-title`
- `alert.poll.end`
Multiple localizations were added to Polls, for more details please check the strings file.
- `polls.subtitle.*`
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is great - we should do it like this from now on.

Copy link
Contributor

@martinmitrevski martinmitrevski left a comment

Choose a reason for hiding this comment

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

LGTM ✅

@laevandus
Copy link
Contributor

There were some visual issues with rounded corners but we can also address these in the upcoming PR.

@nuno-vieira
Copy link
Member Author

There were some visual issues with rounded corners but we can also address these in the upcoming PR.

As discussed on Slack, this is an issue from the snapshot framework: pointfreeco/swift-snapshot-testing#358

Copy link

@nuno-vieira nuno-vieira merged commit 043725f into add/polls-ui-base Aug 28, 2024
15 checks passed
@nuno-vieira nuno-vieira deleted the add/polls-ui-comments-and-suggestions branch August 28, 2024 14:54
nuno-vieira added a commit that referenced this pull request Sep 25, 2024
* Refactor PollResultsVC Section views to be more simple and flat hierarchy

* Fix bottom spacing in Poll Results Section Header

* Add comment buttons to `PollAttachmentView`

* Add comment to poll implementation

* Fix `poll.latestAnswers` being reset after poll event did not retreive the `latestAnswers` data

We should not treat optional `latestAnswers` as empty, since they have different meanings

* Add `PollCommentListVC` implementation

* Fix `PollVoteListQueryDTO.filterHash` using filterHash only instead of queryHash

This was causing the pollId to not be considered when fetching the DB votes

* Make diffable data sources more stable

* Fix first page of poll vote list resetting all votes

* Fix the default vote list sorting

* Add poll suggestions feature

* Add anonymous polls support

* Fix AlertsRouter docs

* Add test coverage to `PollCommentListVC`

* Add test coverage when poll comments are 0

* Add test coverage to allow suggestions

* Add test coverage to anonymous polls

* Re-record snapshots after renaming test file

* Fix snapshot on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollAttachmentView.swift

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollCommentListVC/PollCommentListSectionFooterView.swift

* Fix comments and suggestion buttons showing when poll is closed

* Update CHANGELOG.md

* Change alert titles to follow Apples guideline

* Improve comments view spacing

* Optimize a bit to check if a user has already a comment
nuno-vieira added a commit that referenced this pull request Sep 26, 2024
* [Polls] Add `PollAttachmentView` + `ViewContainerBuilder` (#3374)

* Introduce new ViewContainerBuilder

* Add PollAttachmentView component

* Change to SwiftUI ENV

* Add `shouldShowOnlineIndicator` to turn off online presence in `ChatUserAvatarView`

* Fix small iOS 13 deprecation

* Add domain logic helpers to Poll

* Message Polls live updates

* Event.ownVotes workaround (Drop when fixed)

* Manage data races when voting on a poll in the message list

* Add haptic feedback when voting

* Make sure to update the latestVotes author avatar views

* Improve performance of Option List View by no recreating the item views everytime

* Improve flexibility of Option List View without compromising performance

* Make content of StackedUserAvatarsView public

* Re-structure Common Buttons Folder

* Add `CheckboxButton` as a common view

* Add vote ratio logic to `ChatChannelListItemView`

* Fix UI Glitches for option list item view when text is too big and avatar appears and disappears

* Extract more common logic to `Poll` domain model

* Add closed poll and winner option state logic

* Add subtitle text logic to `PollAttachmentView`

* Change winner logic to be the one and only one option with most votes

* Add channel list message preview text for polls

* Add poll quoted message text rendering

* Add View Results and End Button to the Poll Attachment View

* Fix poll option label width ui glitch

* Added End Poll functionality

* Add isOptionWinner and isOptionOneOfTheWinners to Poll

* Fix message with Polls not showing when long pressing

* Fix poll controller with incorrect data in message list

* Sort the `latestVotes` and `latestAnswers` in the LLC

* Add test coverage to Poll domain helpers

* Add Test Coverage to Poll Message Preview in Channel List

* Add test coverage to PollAttachmentView

* Add test coverage to disabling online indicator in ChatUserAvatarView

* Add test coverage to quoted poll

* Fix some existing snapshot tests

* Use UIStackView for Spacer() to avoid drawing

* Fix Xcode 14 Build

* Fix Poll AttachmentView Tests on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Fix Xcode 14 Build, conflict with SwiftUI Spacer

* Revert "Change to SwiftUI ENV"

This reverts commit 6d9129a.

* Add documentation to ViewContainerBuilder

* Fix vale issues

* Fix using pin() instead of constraint() in docs

* [Polls] Add `PollResultsVC` (#3381)

* [Polls] Comments + Suggestions + Anonymous Polls + LLC Fixes (#3398)

* Refactor PollResultsVC Section views to be more simple and flat hierarchy

* Fix bottom spacing in Poll Results Section Header

* Add comment buttons to `PollAttachmentView`

* Add comment to poll implementation

* Fix `poll.latestAnswers` being reset after poll event did not retreive the `latestAnswers` data

We should not treat optional `latestAnswers` as empty, since they have different meanings

* Add `PollCommentListVC` implementation

* Fix `PollVoteListQueryDTO.filterHash` using filterHash only instead of queryHash

This was causing the pollId to not be considered when fetching the DB votes

* Make diffable data sources more stable

* Fix first page of poll vote list resetting all votes

* Fix the default vote list sorting

* Add poll suggestions feature

* Add anonymous polls support

* Fix AlertsRouter docs

* Add test coverage to `PollCommentListVC`

* Add test coverage when poll comments are 0

* Add test coverage to allow suggestions

* Add test coverage to anonymous polls

* Re-record snapshots after renaming test file

* Fix snapshot on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollAttachmentView.swift

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollCommentListVC/PollCommentListSectionFooterView.swift

* Fix comments and suggestion buttons showing when poll is closed

* Update CHANGELOG.md

* Change alert titles to follow Apples guideline

* Improve comments view spacing

* Optimize a bit to check if a user has already a comment

* Add poll creation action to composer if polls are enabled

* Add Poll Creation Views and UX

* Handle keyboard adjustment in the poll creation view

* Add actual if-statement support to ViewContainerBuilder

* Add Poll Creation View Styling

* Add poll creation section header view

* Add Poll Creation Feature Cell Styling

* Add Multiple Votes Feature Cell Data handling

* Improve data handling in PollCreationVC

* Add poll creation button

* Fix Poll Creation Memory Leaks + Add Poll Option Errors

* Implement poll option error indices

* Refactor Poll Creation View to Collection View

* Add views to components and appearance

* Implement keyboard management in Poll Creation VC

* Implementation of discarding poll changes

* Add poll alert error if creation fails

* Fix basic features not being persisted

* Add localization to the views

* Add for polls feature support configuration

* Add Poll Creation View test coverage

* Update CHANGELOG.md

* Fix test_canCreatePoll_whenOptionsError_shouldReturnFalse test

* [CI] Snapshots (#3434)

Co-authored-by: Stream Bot <[email protected]>

* Fix maximum votes error not being cleared when multiple votes is disabled

* Change multiple votes keyboard to number bad

* Remove custom equatable implementation that is not required for PollFeatureType

* Remove yeetd-normal.pkg file?

* Fix adding duplicate options

* Disable swiftlint notification_center_detachment and switch_case_alignment

* Extract poll creation input view height to a constant

---------

Co-authored-by: Stream SDK Bot <[email protected]>
Co-authored-by: Stream Bot <[email protected]>
nuno-vieira added a commit that referenced this pull request Sep 27, 2024
* Refactor PollResultsVC Section views to be more simple and flat hierarchy

* Fix bottom spacing in Poll Results Section Header

* Add comment buttons to `PollAttachmentView`

* Add comment to poll implementation

* Fix `poll.latestAnswers` being reset after poll event did not retreive the `latestAnswers` data

We should not treat optional `latestAnswers` as empty, since they have different meanings

* Add `PollCommentListVC` implementation

* Fix `PollVoteListQueryDTO.filterHash` using filterHash only instead of queryHash

This was causing the pollId to not be considered when fetching the DB votes

* Make diffable data sources more stable

* Fix first page of poll vote list resetting all votes

* Fix the default vote list sorting

* Add poll suggestions feature

* Add anonymous polls support

* Fix AlertsRouter docs

* Add test coverage to `PollCommentListVC`

* Add test coverage when poll comments are 0

* Add test coverage to allow suggestions

* Add test coverage to anonymous polls

* Re-record snapshots after renaming test file

* Fix snapshot on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollAttachmentView.swift

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollCommentListVC/PollCommentListSectionFooterView.swift

* Fix comments and suggestion buttons showing when poll is closed

* Update CHANGELOG.md

* Change alert titles to follow Apples guideline

* Improve comments view spacing

* Optimize a bit to check if a user has already a comment
nuno-vieira added a commit that referenced this pull request Sep 27, 2024
* [Polls] Add `PollAttachmentView` + `ViewContainerBuilder` (#3374)

* Introduce new ViewContainerBuilder

* Add PollAttachmentView component

* Change to SwiftUI ENV

* Add `shouldShowOnlineIndicator` to turn off online presence in `ChatUserAvatarView`

* Fix small iOS 13 deprecation

* Add domain logic helpers to Poll

* Message Polls live updates

* Event.ownVotes workaround (Drop when fixed)

* Manage data races when voting on a poll in the message list

* Add haptic feedback when voting

* Make sure to update the latestVotes author avatar views

* Improve performance of Option List View by no recreating the item views everytime

* Improve flexibility of Option List View without compromising performance

* Make content of StackedUserAvatarsView public

* Re-structure Common Buttons Folder

* Add `CheckboxButton` as a common view

* Add vote ratio logic to `ChatChannelListItemView`

* Fix UI Glitches for option list item view when text is too big and avatar appears and disappears

* Extract more common logic to `Poll` domain model

* Add closed poll and winner option state logic

* Add subtitle text logic to `PollAttachmentView`

* Change winner logic to be the one and only one option with most votes

* Add channel list message preview text for polls

* Add poll quoted message text rendering

* Add View Results and End Button to the Poll Attachment View

* Fix poll option label width ui glitch

* Added End Poll functionality

* Add isOptionWinner and isOptionOneOfTheWinners to Poll

* Fix message with Polls not showing when long pressing

* Fix poll controller with incorrect data in message list

* Sort the `latestVotes` and `latestAnswers` in the LLC

* Add test coverage to Poll domain helpers

* Add Test Coverage to Poll Message Preview in Channel List

* Add test coverage to PollAttachmentView

* Add test coverage to disabling online indicator in ChatUserAvatarView

* Add test coverage to quoted poll

* Fix some existing snapshot tests

* Use UIStackView for Spacer() to avoid drawing

* Fix Xcode 14 Build

* Fix Poll AttachmentView Tests on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Fix Xcode 14 Build, conflict with SwiftUI Spacer

* Revert "Change to SwiftUI ENV"

This reverts commit 6d9129a.

* Add documentation to ViewContainerBuilder

* Fix vale issues

* Fix using pin() instead of constraint() in docs

* [Polls] Add `PollResultsVC` (#3381)

* [Polls] Comments + Suggestions + Anonymous Polls + LLC Fixes (#3398)

* Refactor PollResultsVC Section views to be more simple and flat hierarchy

* Fix bottom spacing in Poll Results Section Header

* Add comment buttons to `PollAttachmentView`

* Add comment to poll implementation

* Fix `poll.latestAnswers` being reset after poll event did not retreive the `latestAnswers` data

We should not treat optional `latestAnswers` as empty, since they have different meanings

* Add `PollCommentListVC` implementation

* Fix `PollVoteListQueryDTO.filterHash` using filterHash only instead of queryHash

This was causing the pollId to not be considered when fetching the DB votes

* Make diffable data sources more stable

* Fix first page of poll vote list resetting all votes

* Fix the default vote list sorting

* Add poll suggestions feature

* Add anonymous polls support

* Fix AlertsRouter docs

* Add test coverage to `PollCommentListVC`

* Add test coverage when poll comments are 0

* Add test coverage to allow suggestions

* Add test coverage to anonymous polls

* Re-record snapshots after renaming test file

* Fix snapshot on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollAttachmentView.swift

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollCommentListVC/PollCommentListSectionFooterView.swift

* Fix comments and suggestion buttons showing when poll is closed

* Update CHANGELOG.md

* Change alert titles to follow Apples guideline

* Improve comments view spacing

* Optimize a bit to check if a user has already a comment

* Add poll creation action to composer if polls are enabled

* Add Poll Creation Views and UX

* Handle keyboard adjustment in the poll creation view

* Add actual if-statement support to ViewContainerBuilder

* Add Poll Creation View Styling

* Add poll creation section header view

* Add Poll Creation Feature Cell Styling

* Add Multiple Votes Feature Cell Data handling

* Improve data handling in PollCreationVC

* Add poll creation button

* Fix Poll Creation Memory Leaks + Add Poll Option Errors

* Implement poll option error indices

* Refactor Poll Creation View to Collection View

* Add views to components and appearance

* Implement keyboard management in Poll Creation VC

* Implementation of discarding poll changes

* Add poll alert error if creation fails

* Fix basic features not being persisted

* Add localization to the views

* Add for polls feature support configuration

* Add Poll Creation View test coverage

* Update CHANGELOG.md

* Fix test_canCreatePoll_whenOptionsError_shouldReturnFalse test

* [CI] Snapshots (#3434)

Co-authored-by: Stream Bot <[email protected]>

* Fix maximum votes error not being cleared when multiple votes is disabled

* Change multiple votes keyboard to number bad

* Remove custom equatable implementation that is not required for PollFeatureType

* Remove yeetd-normal.pkg file?

* Fix adding duplicate options

* Disable swiftlint notification_center_detachment and switch_case_alignment

* Extract poll creation input view height to a constant

---------

Co-authored-by: Stream SDK Bot <[email protected]>
Co-authored-by: Stream Bot <[email protected]>
nuno-vieira added a commit that referenced this pull request Oct 1, 2024
* [Polls] Add `PollAttachmentView` + `ViewContainerBuilder` (#3374)

* Introduce new ViewContainerBuilder

* Add PollAttachmentView component

* Change to SwiftUI ENV

* Add `shouldShowOnlineIndicator` to turn off online presence in `ChatUserAvatarView`

* Fix small iOS 13 deprecation

* Add domain logic helpers to Poll

* Message Polls live updates

* Event.ownVotes workaround (Drop when fixed)

* Manage data races when voting on a poll in the message list

* Add haptic feedback when voting

* Make sure to update the latestVotes author avatar views

* Improve performance of Option List View by no recreating the item views everytime

* Improve flexibility of Option List View without compromising performance

* Make content of StackedUserAvatarsView public

* Re-structure Common Buttons Folder

* Add `CheckboxButton` as a common view

* Add vote ratio logic to `ChatChannelListItemView`

* Fix UI Glitches for option list item view when text is too big and avatar appears and disappears

* Extract more common logic to `Poll` domain model

* Add closed poll and winner option state logic

* Add subtitle text logic to `PollAttachmentView`

* Change winner logic to be the one and only one option with most votes

* Add channel list message preview text for polls

* Add poll quoted message text rendering

* Add View Results and End Button to the Poll Attachment View

* Fix poll option label width ui glitch

* Added End Poll functionality

* Add isOptionWinner and isOptionOneOfTheWinners to Poll

* Fix message with Polls not showing when long pressing

* Fix poll controller with incorrect data in message list

* Sort the `latestVotes` and `latestAnswers` in the LLC

* Add test coverage to Poll domain helpers

* Add Test Coverage to Poll Message Preview in Channel List

* Add test coverage to PollAttachmentView

* Add test coverage to disabling online indicator in ChatUserAvatarView

* Add test coverage to quoted poll

* Fix some existing snapshot tests

* Use UIStackView for Spacer() to avoid drawing

* Fix Xcode 14 Build

* Fix Poll AttachmentView Tests on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Fix Xcode 14 Build, conflict with SwiftUI Spacer

* Revert "Change to SwiftUI ENV"

This reverts commit 6d9129a.

* Add documentation to ViewContainerBuilder

* Fix vale issues

* Fix using pin() instead of constraint() in docs

* [Polls] Add `PollResultsVC` (#3381)

* [Polls] Comments + Suggestions + Anonymous Polls + LLC Fixes (#3398)

* Refactor PollResultsVC Section views to be more simple and flat hierarchy

* Fix bottom spacing in Poll Results Section Header

* Add comment buttons to `PollAttachmentView`

* Add comment to poll implementation

* Fix `poll.latestAnswers` being reset after poll event did not retreive the `latestAnswers` data

We should not treat optional `latestAnswers` as empty, since they have different meanings

* Add `PollCommentListVC` implementation

* Fix `PollVoteListQueryDTO.filterHash` using filterHash only instead of queryHash

This was causing the pollId to not be considered when fetching the DB votes

* Make diffable data sources more stable

* Fix first page of poll vote list resetting all votes

* Fix the default vote list sorting

* Add poll suggestions feature

* Add anonymous polls support

* Fix AlertsRouter docs

* Add test coverage to `PollCommentListVC`

* Add test coverage when poll comments are 0

* Add test coverage to allow suggestions

* Add test coverage to anonymous polls

* Re-record snapshots after renaming test file

* Fix snapshot on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollAttachmentView.swift

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollCommentListVC/PollCommentListSectionFooterView.swift

* Fix comments and suggestion buttons showing when poll is closed

* Update CHANGELOG.md

* Change alert titles to follow Apples guideline

* Improve comments view spacing

* Optimize a bit to check if a user has already a comment

* [Polls] Add Poll Creation Flow (#3433)

* [Polls] Add `PollAttachmentView` + `ViewContainerBuilder` (#3374)

* Introduce new ViewContainerBuilder

* Add PollAttachmentView component

* Change to SwiftUI ENV

* Add `shouldShowOnlineIndicator` to turn off online presence in `ChatUserAvatarView`

* Fix small iOS 13 deprecation

* Add domain logic helpers to Poll

* Message Polls live updates

* Event.ownVotes workaround (Drop when fixed)

* Manage data races when voting on a poll in the message list

* Add haptic feedback when voting

* Make sure to update the latestVotes author avatar views

* Improve performance of Option List View by no recreating the item views everytime

* Improve flexibility of Option List View without compromising performance

* Make content of StackedUserAvatarsView public

* Re-structure Common Buttons Folder

* Add `CheckboxButton` as a common view

* Add vote ratio logic to `ChatChannelListItemView`

* Fix UI Glitches for option list item view when text is too big and avatar appears and disappears

* Extract more common logic to `Poll` domain model

* Add closed poll and winner option state logic

* Add subtitle text logic to `PollAttachmentView`

* Change winner logic to be the one and only one option with most votes

* Add channel list message preview text for polls

* Add poll quoted message text rendering

* Add View Results and End Button to the Poll Attachment View

* Fix poll option label width ui glitch

* Added End Poll functionality

* Add isOptionWinner and isOptionOneOfTheWinners to Poll

* Fix message with Polls not showing when long pressing

* Fix poll controller with incorrect data in message list

* Sort the `latestVotes` and `latestAnswers` in the LLC

* Add test coverage to Poll domain helpers

* Add Test Coverage to Poll Message Preview in Channel List

* Add test coverage to PollAttachmentView

* Add test coverage to disabling online indicator in ChatUserAvatarView

* Add test coverage to quoted poll

* Fix some existing snapshot tests

* Use UIStackView for Spacer() to avoid drawing

* Fix Xcode 14 Build

* Fix Poll AttachmentView Tests on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Fix Xcode 14 Build, conflict with SwiftUI Spacer

* Revert "Change to SwiftUI ENV"

This reverts commit 6d9129a.

* Add documentation to ViewContainerBuilder

* Fix vale issues

* Fix using pin() instead of constraint() in docs

* [Polls] Add `PollResultsVC` (#3381)

* [Polls] Comments + Suggestions + Anonymous Polls + LLC Fixes (#3398)

* Refactor PollResultsVC Section views to be more simple and flat hierarchy

* Fix bottom spacing in Poll Results Section Header

* Add comment buttons to `PollAttachmentView`

* Add comment to poll implementation

* Fix `poll.latestAnswers` being reset after poll event did not retreive the `latestAnswers` data

We should not treat optional `latestAnswers` as empty, since they have different meanings

* Add `PollCommentListVC` implementation

* Fix `PollVoteListQueryDTO.filterHash` using filterHash only instead of queryHash

This was causing the pollId to not be considered when fetching the DB votes

* Make diffable data sources more stable

* Fix first page of poll vote list resetting all votes

* Fix the default vote list sorting

* Add poll suggestions feature

* Add anonymous polls support

* Fix AlertsRouter docs

* Add test coverage to `PollCommentListVC`

* Add test coverage when poll comments are 0

* Add test coverage to allow suggestions

* Add test coverage to anonymous polls

* Re-record snapshots after renaming test file

* Fix snapshot on CI

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollAttachmentView.swift

* Update Sources/StreamChatUI/ChatMessageList/Attachments/Poll/PollCommentListVC/PollCommentListSectionFooterView.swift

* Fix comments and suggestion buttons showing when poll is closed

* Update CHANGELOG.md

* Change alert titles to follow Apples guideline

* Improve comments view spacing

* Optimize a bit to check if a user has already a comment

* Add poll creation action to composer if polls are enabled

* Add Poll Creation Views and UX

* Handle keyboard adjustment in the poll creation view

* Add actual if-statement support to ViewContainerBuilder

* Add Poll Creation View Styling

* Add poll creation section header view

* Add Poll Creation Feature Cell Styling

* Add Multiple Votes Feature Cell Data handling

* Improve data handling in PollCreationVC

* Add poll creation button

* Fix Poll Creation Memory Leaks + Add Poll Option Errors

* Implement poll option error indices

* Refactor Poll Creation View to Collection View

* Add views to components and appearance

* Implement keyboard management in Poll Creation VC

* Implementation of discarding poll changes

* Add poll alert error if creation fails

* Fix basic features not being persisted

* Add localization to the views

* Add for polls feature support configuration

* Add Poll Creation View test coverage

* Update CHANGELOG.md

* Fix test_canCreatePoll_whenOptionsError_shouldReturnFalse test

* [CI] Snapshots (#3434)

Co-authored-by: Stream Bot <[email protected]>

* Fix maximum votes error not being cleared when multiple votes is disabled

* Change multiple votes keyboard to number bad

* Remove custom equatable implementation that is not required for PollFeatureType

* Remove yeetd-normal.pkg file?

* Fix adding duplicate options

* Disable swiftlint notification_center_detachment and switch_case_alignment

* Extract poll creation input view height to a constant

---------

Co-authored-by: Stream SDK Bot <[email protected]>
Co-authored-by: Stream Bot <[email protected]>

* Add `padding()` to ViewContainerBuilder + Remove ViewContainerBuilder `layout` and `constraints`

The layout and constraints function would not work at all because applying constraints before adding a view to hierarchy is not possibl.e

* Fix votes impacting latest answers

* Fix poll.ownVotes and poll.latestAnwers impacting each other by moving them to poll.latestVotes

* Fix Poll Repository Tests

* Fix reorder icon showing before adding a new option

* Fix anonymous comments logic

* Fix channel list message preview incorrect latest voter

* Fix edit message appearing in poll attachment

* Fix being able to tap on options in a closed poll

* Change min votes to 2 when maximum votes enabled since 1 maximum is not multiple votes

* Fix trophy not showing for poll results winner

* Fix snapshot UI Tests

* Fix section header tests

* Remove unnecessary disabling of swiftlint rules

* PR Feedback

* Change the order of the latest votes so that the first one is the most recent one

* Adds the `PollAllOptionsListVC` component

* Add missing test coverage to `PollAllOptionsListVC`

* Fix poll question tappable on the All Options view

* Fix not allow creating poll with only 1 option

* Fix snapshots of poll all options view

* Fix Message Actions not scrollable when multiple options

* Update CHANGELOG.md

* Add documentation to Polls UIKit

* Update Poll Configuration docs

* Better consistency in Polls documentation titles

* Improve Poll State documentation structure

* Update Poll Vote List Controller documentation with new inits

* [CI] Snapshots (#3441)

Co-authored-by: Stream Bot <[email protected]>

* Remove unwanted file

---------

Co-authored-by: Stream SDK Bot <[email protected]>
Co-authored-by: Stream Bot <[email protected]>
Co-authored-by: Stream Bot <[email protected]>
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Feature An issue or PR related to a feature 🎨 SDK: StreamChatUI Tasks related to the StreamChatUI SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants