Idx -> Index

This commit is contained in:
Benoit Marty
2023-06-23 15:20:19 +02:00
committed by Benoit Marty
parent fc61d452c6
commit b563b1ec95
5 changed files with 17 additions and 17 deletions

View File

@@ -91,8 +91,8 @@ class RootFlowNode @AssistedInject constructor(
authenticationService.isLoggedIn()
.distinctUntilChanged()
.combine(
authenticationService.cacheIdx().onEach {
Timber.v("cacheIdx=$it")
authenticationService.cacheIndex().onEach {
Timber.v("cacheIndex=$it")
matrixClientsHolder.removeAll()
}
) { isLoggedIn, cacheIdx -> isLoggedIn to cacheIdx }
@@ -243,9 +243,9 @@ class RootFlowNode @AssistedInject constructor(
}
private suspend fun attachSession(sessionId: SessionId): LoggedInFlowNode {
val cacheIdx = authenticationService.cacheIdx().first()
val cacheIndex = authenticationService.cacheIndex().first()
return attachChild {
backstack.newRoot(NavTarget.LoggedInFlow(sessionId, cacheIdx))
backstack.newRoot(NavTarget.LoggedInFlow(sessionId, cacheIndex))
}
}
}

View File

@@ -57,6 +57,6 @@ class DefaultClearCacheUseCase @Inject constructor(
// Clear app cache
context.cacheDir.deleteRecursively()
// Ensure the app is restarted
authenticationService.incrementCacheIdx()
authenticationService.incrementCacheIndex()
}
}

View File

@@ -33,8 +33,8 @@ interface MatrixAuthenticationService {
* Cache index
*/
fun cacheIdx(): Flow<Int>
fun incrementCacheIdx()
fun cacheIndex(): Flow<Int>
fun incrementCacheIndex()
/*
* OIDC part.

View File

@@ -58,7 +58,7 @@ class RustMatrixAuthenticationService @Inject constructor(
private val clock: SystemClock,
) : MatrixAuthenticationService {
private val cacheIdxState = MutableStateFlow(0)
private val cacheIndexState = MutableStateFlow(0)
private val authService: RustAuthenticationService = RustAuthenticationService(
basePath = baseDirectory.absolutePath,
@@ -73,12 +73,12 @@ class RustMatrixAuthenticationService @Inject constructor(
return sessionStore.isLoggedIn()
}
override fun incrementCacheIdx() {
cacheIdxState.value++
override fun incrementCacheIndex() {
cacheIndexState.value++
}
override fun cacheIdx(): Flow<Int> {
return cacheIdxState
override fun cacheIndex(): Flow<Int> {
return cacheIndexState
}
override suspend fun getLatestSessionId(): SessionId? = withContext(coroutineDispatchers.io) {

View File

@@ -65,14 +65,14 @@ class FakeAuthenticationService : MatrixAuthenticationService {
loginError?.let { Result.failure(it) } ?: Result.success(A_USER_ID)
}
private val cacheIdxFlow = MutableStateFlow(0)
private val cacheIndexFlow = MutableStateFlow(0)
override fun cacheIdx(): Flow<Int> {
return cacheIdxFlow
override fun cacheIndex(): Flow<Int> {
return cacheIndexFlow
}
override fun incrementCacheIdx() {
cacheIdxFlow.value++
override fun incrementCacheIndex() {
cacheIndexFlow.value++
}
override suspend fun getOidcUrl(): Result<OidcDetails> = simulateLongTask {