From ae1a4a8d23d3a2933e81c86675379d5e850f3f5b Mon Sep 17 00:00:00 2001 From: Ray Jang Date: Wed, 21 Feb 2024 01:43:32 +0900 Subject: [PATCH] =?UTF-8?q?[System]=20TokenRepository,=20TokenApi=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/kotlin/ac/dnd/mour/android/MourApplication.kt | 1 + .../repository/authentication/token/MockTokenRepository.kt | 4 ++++ .../repository/authentication/token/RealTokenRepository.kt | 4 ++++ .../ac/dnd/mour/android/domain/repository/TokenRepository.kt | 2 ++ 4 files changed, 11 insertions(+) diff --git a/app/src/main/kotlin/ac/dnd/mour/android/MourApplication.kt b/app/src/main/kotlin/ac/dnd/mour/android/MourApplication.kt index 1ba38033..aa9f9ce0 100644 --- a/app/src/main/kotlin/ac/dnd/mour/android/MourApplication.kt +++ b/app/src/main/kotlin/ac/dnd/mour/android/MourApplication.kt @@ -94,6 +94,7 @@ open class MourApplication : Application() { Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK } startActivity(intent) + tokenRepository.resetRefreshTokenInvalidFlag() } } } diff --git a/data/src/main/kotlin/ac/dnd/mour/android/data/repository/authentication/token/MockTokenRepository.kt b/data/src/main/kotlin/ac/dnd/mour/android/data/repository/authentication/token/MockTokenRepository.kt index 618e0f39..4b10bbca 100644 --- a/data/src/main/kotlin/ac/dnd/mour/android/data/repository/authentication/token/MockTokenRepository.kt +++ b/data/src/main/kotlin/ac/dnd/mour/android/data/repository/authentication/token/MockTokenRepository.kt @@ -36,6 +36,10 @@ class MockTokenRepository @Inject constructor( ) } + override suspend fun resetRefreshTokenInvalidFlag() { + _isRefreshTokenInvalid.value = false + } + private suspend fun randomShortDelay() { delay(LongRange(100, 500).random()) } diff --git a/data/src/main/kotlin/ac/dnd/mour/android/data/repository/authentication/token/RealTokenRepository.kt b/data/src/main/kotlin/ac/dnd/mour/android/data/repository/authentication/token/RealTokenRepository.kt index c003b0a4..eb583ef2 100644 --- a/data/src/main/kotlin/ac/dnd/mour/android/data/repository/authentication/token/RealTokenRepository.kt +++ b/data/src/main/kotlin/ac/dnd/mour/android/data/repository/authentication/token/RealTokenRepository.kt @@ -44,6 +44,10 @@ class RealTokenRepository @Inject constructor( } } + override suspend fun resetRefreshTokenInvalidFlag() { + _isRefreshTokenInvalid.value = false + } + companion object { private const val REFRESH_TOKEN = "refresh_token" private const val ACCESS_TOKEN = "access_token" diff --git a/domain/src/main/kotlin/ac/dnd/mour/android/domain/repository/TokenRepository.kt b/domain/src/main/kotlin/ac/dnd/mour/android/domain/repository/TokenRepository.kt index dab0ef32..26261318 100644 --- a/domain/src/main/kotlin/ac/dnd/mour/android/domain/repository/TokenRepository.kt +++ b/domain/src/main/kotlin/ac/dnd/mour/android/domain/repository/TokenRepository.kt @@ -14,4 +14,6 @@ interface TokenRepository { suspend fun refreshToken( refreshToken: String ): Result + + suspend fun resetRefreshTokenInvalidFlag() }