-
Notifications
You must be signed in to change notification settings - Fork 1
Add activity batch update event for updating state with activity batch operations #52
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
Conversation
| public func addActivity(request: AddActivityRequest) async throws -> ActivityData { | ||
| let activityData = try await activitiesRepository.addActivity(request: request) | ||
| for feed in request.feeds.map(FeedId.init) { | ||
| await stateLayerEventPublisher.sendEvent(.activityAdded(activityData, feed)) |
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.
why do we need to do this? Shouldn't this come from the WS event?
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 same pattern is everywhere else as well. It is good because state is updated before this function returns.
I can write code where:
let feed = client.feed(for: )
try await client.addActivity(… )
let activities = feed.state.activities // this already contains added activities, WS event has not received
Secondly WS events do not have own_ fields set, so using HTTP response data we get the most up to date data for all the own fields as well.
# Conflicts: # CHANGELOG.md # Tests/StreamFeedsTests/StateLayer/ActivityList_Tests.swift # Tests/StreamFeedsTests/TestTools/ActivityResponse+Testing.swift
Generated by 🚫 Danger |
Public Interface public struct ModelUpdates: Sendable
- public let added: [Model]
+ public internal var added: [Model]
- public let removedIds: [String]
+ public internal var removedIds: Set<String>
- public let updated: [Model]
+ public internal var updated: [Model]
public final class FeedsClient: Sendable
- @discardableResult public func addActivity(request: AddActivityRequest)async throws -> AddActivityResponse
+ @discardableResult public func addActivity(request: AddActivityRequest)async throws -> ActivityData
- @discardableResult public func deleteActivities(request: DeleteActivitiesRequest)async throws -> DeleteActivitiesResponse
+ @discardableResult public func deleteActivities(request: DeleteActivitiesRequest)async throws -> Set<String> |
SDK Size
|
|
StreamFeeds XCSize
Show 9 more objects
|


🔗 Issue Links
Fixes: IOS-1252
🎯 Goal
Activity batch operations did not update state-layer state
📝 Summary
activityBatchUpdatefor batch operations which also update state layer state with one go🛠 Implementation
Local events are good for state layer because these contain full data where as web-socket events lack own fields.
🎨 Showcase
🧪 Manual Testing Notes
☑️ Contributor Checklist
docs-contentrepo