-
Notifications
You must be signed in to change notification settings - Fork 0
π :: (#418) μ 체 μμΈ μ²λ¦¬ #423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "feature/418-\uC804\uCCB4-\uC608\uC678-\uCC98\uB9AC"
Changes from all commits
56d274a
b0e61a1
6209b0e
489c421
46f94a8
d06bf72
d6b72ee
e2f3af9
ff313eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,52 @@ | ||
| package team.retum.jobisandroidv2 | ||
|
|
||
| import android.app.Application | ||
| import android.content.Intent | ||
| import android.widget.Toast | ||
| import com.google.firebase.Firebase | ||
| import com.google.firebase.crashlytics.crashlytics | ||
| import dagger.hilt.android.HiltAndroidApp | ||
| import team.retum.common.exception.ConnectionTimeOutException | ||
| import team.retum.common.exception.OfflineException | ||
| import team.retum.common.exception.ReissueException | ||
| import team.retum.common.exception.UnknownException | ||
| import kotlin.system.exitProcess | ||
|
|
||
| private const val InternetErrorMsg = "μΈν°λ· μ°κ²°μ νμΈν΄μ£ΌμΈμ." | ||
| private const val TimeoutErrorMsg = "μμ² μκ°μ΄ μ΄κ³Όλμμ΅λλ€.\nλ€μ μλν΄μ£ΌμΈμ." | ||
| private const val LoginErrorMsg = "μ μ μ λ³΄κ° νμΈλμ§ μμ΅λλ€.\nλ€μ λ‘κ·ΈμΈ ν΄μ£ΌμΈμ." | ||
| private const val UnknownErrorMsg = "μ²λ¦¬ μ€ λ¬Έμ κ° λ°μνμ΅λλ€." | ||
|
|
||
| @HiltAndroidApp | ||
| class JobisApplication : Application() | ||
| class JobisApplication : Application() { | ||
| override fun onCreate() { | ||
| super.onCreate() | ||
|
|
||
| Thread.setDefaultUncaughtExceptionHandler { _, e -> | ||
| Firebase.crashlytics.recordException(e) | ||
|
|
||
| when (e) { | ||
| is OfflineException -> makeToast(InternetErrorMsg) | ||
| is ConnectionTimeOutException -> makeToast(TimeoutErrorMsg) | ||
| is ReissueException -> makeToast(LoginErrorMsg) | ||
| is UnknownException -> makeToast(UnknownErrorMsg) | ||
| else -> makeToast(UnknownErrorMsg) | ||
| } | ||
|
|
||
| val intent = this.packageManager.getLaunchIntentForPackage(this.packageName) | ||
| if (intent != null) { | ||
| intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK) | ||
| this.startActivity(intent) | ||
| exitProcess(0) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private fun makeToast(message: String) { | ||
| Toast.makeText( | ||
| this, | ||
| message, | ||
| Toast.LENGTH_SHORT, | ||
| ).show() | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import okhttp3.logging.HttpLoggingInterceptor | |
| import retrofit2.Retrofit | ||
| import retrofit2.converter.moshi.MoshiConverterFactory | ||
| import team.retum.common.enums.PlatformType | ||
| import team.retum.common.exception.ReissueException | ||
| import team.retum.network.BuildConfig | ||
| import team.retum.network.api.AuthApi | ||
| import team.retum.network.model.response.TokenResponse | ||
|
|
@@ -40,7 +41,7 @@ object RefreshTokenService { | |
| }.onSuccess { token -> | ||
| return token | ||
| }.onFailure { | ||
| throw IllegalStateException("Fail refresh: ${it.message}") | ||
| throw ReissueException | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion μμΈ μ²λ¦¬λ₯Ό κ°μ ν΄ μ£ΌμΈμ. νμ¬ κ΅¬νμ μλ λ°μν μμΈμ μ 보λ₯Ό λͺ¨λ μμ΄λ²λ¦½λλ€. λλ²κΉ κ³Ό λ¬Έμ ν΄κ²°μ μν΄ λ€μκ³Ό κ°μ κ°μ μ μ μν©λλ€:
λ€μκ³Ό κ°μ΄ μμ νλ κ²μ μΆμ²λ립λλ€: - throw ReissueException
+ throw ReissueException("ν ν° κ°±μ μ€ μ€λ₯κ° λ°μνμ΅λλ€", it)λν λ‘κΉ κ΅¬νμ μν΄ Timberλ λ€λ₯Έ λ‘κΉ λΌμ΄λΈλ¬λ¦¬λ₯Ό μ¬μ©νλ κ²μ κ³ λ €ν΄λ³΄μΈμ.
|
||
| }.getOrThrow() | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
λ¬Έμμ΄ λ¦¬μμ€ κ΄λ¦¬ κ°μ μ΄ νμν©λλ€.
νλμ½λ©λ μλ¬ λ©μμ§λ₯Ό
res/values/strings.xmlλ‘ μ΄λνλ κ²μ΄ μ’μ΅λλ€. μ΄λ κ² νλ©΄:λ€μκ³Ό κ°μ΄ λ³κ²½νλ κ²μ μ μλ립λλ€:
strings.xmlμ μΆκ°: