Refactor: Decouple DataStore from Settings Module#476
Refactor: Decouple DataStore from Settings Module#476
Conversation
Extracted Proto DataStore implementation into a new :data:settings-datastore module. This improves modularity and separation of concerns by isolating the persistence layer. :data:settings now solely defines interfaces and handles constraints.
Summary of ChangesHello @Kimblebee, 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 refactors the application's settings management by extracting the Proto DataStore implementation into a dedicated Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The refactoring to decouple DataStore from the Settings module is a positive architectural improvement. However, several issues were identified during the review, including package name inconsistencies in the new module, missing test coverage for proto conversions that were deleted, and some deviations from the project's dependency management and Java version standards. Addressing these will ensure the new module is robust and maintainable.
I am having trouble creating individual review comments. Click here to see my feedback.
data/settings/src/test/java/com/google/jetpackcamera/settings/ProtoConversionTest.kt (1-110)
This test file was deleted, but the conversion logic it verified (mapping between Protos and Models) is still present in LocalSettingsRepository.kt. These tests should be moved to the new :data:settings-datastore module to maintain coverage.
data/settings-datastore/build.gradle.kts (25)
Avoid hardcoding the compileSdk version. Use the version catalog (libs.toml) to maintain consistency across the project.
compileSdk = libs.versions.compileSdk.get().toInt()data/settings-datastore/build.gradle.kts (28)
Avoid hardcoding the minSdk version. Use the version catalog (libs.toml) to maintain consistency across the project.
minSdk = libs.versions.minSdk.get().toInt()data/settings-datastore/build.gradle.kts (44-48)
The project appears to be using Java 17 (as seen in other modules). This new module should align with that standard instead of using Java 11.
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}data/settings-datastore/build.gradle.kts (54-55)
These UI-related dependencies (appcompat and material) seem unnecessary for a data module focused on DataStore persistence. Consider removing them to keep the module lightweight.
data/settings-datastore/build.gradle.kts (81)
Avoid hardcoding the protobuf version. This should be managed via the version catalog (libs.toml).
data/settings-datastore/src/main/java/com/google/jetpackcamera/data/settingsdatastore/SettingsModule.kt (32)
The SettingsRepository binding should typically be a @Singleton to ensure a single instance is used throughout the application, consistent with how the DataStore itself is provided.
@Binds
@Singleton
fun bindsSettingsRepository(
Extracted Proto DataStore implementation into a new
:data:settings-datastoremodule. This improves modularity and separation of concerns by isolating the persistence layer.:data:settingsnow solely defines interfaces and handles constraints.