-
Notifications
You must be signed in to change notification settings - Fork 1
Upsert new reactions in a sorted position in ActivityReactionList
#132
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
base: develop
Are you sure you want to change the base?
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
There was a problem hiding this 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 refactors comment and reaction list management by removing generic tree update utilities and replacing them with specialized, domain-specific functions. The changes improve code maintainability by making the codebase more focused on specific use cases rather than generic tree manipulation.
- Removed generic tree update/remove functions (
treeUpdateFirst,treeRemoveFirst) fromList.kt - Introduced domain-specific
removeCommentfunctions inThreadedCommentOperations.ktfor handling comment removal in threaded structures - Updated
ActivityReactionListStateImplto useupsertSortedinstead ofupsertfor maintaining sorted reaction lists - Added test coverage for sorted reaction insertion behavior
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/utils/ListTreeUpdateTest.kt | Removed entire test file for generic tree update functions that are no longer used |
| stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/utils/List.kt | Removed generic tree update/remove functions (treeUpdateFirst, treeRemoveFirst, internalTreeUpdate) |
| stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/model/ThreadedCommentOperations.kt | Added specialized removeComment and removeReply functions for threaded comment removal |
| stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/state/CommentReplyListStateImpl.kt | Refactored to use new removeComment function instead of manual filtering/recursion |
| stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/state/ActivityCommentListStateImpl.kt | Replaced treeRemoveFirst call with new removeComment function |
| stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/state/ActivityReactionListStateImpl.kt | Changed from upsert to upsertSorted to maintain sorted order when inserting reactions |
| stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/ActivityReactionListStateImplTest.kt | Updated test data calls to use named parameters and added new test for sorted insertion behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...rc/main/kotlin/io/getstream/feeds/android/client/internal/model/ThreadedCommentOperations.kt
Show resolved
Hide resolved
...rc/main/kotlin/io/getstream/feeds/android/client/internal/model/ThreadedCommentOperations.kt
Show resolved
Hide resolved
SDK Size Comparison 📏
|
|



Goal
AND-800
When we upsert reactions in an
ActivityReactionList, we should keep the sorting.Implementation
upsertSortedinstead ofupsertTesting
As similar cases, we don't show
ActivityReactionListin the sample, so for testing one would need to create and observe a reaction list, and then add a reaction to the corresponding activity to see that it's inserted in order.Checklist