From b563b1ec950b3f44edd6b1f8216e3eee2f75d772 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 23 Jun 2023 15:20:19 +0200 Subject: [PATCH] `Idx` -> `Index` --- .../kotlin/io/element/android/appnav/RootFlowNode.kt | 8 ++++---- .../preferences/impl/tasks/ClearCacheUseCase.kt | 2 +- .../matrix/api/auth/MatrixAuthenticationService.kt | 4 ++-- .../impl/auth/RustMatrixAuthenticationService.kt | 10 +++++----- .../matrix/test/auth/FakeAuthenticationService.kt | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt index d8847b55b3..1a8118f95f 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt @@ -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)) } } } diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/tasks/ClearCacheUseCase.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/tasks/ClearCacheUseCase.kt index df70b6f148..68ed41babd 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/tasks/ClearCacheUseCase.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/tasks/ClearCacheUseCase.kt @@ -57,6 +57,6 @@ class DefaultClearCacheUseCase @Inject constructor( // Clear app cache context.cacheDir.deleteRecursively() // Ensure the app is restarted - authenticationService.incrementCacheIdx() + authenticationService.incrementCacheIndex() } } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/MatrixAuthenticationService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/MatrixAuthenticationService.kt index 8d63642eae..d1e2362da6 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/MatrixAuthenticationService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/MatrixAuthenticationService.kt @@ -33,8 +33,8 @@ interface MatrixAuthenticationService { * Cache index */ - fun cacheIdx(): Flow - fun incrementCacheIdx() + fun cacheIndex(): Flow + fun incrementCacheIndex() /* * OIDC part. diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt index 2e3c406348..ac239d83c1 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt @@ -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 { - return cacheIdxState + override fun cacheIndex(): Flow { + return cacheIndexState } override suspend fun getLatestSessionId(): SessionId? = withContext(coroutineDispatchers.io) { diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeAuthenticationService.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeAuthenticationService.kt index 95bb077252..b40dd766ff 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeAuthenticationService.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeAuthenticationService.kt @@ -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 { - return cacheIdxFlow + override fun cacheIndex(): Flow { + return cacheIndexFlow } - override fun incrementCacheIdx() { - cacheIdxFlow.value++ + override fun incrementCacheIndex() { + cacheIndexFlow.value++ } override suspend fun getOidcUrl(): Result = simulateLongTask {