-
Notifications
You must be signed in to change notification settings - Fork 0
Handle missing events for various state objects #74
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 adds missing event handling for various states to ensure comprehensive real-time updates across the Stream Feeds Android client. The implementation focuses on handling deletion events and some addition events that were previously not addressed.
Key changes include:
- Addition of event handlers for deletion and update events across multiple state managers (Activity, Feed, Bookmark, Comment, Follow, and Member lists)
- Unification of reaction add/remove logic through common utility functions
- Update to FeedsReactionData ID generation to include comment ID and type for better uniqueness
Reviewed Changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
ActivityEventHandler.kt |
Added handling for activity reaction, bookmark, and update events with proper feed/activity matching |
FeedEventHandler.kt |
Added support for ActivityRemovedFromFeedEvent |
Various list event handlers | Added deletion event handling for bookmarks, comments, feeds, follows, and members |
State implementations | Added removal methods and updated existing logic to support new event types |
FeedsReactionData.kt |
Updated ID generation to include commentId and type for better uniqueness |
Reaction logic files | Refactored to use unified reaction add/remove utility functions |
Test files | Added comprehensive test coverage for new event handling functionality |
Comments suppressed due to low confidence (1)
stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/utils/List.kt:162
- Removed documentation parameter
@param T
but the function still uses generic typeT
. The parameter documentation should be retained to explain the generic type parameter.
* @param T The type of elements in the list.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...eeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/utils/List.kt
Show resolved
Hide resolved
SDK Size Comparison 📏
|
...s-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/ActivityData.kt
Show resolved
Hide resolved
@@ -309,35 +304,18 @@ internal fun ActivityData.addReaction( | |||
internal fun ActivityData.removeReaction( | |||
reaction: FeedsReactionData, | |||
currentUserId: String, | |||
): ActivityData { |
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.
Same as for addReaction
get() = "${activityId}${user.id}" | ||
get() = "${activityId}${commentId}${user.id}${type}" |
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.
We can have multiple reactions per activity & comment.
import io.getstream.feeds.android.client.api.model.isEmpty | ||
import io.getstream.feeds.android.client.internal.utils.upsert | ||
|
||
internal inline fun <T> addReaction( |
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.
The code in here and removeReaction
comes from the corresponding extensions of ThreadedCommentData
, adapted to be generic.
// It might be a nested reply, search and remove recursively | ||
current.map { comment -> removeCommentFromReplies(comment, commentId) } | ||
} | ||
current.treeRemoveFirst( |
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.
Replacing in favor of a generic function, like for CommentListStateImpl
.
4c0d8b6
to
fc65bb7
Compare
…dEvent, BookmarkAddedEvent, BookmarkDeletedEvent for Activity
fc65bb7
to
bd30ecf
Compare
Goal
I was reviewing the events we handled and noticed some were missing, so the goal of this PR is to address those gaps.
Implementation
Most of the code is just adding some new handling code in
XyzHandler
s and delegate to the appropriateXyzStateUpdates
:ActivityReactionAddedEvent
,ActivityReactionDeletedEvent
,ActivityUpdatedEvent
,BookmarkAddedEvent
, andBookmarkDeletedEvent
ActivityReactionAddedEvent
BookmarkDeletedEvent
CommentDeletedEvent
ActivityRemovedFromFeedEvent
FeedDeletedEvent
FollowDeletedEvent
FeedMemberAddedEvent
and improved filtering by fidPollVoteCastedFeedEvent
Additionally, I took the opportunity to:
FeedsReactionData
id to include comment id and typeTesting
The new code is covered by tests.
Testing this manually is not trivial in most cases. What I did was the following (taking
BookmarkList
as an example):FeedViewModel
to query aBookmarkList
, observe and log the results (list.state.bookmarks
)Checklist