Refactor: Add CoursesRepository facade methods for sub-repositories#11633
Refactor: Add CoursesRepository facade methods for sub-repositories#11633
Conversation
- Added `getCourseActivities()`, `getCourseProgress()`, and `getCourseSubmissions()` facade methods to `CoursesRepository` interface. - Implemented these methods in `CoursesRepositoryImpl` by returning injected `ActivitiesRepository`, `ProgressRepository`, and `SubmissionsRepository` instances. - Refactored `TakeCourseFragment` to exclusively inject `CoursesRepository`, replacing direct sub-repository injections with method calls to the new facades. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Okuro3499
left a comment
There was a problem hiding this comment.
1. Revert the facade getter methods from CoursesRepository and CoursesRepositoryImpl. Do not expose sub-repository interfaces through another repository's interface.
2. If consolidation is the goal, implement true delegation: move the calls (logCourseVisit, getCurrentProgress, isStepCompleted, etc.) into CoursesRepository as first-class suspend methods that internally delegate to sub-repositories — keeping sub-repos invisible to the caller.
3. Alternatively, keep the three direct @Inject fields in TakeCourseFragment — that is idiomatic Hilt and perfectly appropriate for a fragment with multiple cross-domain concerns.
- Reverted facade getter methods from `CoursesRepository`. - Added true delegation methods to `CoursesRepository` (`logCourseVisit`, `getCurrentProgress`, `getCourseProgress`, `isStepCompleted`, `hasUnfinishedSurveys`). - Implemented these methods in `CoursesRepositoryImpl` by delegating directly to the injected `ActivitiesRepository`, `ProgressRepository`, and `SubmissionsRepository`. - Refactored `TakeCourseFragment` to call the delegation methods on `CoursesRepository`, allowing the removal of direct `@Inject` fields for the sub-repositories without exposing their interfaces. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This PR introduces a Facade pattern to
CoursesRepositoryto centralize access to course-related sub-repositories (ActivitiesRepository,ProgressRepository, andSubmissionsRepository).By exposing these repositories through facade methods on
CoursesRepository, we significantly reduce the number of@Injectdependencies required by client classes such asTakeCourseFragment. This leads to cleaner UI components, better separation of concerns, and centralized data access logic.PR created automatically by Jules for task 8751427896203956131 started by @dogi