Remove unused getCacheSize File receiver.
The path are manager by the sessionData now.
This commit is contained in:
parent
40e3ba8d56
commit
7454819d74
5 changed files with 11 additions and 17 deletions
|
|
@ -120,7 +120,6 @@ import org.matrix.rustcomponents.sdk.SyncService as ClientSyncService
|
||||||
|
|
||||||
class RustMatrixClient(
|
class RustMatrixClient(
|
||||||
private val innerClient: Client,
|
private val innerClient: Client,
|
||||||
private val baseDirectory: File,
|
|
||||||
private val sessionStore: SessionStore,
|
private val sessionStore: SessionStore,
|
||||||
private val appCoroutineScope: CoroutineScope,
|
private val appCoroutineScope: CoroutineScope,
|
||||||
private val sessionDelegate: RustClientSessionDelegate,
|
private val sessionDelegate: RustClientSessionDelegate,
|
||||||
|
|
@ -551,7 +550,7 @@ class RustMatrixClient(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getCacheSize(): Long {
|
override suspend fun getCacheSize(): Long {
|
||||||
return baseDirectory.getCacheSize()
|
return getCacheSize(includeCryptoDb = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun clearCache() {
|
override suspend fun clearCache() {
|
||||||
|
|
@ -714,7 +713,7 @@ class RustMatrixClient(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun File.getCacheSize(
|
private suspend fun getCacheSize(
|
||||||
includeCryptoDb: Boolean = false,
|
includeCryptoDb: Boolean = false,
|
||||||
): Long = withContext(sessionDispatcher) {
|
): Long = withContext(sessionDispatcher) {
|
||||||
val sessionDirectory = sessionPathsProvider.provides(sessionId) ?: return@withContext 0L
|
val sessionDirectory = sessionPathsProvider.provides(sessionId) ?: return@withContext 0L
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ package io.element.android.libraries.matrix.impl
|
||||||
|
|
||||||
import dev.zacsweers.metro.Inject
|
import dev.zacsweers.metro.Inject
|
||||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||||
import io.element.android.libraries.di.BaseDirectory
|
|
||||||
import io.element.android.libraries.di.CacheDirectory
|
import io.element.android.libraries.di.CacheDirectory
|
||||||
import io.element.android.libraries.di.annotations.AppCoroutineScope
|
import io.element.android.libraries.di.annotations.AppCoroutineScope
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
||||||
|
|
@ -43,7 +42,6 @@ import java.io.File
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
class RustMatrixClientFactory(
|
class RustMatrixClientFactory(
|
||||||
@BaseDirectory private val baseDirectory: File,
|
|
||||||
@CacheDirectory private val cacheDirectory: File,
|
@CacheDirectory private val cacheDirectory: File,
|
||||||
@AppCoroutineScope
|
@AppCoroutineScope
|
||||||
private val appCoroutineScope: CoroutineScope,
|
private val appCoroutineScope: CoroutineScope,
|
||||||
|
|
@ -87,7 +85,6 @@ class RustMatrixClientFactory(
|
||||||
|
|
||||||
return RustMatrixClient(
|
return RustMatrixClient(
|
||||||
innerClient = client,
|
innerClient = client,
|
||||||
baseDirectory = baseDirectory,
|
|
||||||
sessionStore = sessionStore,
|
sessionStore = sessionStore,
|
||||||
appCoroutineScope = appCoroutineScope,
|
appCoroutineScope = appCoroutineScope,
|
||||||
sessionDelegate = sessionDelegate,
|
sessionDelegate = sessionDelegate,
|
||||||
|
|
@ -136,13 +133,15 @@ class RustMatrixClientFactory(
|
||||||
)
|
)
|
||||||
.enableShareHistoryOnInvite(featureFlagService.isFeatureEnabled(FeatureFlags.EnableKeyShareOnInvite))
|
.enableShareHistoryOnInvite(featureFlagService.isFeatureEnabled(FeatureFlags.EnableKeyShareOnInvite))
|
||||||
.threadsEnabled(featureFlagService.isFeatureEnabled(FeatureFlags.Threads), threadSubscriptions = false)
|
.threadsEnabled(featureFlagService.isFeatureEnabled(FeatureFlags.Threads), threadSubscriptions = false)
|
||||||
.requestConfig(RequestConfig(
|
.requestConfig(
|
||||||
timeout = 30_000uL,
|
RequestConfig(
|
||||||
retryLimit = 0u,
|
timeout = 30_000uL,
|
||||||
// Use default values for the rest
|
retryLimit = 0u,
|
||||||
maxConcurrentRequests = null,
|
// Use default values for the rest
|
||||||
maxRetryTime = null,
|
maxConcurrentRequests = null,
|
||||||
))
|
maxRetryTime = null,
|
||||||
|
)
|
||||||
|
)
|
||||||
.run {
|
.run {
|
||||||
// Apply sliding sync version settings
|
// Apply sliding sync version settings
|
||||||
when (slidingSyncType) {
|
when (slidingSyncType) {
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,12 @@ class RustMatrixClientFactoryTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun TestScope.createRustMatrixClientFactory(
|
fun TestScope.createRustMatrixClientFactory(
|
||||||
baseDirectory: File = File("/base"),
|
|
||||||
cacheDirectory: File = File("/cache"),
|
cacheDirectory: File = File("/cache"),
|
||||||
sessionStore: SessionStore = InMemorySessionStore(
|
sessionStore: SessionStore = InMemorySessionStore(
|
||||||
updateUserProfileResult = { _, _, _ -> },
|
updateUserProfileResult = { _, _, _ -> },
|
||||||
),
|
),
|
||||||
clientBuilderProvider: ClientBuilderProvider = FakeClientBuilderProvider(),
|
clientBuilderProvider: ClientBuilderProvider = FakeClientBuilderProvider(),
|
||||||
) = RustMatrixClientFactory(
|
) = RustMatrixClientFactory(
|
||||||
baseDirectory = baseDirectory,
|
|
||||||
cacheDirectory = cacheDirectory,
|
cacheDirectory = cacheDirectory,
|
||||||
appCoroutineScope = backgroundScope,
|
appCoroutineScope = backgroundScope,
|
||||||
coroutineDispatchers = testCoroutineDispatchers(),
|
coroutineDispatchers = testCoroutineDispatchers(),
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@ class RustMatrixClientTest {
|
||||||
),
|
),
|
||||||
) = RustMatrixClient(
|
) = RustMatrixClient(
|
||||||
innerClient = client,
|
innerClient = client,
|
||||||
baseDirectory = File(""),
|
|
||||||
sessionStore = sessionStore,
|
sessionStore = sessionStore,
|
||||||
appCoroutineScope = backgroundScope,
|
appCoroutineScope = backgroundScope,
|
||||||
sessionDelegate = aRustClientSessionDelegate(
|
sessionDelegate = aRustClientSessionDelegate(
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ class RustMatrixAuthenticationServiceTest {
|
||||||
val baseDirectory = File("/base")
|
val baseDirectory = File("/base")
|
||||||
val cacheDirectory = File("/cache")
|
val cacheDirectory = File("/cache")
|
||||||
val rustMatrixClientFactory = createRustMatrixClientFactory(
|
val rustMatrixClientFactory = createRustMatrixClientFactory(
|
||||||
baseDirectory = baseDirectory,
|
|
||||||
cacheDirectory = cacheDirectory,
|
cacheDirectory = cacheDirectory,
|
||||||
sessionStore = sessionStore,
|
sessionStore = sessionStore,
|
||||||
clientBuilderProvider = clientBuilderProvider,
|
clientBuilderProvider = clientBuilderProvider,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue