Skip to content

Commit b94925c

Browse files
committed
Remove unused getCacheSize File receiver.
The path are manager by the sessionData now.
1 parent 5afb048 commit b94925c

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ import org.matrix.rustcomponents.sdk.SyncService as ClientSyncService
120120

121121
class RustMatrixClient(
122122
private val innerClient: Client,
123-
private val baseDirectory: File,
124123
private val sessionStore: SessionStore,
125124
private val appCoroutineScope: CoroutineScope,
126125
private val sessionDelegate: RustClientSessionDelegate,
@@ -551,7 +550,7 @@ class RustMatrixClient(
551550
}
552551

553552
override suspend fun getCacheSize(): Long {
554-
return baseDirectory.getCacheSize()
553+
return getCacheSize(includeCryptoDb = false)
555554
}
556555

557556
override suspend fun clearCache() {
@@ -714,7 +713,7 @@ class RustMatrixClient(
714713
}
715714
}
716715

717-
private suspend fun File.getCacheSize(
716+
private suspend fun getCacheSize(
718717
includeCryptoDb: Boolean = false,
719718
): Long = withContext(sessionDispatcher) {
720719
val sessionDirectory = sessionPathsProvider.provides(sessionId) ?: return@withContext 0L

libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClientFactory.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package io.element.android.libraries.matrix.impl
99

1010
import dev.zacsweers.metro.Inject
1111
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
12-
import io.element.android.libraries.di.BaseDirectory
1312
import io.element.android.libraries.di.CacheDirectory
1413
import io.element.android.libraries.di.annotations.AppCoroutineScope
1514
import io.element.android.libraries.featureflag.api.FeatureFlagService
@@ -43,7 +42,6 @@ import java.io.File
4342

4443
@Inject
4544
class RustMatrixClientFactory(
46-
@BaseDirectory private val baseDirectory: File,
4745
@CacheDirectory private val cacheDirectory: File,
4846
@AppCoroutineScope
4947
private val appCoroutineScope: CoroutineScope,
@@ -87,7 +85,6 @@ class RustMatrixClientFactory(
8785

8886
return RustMatrixClient(
8987
innerClient = client,
90-
baseDirectory = baseDirectory,
9188
sessionStore = sessionStore,
9289
appCoroutineScope = appCoroutineScope,
9390
sessionDelegate = sessionDelegate,
@@ -136,13 +133,15 @@ class RustMatrixClientFactory(
136133
)
137134
.enableShareHistoryOnInvite(featureFlagService.isFeatureEnabled(FeatureFlags.EnableKeyShareOnInvite))
138135
.threadsEnabled(featureFlagService.isFeatureEnabled(FeatureFlags.Threads), threadSubscriptions = false)
139-
.requestConfig(RequestConfig(
140-
timeout = 30_000uL,
141-
retryLimit = 0u,
142-
// Use default values for the rest
143-
maxConcurrentRequests = null,
144-
maxRetryTime = null,
145-
))
136+
.requestConfig(
137+
RequestConfig(
138+
timeout = 30_000uL,
139+
retryLimit = 0u,
140+
// Use default values for the rest
141+
maxConcurrentRequests = null,
142+
maxRetryTime = null,
143+
)
144+
)
146145
.run {
147146
// Apply sliding sync version settings
148147
when (slidingSyncType) {

libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClientFactoryTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@ class RustMatrixClientFactoryTest {
3636
}
3737

3838
fun TestScope.createRustMatrixClientFactory(
39-
baseDirectory: File = File("/base"),
4039
cacheDirectory: File = File("/cache"),
4140
sessionStore: SessionStore = InMemorySessionStore(
4241
updateUserProfileResult = { _, _, _ -> },
4342
),
4443
clientBuilderProvider: ClientBuilderProvider = FakeClientBuilderProvider(),
4544
) = RustMatrixClientFactory(
46-
baseDirectory = baseDirectory,
4745
cacheDirectory = cacheDirectory,
4846
appCoroutineScope = backgroundScope,
4947
coroutineDispatchers = testCoroutineDispatchers(),

libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClientTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ class RustMatrixClientTest {
102102
),
103103
) = RustMatrixClient(
104104
innerClient = client,
105-
baseDirectory = File(""),
106105
sessionStore = sessionStore,
107106
appCoroutineScope = backgroundScope,
108107
sessionDelegate = aRustClientSessionDelegate(

libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationServiceTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class RustMatrixAuthenticationServiceTest {
5353
val baseDirectory = File("/base")
5454
val cacheDirectory = File("/cache")
5555
val rustMatrixClientFactory = createRustMatrixClientFactory(
56-
baseDirectory = baseDirectory,
5756
cacheDirectory = cacheDirectory,
5857
sessionStore = sessionStore,
5958
clientBuilderProvider = clientBuilderProvider,

0 commit comments

Comments
 (0)