Skip to content

Commit fa29ccd

Browse files
authored
[MERGE] #400 -> develop
[FEAT/#400] 429 μƒνƒœ μ½”λ“œ λŒ€μ‘
2 parents 6e95235 + 5a028be commit fa29ccd

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

β€Žcore/network/src/main/java/com/terning/core/network/AuthInterceptor.ktβ€Ž

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,11 @@ class AuthInterceptor @Inject constructor(
5858
Timber.d(t.message)
5959
}
6060

61-
terningDataStore.clearInfo()
61+
restartApp(MESSAGE_TOKEN_EXPIRED)
62+
}
6263

63-
Handler(Looper.getMainLooper()).post {
64-
Toast.makeText(context, TOKEN_EXPIRED_ERROR, Toast.LENGTH_LONG).show()
65-
ProcessPhoenix.triggerRebirth(context)
66-
}
64+
CODE_MANY_REQUESTS -> {
65+
restartApp(MESSAGE_TOO_MANY_REQUESTS)
6766
}
6867
}
6968
return response
@@ -72,9 +71,20 @@ class AuthInterceptor @Inject constructor(
7271
private fun Request.Builder.newAuthBuilder() =
7372
this.addHeader(AUTHORIZATION, "$BEARER ${terningDataStore.accessToken}")
7473

74+
private fun restartApp(message: String) {
75+
terningDataStore.clearInfo()
76+
77+
Handler(Looper.getMainLooper()).post {
78+
Toast.makeText(context, message, Toast.LENGTH_LONG).show()
79+
ProcessPhoenix.triggerRebirth(context)
80+
}
81+
}
82+
7583
companion object {
7684
private const val CODE_TOKEN_EXPIRED = 401
77-
private const val TOKEN_EXPIRED_ERROR = "토큰이 λ§Œλ£Œλ˜μ—ˆμ–΄μš”\nλ‹€μ‹œ 둜그인 ν•΄μ£Όμ„Έμš”"
85+
private const val CODE_MANY_REQUESTS = 429
86+
private const val MESSAGE_TOKEN_EXPIRED = "토큰이 λ§Œλ£Œλ˜μ—ˆμ–΄μš”\nλ‹€μ‹œ 둜그인 ν•΄μ£Όμ„Έμš”"
87+
private const val MESSAGE_TOO_MANY_REQUESTS = "μš”μ²­ νšŸμˆ˜κ°€ λ„ˆλ¬΄ λ§Žμ•„μš”\n둜그인 ν›„ λ‹€μ‹œ μ‹œλ„ν•΄ μ£Όμ„Έμš”"
7888
private const val BEARER = "Bearer"
7989
private const val AUTHORIZATION = "Authorization"
8090
}

β€Žgradle/libs.versions.tomlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
compileSdk = "35"
33
minSdk = "28"
44
targetSdk = "35"
5-
versionName = "1.3.5"
6-
versionCode = "103050"
5+
versionName = "1.3.6"
6+
versionCode = "103060"
77
jvmTarget = "1.8"
88

99
## Android gradle plugin

0 commit comments

Comments
Β (0)