Idx -> Index
This commit is contained in:
committed by
Benoit Marty
parent
fc61d452c6
commit
b563b1ec95
@@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ class DefaultClearCacheUseCase @Inject constructor(
|
||||
// Clear app cache
|
||||
context.cacheDir.deleteRecursively()
|
||||
// Ensure the app is restarted
|
||||
authenticationService.incrementCacheIdx()
|
||||
authenticationService.incrementCacheIndex()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ interface MatrixAuthenticationService {
|
||||
* Cache index
|
||||
*/
|
||||
|
||||
fun cacheIdx(): Flow<Int>
|
||||
fun incrementCacheIdx()
|
||||
fun cacheIndex(): Flow<Int>
|
||||
fun incrementCacheIndex()
|
||||
|
||||
/*
|
||||
* OIDC part.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user