Expose missing operations on existing entities#190
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThe PR introduces three new operations across the Android SDK: bookmark folder management (update and delete), activity restoration for soft-deleted items, and follow relationship updates with push notification preferences. These operations are implemented consistently across the API client, repository, and state management layers with unit test coverage. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/FeedImplTest.kt (1)
420-437: Consider asserting the constructedUpdateFollowRequestpayload.This test passes
any()tofeedsRepository.updateFollowand thus won't catch regressions in howFeedImpl.updateFollowmapstargetFid,custom, andpushPreferenceinto the request (e.g., swappingsource/target, droppingcustom, etc.). Consider asserting the exact request, similar to howcreatePolluses amatch<...>block.💡 Example
- coEvery { feedsRepository.updateFollow(any()) } returns Result.success(follow) + coEvery { feedsRepository.updateFollow(any()) } returns Result.success(follow) ... - verify { stateEventListener.onEvent(StateUpdateEvent.FollowUpdated(follow)) } + coVerify { + feedsRepository.updateFollow( + match { + it.source == "group:id" && + it.target == "user:target" && + it.custom == custom && + it.pushPreference == pushPreference + } + ) + } + verify { stateEventListener.onEvent(StateUpdateEvent.FollowUpdated(follow)) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/FeedImplTest.kt` around lines 420 - 437, The test currently uses any() for feedsRepository.updateFollow so it won't catch wrong mappings; change the stub to capture/assert the exact UpdateFollowRequest constructed by FeedImpl.updateFollow by using coEvery { feedsRepository.updateFollow(match { it.source == /* expected source */ && it.target == /* expected target */ && it.custom == custom && it.push == pushPreference }) } returns Result.success(follow) (or equivalent match/assert block), ensuring you reference UpdateFollowRequest, FeedImpl.updateFollow and feedsRepository.updateFollow; keep the final assertions (result and StateUpdateEvent.FollowUpdated) as-is.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/state/FeedImpl.kt`:
- Around line 222-224: restoreActivity currently returns
activitiesRepository.restoreActivity(id) directly without emitting an
ActivityAdded state event; update FeedImpl.restoreActivity to call
activitiesRepository.restoreActivity(id), inspect the Result, and when
successful extract the restored ActivityData and invoke
subscriptionManager.onEvent(ActivityAdded(...)) (using the same FidScope used
elsewhere, e.g., FidScope.unknown in tests) before returning the successful
Result; ensure you do not emit the event on failure and return the original
Result unchanged.
---
Nitpick comments:
In
`@stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/FeedImplTest.kt`:
- Around line 420-437: The test currently uses any() for
feedsRepository.updateFollow so it won't catch wrong mappings; change the stub
to capture/assert the exact UpdateFollowRequest constructed by
FeedImpl.updateFollow by using coEvery { feedsRepository.updateFollow(match {
it.source == /* expected source */ && it.target == /* expected target */ &&
it.custom == custom && it.push == pushPreference }) } returns
Result.success(follow) (or equivalent match/assert block), ensuring you
reference UpdateFollowRequest, FeedImpl.updateFollow and
feedsRepository.updateFollow; keep the final assertions (result and
StateUpdateEvent.FollowUpdated) as-is.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 4103dd9e-9d16-4eb0-8672-e1f23ec806a1
📒 Files selected for processing (14)
stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/FeedsClient.ktstream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/Feed.ktstream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/client/FeedsClientImpl.ktstream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/ActivitiesRepository.ktstream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/ActivitiesRepositoryImpl.ktstream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/BookmarksRepository.ktstream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/BookmarksRepositoryImpl.ktstream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepository.ktstream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepositoryImpl.ktstream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/state/FeedImpl.ktstream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/repository/ActivitiesRepositoryImplTest.ktstream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/repository/BookmarksRepositoryImplTest.ktstream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepositoryImplTest.ktstream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/FeedImplTest.kt
SDK Size Comparison 📏
|
b42afcd to
e816840
Compare
|
|
🚀 Available in v0.9.0 |


Goal
Expose missing operations on existing entities: restore activity, update follow, update/delete bookmark folder.
Implementation
restoreActivity(id)toFeedfor restoring soft-deleted activitiesupdateFollow(targetFid, custom, pushPreference)toFeedfor updating follow relationshipsupdateBookmarkFolder(folderId, request)anddeleteBookmarkFolder(folderId)toFeedsClientTesting
Added unit tests for all new operations across repository and state layers.
For testing manually, you'd need to add some code to the sample to exercise the new operations (e.g. in
FeedViewModel), as none are currently implemented in the sample.Checklist
Summary by CodeRabbit