Move cache management to a dedicated class and in the setting module, for clarity.

This commit is contained in:
Benoit Marty 2023-06-23 15:38:04 +02:00 committed by Benoit Marty
parent cc1c3c8f7b
commit b6920afb7f
7 changed files with 74 additions and 32 deletions

View file

@ -58,8 +58,6 @@ class RustMatrixAuthenticationService @Inject constructor(
private val clock: SystemClock,
) : MatrixAuthenticationService {
private val cacheIndexState = MutableStateFlow(0)
private val authService: RustAuthenticationService = RustAuthenticationService(
basePath = baseDirectory.absolutePath,
passphrase = null,
@ -73,14 +71,6 @@ class RustMatrixAuthenticationService @Inject constructor(
return sessionStore.isLoggedIn()
}
override fun incrementCacheIndex() {
cacheIndexState.value++
}
override fun cacheIndex(): Flow<Int> {
return cacheIndexState
}
override suspend fun getLatestSessionId(): SessionId? = withContext(coroutineDispatchers.io) {
sessionStore.getLatestSession()?.userId?.let { SessionId(it) }
}