-
Notifications
You must be signed in to change notification settings - Fork 499
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
Fix #3322: Platform parameter singleton and Generic Interface #3323
Fix #3322: Platform parameter singleton and Generic Interface #3323
Conversation
…Platform Parameter project in Oppia-Android. This PR will is reffered as PR-1.1 in the Milestones
… the oneof type field in ParameterWithName
…latformParameterMap
3344b17
to
5557775
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job with the tests! A couple things
- Try to further split up test cases so that they're only checking on thing at a time. I like to think of it as if we want to minimize the number of assertions in a test so each test can be as specific as possible.
- I see that protos are included in this PR -- be sure to list only the newly-changed in the PR description in case reviewers are different.
- Be sure to build & test with both Gradle & Bazel to help speedup the review process. I also forget this sometimes :)
domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingleton.kt
Outdated
Show resolved
Hide resolved
domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingleton.kt
Outdated
Show resolved
Hide resolved
domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingleton.kt
Outdated
Show resolved
Hide resolved
...n/src/test/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonTest.kt
Outdated
Show resolved
Hide resolved
...n/src/test/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonTest.kt
Outdated
Show resolved
Hide resolved
...n/src/test/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonTest.kt
Outdated
Show resolved
Hide resolved
...n/src/test/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonTest.kt
Outdated
Show resolved
Hide resolved
...n/src/test/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonTest.kt
Outdated
Show resolved
Hide resolved
utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameter.kt
Outdated
Show resolved
Hide resolved
Unassigning @jcqli since the review is done. |
5557775
to
a9cbdb3
Compare
a9cbdb3
to
d9f5111
Compare
…and its Impl. Also changed the tests accordingly
Note that tests are failing |
@vinitamurthi that test is failing due to some env reading error not because of the code changes |
|
||
/** | ||
* Initializes a platformParameterMap in case it is empty. | ||
* @param platformParameterMap [Map<String, PlatformParameter>] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add newline above KDoc @
fields (but each @
line should be next to each other).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just be sure to update the KDocs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved for codeowners (BUILD file changes). Left one unrelated comment for one thing I noticed.
/** Singleton which helps in storing and providing Platform Parameters at runtime. */ | ||
@Singleton | ||
class PlatformParameterSingletonImpl @Inject constructor() : PlatformParameterSingleton { | ||
private var platformParameterMap: Map<String, PlatformParameter> = mapOf() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a val with a mutable list, instead, where you clear & perform a putAll
to reinitialize it versus changing the parameter itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Hi @Arjupta, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks! |
…ED on #3323] (#3361) * Cumulative Changes from PR-1.1(#3269) and 1.2(#3323) * Introduced a new Dagger Module to provide Platform Parameters. Also a PlatformParameter Constants file to store any constants related to Platform Parameters * Nit changes * Added a FakePlatformParameterModule and a PlatformParameterModuleTest * Included a Fake Singleton approach for testing DaggerModule * Lint check + updating with base PR * Reverting .idea file * Rename functions and constants, Added new Testcases for different data type PlatformParameter * Nit KDoc changes * Changing the Testing approach + Updating with Base PR * Nit changes + New Test Case for Partial Map * Changed the location of TestSpecific constants to Fake Module * Renaming functions and removing redundant references
Explanation
Fixes #3322
This PR introduces a new domain layer Singleton class which will help with storing and providing platform parameter values. This PR also includes a Generic Interface whose implementations will be provided containing Platform Parameters. (This PR is stacked over #3269). /cc @Sarthak2601
Checklist