-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add global context.cacheDir
provider.
#1606
Conversation
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, thanks!
|
||
import javax.inject.Qualifier | ||
|
||
@Qualifier annotation class CacheDir |
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.
FTR this is what we had in EA: https://github.com/vector-im/element-android/blob/develop/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/di/FileQualifiers.kt#L31
@Qualifier
@Retention(AnnotationRetention.RUNTIME)
internal annotation class CacheDirectory
Maybe use the same name CacheDirectory
. Also @Retention
default value is AnnotationRetention.RUNTIME
, so I think it's fine not to include it, but maybe @ganfra can confirm this?
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.
I just copied whatever we already had from @ApplicationContext
.
As per the naming: I found it more "mnemonic" to have @CacheDir private val cacheDir: File
and know that it will point to context.cacheDir
.
But I'm open to better suggeestions.
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.
OK, it's fine. The PR is approved, you can merge it :)
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #1606 +/- ##
===========================================
- Coverage 58.96% 58.96% -0.01%
===========================================
Files 1199 1199
Lines 30965 30966 +1
Branches 6343 6343
===========================================
Hits 18259 18259
- Misses 9959 9960 +1
Partials 2747 2747
☔ View full report in Codecov by Sentry. |
Renamed it and added docs to all existing qualifiers. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Type of change
Content
Dagger now provides the app's
cacheDir
when requesting a@CacheDirectory File
type.Motivation and context
To support some upcoming code that needs the
cacheDir
to be changed during tests.