[REFACTOR] Structural Enhancement of AppPreference Implementation#98
Conversation
- Allow Dagger to manage Local AppPreferenceRepository as a Singleton instance, exposing its accessibility via interface in :domain module (Dependency Inversion)
* Refactor AppPreference to AppPreferenceRepository and its Implementation.
* Necessary Dependency has been provided via LocalPreferenceModule with @singleton Annotation.
- Decentralize 'RemoteRepositoryImpl' into three independent Repositories.
1. RemoteContentRepositoryImpl
2. RemotePreferenceRepositoryImpl
3. RemoteTokenRepositoryImpl
* Necessary directory structure modification has been performed.
- Provide dependency of AppPreferenceRepository instance as a Singleton.
* Dependency is provided via Component-Dependency between AppComponent and each SceneComponents.
- Replace legacy 'AppPreference' dependency to updated 'AppPreferenceRepository'
- Add necessary library dependency (Kotlin Serialization)
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the application's architecture by refactoring how local preferences and remote data interactions are handled. It introduces a dedicated Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with π and π on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the data layer by splitting the monolithic RemoteRepositoryImpl into more specialized RemoteContentRepositoryImpl, RemotePreferenceRepositoryImpl, and RemoteTokenRepositoryImpl. It also introduces an AppPreferenceRepository interface and its AppPreferenceRepositoryImpl implementation, moving the AppPreferences class and making it an interface. This involved updating numerous Dagger components and view models to use the new AppPreferenceRepository and LocalCacheProvider for dependency injection. Additionally, Kotlin Serialization plugin and dependency were added to the core/data module. The review comments suggest improving the TAG naming convention in the new remote repository implementations for better consistency and log filtering.
- Update TAG variables to match with its class name. - Change the filename to ensure name consistency.
- Made architectural improvement on AppPreferenceRepository to prevent potential technical debt caused by monolithic Repository implementation.
* Decentralize Monolithic AppPreferenceRepository to achieve strict Separation of Concern via Interface Segregation.
* Necessary Binding functions have been defined for Dependency Injection via Dagger 2.
- Made architectural improvement on AppPreferenceRepository to prevent potential technical debt caused by monolithic Repository implementation.
* Update Dagger Components to provide necessary AppPreferences' dependencies.
- Made architectural improvement on AppPreferenceRepository to prevent potential technical debt caused by monolithic Repository implementation.
* Replace legacy monolithic AppPreferenceRepository dependency to updated dependencies based on the context and operations.
- Enhance current implementation of RemoteContentRepositoryImpl and RemotePreferenceRepositoryImpl into more smaller implementation of each interface to ensure strict separation of concern, and isolating logic/implementation
* RemoteContentRepositoryImpl
-> RemoteNoticeRepositoryImpl (Notice)
-> RemoteTipRepositoryImpl (Tip)
* RemotePreferenceRepositoryImpl
-> RemoteSubscriptionRepositoryImpl (Major Subscriptions)
-> RemoteUserReportRepositoryImpl (User Report Submission)
|
/gemini review |
Summary of ChangesThis pull request significantly refactors the application's architecture by enhancing how local preferences and remote data interactions are managed. It transforms previously monolithic components into a more modular, maintainable, and testable structure, aligning with principles of separation of concerns and interface segregation. These changes streamline dependency injection, improve code clarity, and prepare the codebase for future feature development and easier maintenance. Highlights
Changelog
Activity
|
|
Remove redundant comments |
There was a problem hiding this comment.
Code Review
This pull request refactors the application's preference management and dependency injection system. The monolithic AppPreferences class has been replaced by several granular preference repository interfaces (AppDatabasePreferenceRepository, AppSubscriptionPreferenceRepository, AppTokenPreferenceRepository, AppWidgetPreferenceRepository) and their implementations. The AppComponent and various scene-specific Dagger components have been updated to use these new interfaces, improving modularity and separation of concerns. Additionally, remote repository implementations have been split into more specific classes, and the KnuticeRemoteSource now receives tokens as arguments instead of directly depending on a preference class. Review comments suggest using named arguments for Dagger component factory methods to enhance readability and robustness, and address an argument order mismatch in one component creation.
- Enhance Readability by using named Arguments and following function signature to provide arguments
π Summary (κ°μ)
AppPreference.kt, a Repository of local SharedPreference.RemoteRepository(032626)π Related Issue (κ΄λ ¨ μ΄μ)
π Type of Change (λ³κ²½ μ¬ν)
FEAT: New feature (μλ‘μ΄ κΈ°λ₯)FIX: Bug fix (λ²κ·Έ μμ )REFACTOR: Code refactoring (no functional change) (μ½λ 리ν©ν λ§)DESIGN: UI/UX changes (λμμΈ λ³κ²½)!HOTFIX: Critical fix (μΉλͺ μ μΈ λ²κ·Έ μμ )CHORE: Build/Config/CI (λΉλ/μ€μ /CI)β¨ Key Changes (ν΅μ¬ λ³κ²½ μ¬ν)
AppPreference.kttoAppPreferenceRepositoryand its implementation to allow Dagger manage its dependency with proper scope (@Singleton)RemoteRepositoryImplinto three separate repositories to ensure separation of concern. (RemoteContentRepository,RemotePreferenceRepository,RemoteTokenRepository)AppPreferencedependency to updatedAppPreferenceRepositoryAppPreferenceRepositoryto achieve strict Separation of Concern via Interface Segregation.RemoteContentRepositoryImplandRemotePreferenceRepositoryImplinto more smaller implementation of each interface to ensure strict separation of concern, and isolating logic/implementationπΈ Screenshots / Video (μ€ν¬λ¦°μ· λλ λμμ)
π§ͺ Test Plan (ν μ€νΈ κ³ν)
β Checklist (체ν¬λ¦¬μ€νΈ)