Skip to content

Refactor: Add CoursesRepository facade methods for sub-repositories#11633

Open
dogi wants to merge 2 commits intomasterfrom
refactor-courses-repository-facade-8751427896203956131
Open

Refactor: Add CoursesRepository facade methods for sub-repositories#11633
dogi wants to merge 2 commits intomasterfrom
refactor-courses-repository-facade-8751427896203956131

Conversation

@dogi
Copy link
Member

@dogi dogi commented Mar 2, 2026

This PR introduces a Facade pattern to CoursesRepository to centralize access to course-related sub-repositories (ActivitiesRepository, ProgressRepository, and SubmissionsRepository).

By exposing these repositories through facade methods on CoursesRepository, we significantly reduce the number of @Inject dependencies required by client classes such as TakeCourseFragment. 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

- 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>
@google-labs-jules
Copy link
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Collaborator

@Okuro3499 Okuro3499 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@dogi dogi requested a review from Okuro3499 March 3, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants