-
Notifications
You must be signed in to change notification settings - Fork 0
feat(samples): update sample app #10
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit introduces client-side state management for all list types: - `ActivityList` - `ActivityCommentList` - `ActivityReactionList` - `BookmarkList` - `BookmarkFolderList` - `CommentReplyList` - `CommentReactionList` - `FollowList` - `PollList` - `PollVoteList` It also implements the `Activity` state object. Each list type and the `Activity` object now have: - A dedicated state notifier (e.g., `ActivityListStateNotifier`). - A corresponding state class (e.g., `ActivityListState`) using `freezed`. - Event handlers for real-time updates via WebSockets (e.g., `ActivityListEventHandler`). Key changes: - `FeedsClientImpl`: - Instantiates and returns the new stateful list objects. - Passes necessary repositories and event emitters to these objects. - Adds `pollAnswerCastedFeedEventResolver` and `pollAnswerRemovedFeedEventResolver` to WebSocket event resolvers. - Corrects user image field in `_authenticateUser`. - Handles `ClientException` for anonymous user connection attempts. - State notifiers: - Manage the data (e.g., activities, comments) and pagination state. - Provide methods to update the state based on API responses and WebSocket events. - Utilize `QueryConfiguration` to store and use filter and sort parameters. - State classes: - Define the structure of the observable state (e.g., list of items, pagination data). - Include a `canLoadMore` getter. - Event handlers: - Process specific WebSocket events relevant to their list type. - Call appropriate methods on the state notifier to update the state. - Model updates: - `ThreadedCommentData`: Added mutation methods for reactions and replies, and a `setCommentData` method. - `ActivitiesSortField`: `createdAt` now uses `data.createdAt`, `popularity` uses `data.popularity`. - `ReactionGroupData`: Improved logic in `decrement` and `increment` methods. - `PollData`: Added `ownVotesAndAnswers`, `ownVotes`, `ownAnswers`, and `latestVotes` getters. Added mutation methods for options and answers. - `PollVoteData`: `isAnswer` is now a getter based on `answerText`. - Repository updates: - `CommentsRepository`: `deleteComment` now accepts an optional `hardDelete` parameter. - `PollsRepository`: Removed `userId` parameter from `deletePoll`, `getPoll`, `deletePollOption`, `getPollOption`, and `deletePollVote`. - New event resolvers: - `pollAnswerCastedFeedEventResolver`: Resolves `PollAnswerCastedFeedEvent` from `PollVoteCastedFeedEvent` or `PollVoteChangedFeedEvent`. - `pollAnswerRemovedFeedEventResolver`: Resolves `PollAnswerRemovedFeedEvent` from `PollVoteRemovedFeedEvent`. This provides a reactive way to interact with lists of data from Stream Feeds, automatically handling updates and pagination.
The `event_resolvers` directory and its contents have been moved to a new directory named `resolvers`. This change aims to improve the project structure and clarity. Imports in affected files have been updated to reflect the new location of the resolver utilities.
The FeedsStateNotifier class was identical to StateNotifier and thus redundant. This commit removes FeedsStateNotifier and updates ActivityReactionListStateNotifier to directly extend StateNotifier.
The `collection` package was being imported but not used in several state management files. This commit removes those unnecessary imports.
This commit introduces significant improvements to the script used for generating the Dart client for Stream Feeds. Key changes: - **Configuration:** Moved the `CHAT_DIR` configuration to the top of the script for easier modification by developers. - **Path Handling:** Implemented more robust path handling using `SCRIPT_DIR` and `REPO_ROOT` to make the script less dependent on absolute paths. - **Validation:** Added checks for the existence of `CHAT_DIR`, `renamed-models.json`, and the presence of `go` and `dart` in the system PATH. - **Clarity:** Added `echo` statements to provide better feedback to the user during the generation process. - **Sed Portability:** Replaced `sed -i ''` with a more portable `sed_inplace` function that works on both macOS and Linux. - **Scoped Build & Format:** Limited `build_runner` and `dart format` to only run on the `stream_feeds` package, improving efficiency. - **Output Directory:** Ensured the output directory for generated code is created if it doesn't exist. - **Error Handling:** Utilized `set -euo pipefail` for better script error handling. - **Melos Integration:** Added a new melos script `gen:feeds` to trigger this generation script. The script now performs the following steps: 1. Generates the OpenAPI spec and Dart client from the chat repository. 2. Applies post-generation fixes (e.g., removing duplicate fields in generated models). 3. Runs `build_runner` specifically for the `stream_feeds` package. 4. Formats the generated code within the `stream_feeds` package.
renefloor
approved these changes
Sep 2, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.