Add global context.cacheDir provider. (#1606)
## Type of change - [ ] Feature - [ ] Bugfix - [x] Technical - [ ] Other : ## 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.
This commit is contained in:
parent
5a7f77bc92
commit
33f5c8efb8
5 changed files with 45 additions and 6 deletions
|
|
@ -16,9 +16,8 @@
|
|||
|
||||
package io.element.android.libraries.matrix.impl
|
||||
|
||||
import android.content.Context
|
||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import io.element.android.libraries.di.CacheDirectory
|
||||
import io.element.android.libraries.network.useragent.UserAgentProvider
|
||||
import io.element.android.libraries.sessionstorage.api.SessionData
|
||||
import io.element.android.libraries.sessionstorage.api.SessionStore
|
||||
|
|
@ -32,8 +31,8 @@ import java.io.File
|
|||
import javax.inject.Inject
|
||||
|
||||
class RustMatrixClientFactory @Inject constructor(
|
||||
@ApplicationContext private val context: Context,
|
||||
private val baseDirectory: File,
|
||||
@CacheDirectory private val cacheDirectory: File,
|
||||
private val appCoroutineScope: CoroutineScope,
|
||||
private val coroutineDispatchers: CoroutineDispatchers,
|
||||
private val sessionStore: SessionStore,
|
||||
|
|
@ -63,7 +62,7 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
appCoroutineScope = appCoroutineScope,
|
||||
dispatchers = coroutineDispatchers,
|
||||
baseDirectory = baseDirectory,
|
||||
baseCacheDirectory = context.cacheDir,
|
||||
baseCacheDirectory = cacheDirectory,
|
||||
clock = clock,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue