mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Idx -> Index
This commit is contained in:
committed by
Benoit Marty
parent
4297cfac24
commit
145cd410c7
@@ -91,8 +91,8 @@ class RootFlowNode @AssistedInject constructor(
|
|||||||
authenticationService.isLoggedIn()
|
authenticationService.isLoggedIn()
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.combine(
|
.combine(
|
||||||
authenticationService.cacheIdx().onEach {
|
authenticationService.cacheIndex().onEach {
|
||||||
Timber.v("cacheIdx=$it")
|
Timber.v("cacheIndex=$it")
|
||||||
matrixClientsHolder.removeAll()
|
matrixClientsHolder.removeAll()
|
||||||
}
|
}
|
||||||
) { isLoggedIn, cacheIdx -> isLoggedIn to cacheIdx }
|
) { isLoggedIn, cacheIdx -> isLoggedIn to cacheIdx }
|
||||||
@@ -243,9 +243,9 @@ class RootFlowNode @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun attachSession(sessionId: SessionId): LoggedInFlowNode {
|
private suspend fun attachSession(sessionId: SessionId): LoggedInFlowNode {
|
||||||
val cacheIdx = authenticationService.cacheIdx().first()
|
val cacheIndex = authenticationService.cacheIndex().first()
|
||||||
return attachChild {
|
return attachChild {
|
||||||
backstack.newRoot(NavTarget.LoggedInFlow(sessionId, cacheIdx))
|
backstack.newRoot(NavTarget.LoggedInFlow(sessionId, cacheIndex))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -57,6 +57,6 @@ class DefaultClearCacheUseCase @Inject constructor(
|
|||||||
// Clear app cache
|
// Clear app cache
|
||||||
context.cacheDir.deleteRecursively()
|
context.cacheDir.deleteRecursively()
|
||||||
// Ensure the app is restarted
|
// Ensure the app is restarted
|
||||||
authenticationService.incrementCacheIdx()
|
authenticationService.incrementCacheIndex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -33,8 +33,8 @@ interface MatrixAuthenticationService {
|
|||||||
* Cache index
|
* Cache index
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun cacheIdx(): Flow<Int>
|
fun cacheIndex(): Flow<Int>
|
||||||
fun incrementCacheIdx()
|
fun incrementCacheIndex()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OIDC part.
|
* OIDC part.
|
||||||
|
|||||||
+5
-5
@@ -58,7 +58,7 @@ class RustMatrixAuthenticationService @Inject constructor(
|
|||||||
private val clock: SystemClock,
|
private val clock: SystemClock,
|
||||||
) : MatrixAuthenticationService {
|
) : MatrixAuthenticationService {
|
||||||
|
|
||||||
private val cacheIdxState = MutableStateFlow(0)
|
private val cacheIndexState = MutableStateFlow(0)
|
||||||
|
|
||||||
private val authService: RustAuthenticationService = RustAuthenticationService(
|
private val authService: RustAuthenticationService = RustAuthenticationService(
|
||||||
basePath = baseDirectory.absolutePath,
|
basePath = baseDirectory.absolutePath,
|
||||||
@@ -73,12 +73,12 @@ class RustMatrixAuthenticationService @Inject constructor(
|
|||||||
return sessionStore.isLoggedIn()
|
return sessionStore.isLoggedIn()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun incrementCacheIdx() {
|
override fun incrementCacheIndex() {
|
||||||
cacheIdxState.value++
|
cacheIndexState.value++
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun cacheIdx(): Flow<Int> {
|
override fun cacheIndex(): Flow<Int> {
|
||||||
return cacheIdxState
|
return cacheIndexState
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getLatestSessionId(): SessionId? = withContext(coroutineDispatchers.io) {
|
override suspend fun getLatestSessionId(): SessionId? = withContext(coroutineDispatchers.io) {
|
||||||
|
|||||||
+5
-5
@@ -65,14 +65,14 @@ class FakeAuthenticationService : MatrixAuthenticationService {
|
|||||||
loginError?.let { Result.failure(it) } ?: Result.success(A_USER_ID)
|
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> {
|
override fun cacheIndex(): Flow<Int> {
|
||||||
return cacheIdxFlow
|
return cacheIndexFlow
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun incrementCacheIdx() {
|
override fun incrementCacheIndex() {
|
||||||
cacheIdxFlow.value++
|
cacheIndexFlow.value++
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getOidcUrl(): Result<OidcDetails> = simulateLongTask {
|
override suspend fun getOidcUrl(): Result<OidcDetails> = simulateLongTask {
|
||||||
|
|||||||
Reference in New Issue
Block a user