Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Team-Wable/WABLE-ANDROID
Browse files Browse the repository at this point in the history
…into hotfix/#94-team-tag
  • Loading branch information
sohyun127 committed Oct 11, 2024
2 parents 76c91a4 + f16ab43 commit 9c37662
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
1 change: 0 additions & 1 deletion core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ dependencies {
implementation(project(":core:model"))
implementation(project(":core:datastore"))
implementation(libs.paging)
implementation(libs.process.phoenix)
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
package com.teamwable.network

import android.app.Application
import android.content.Intent
import android.widget.Toast
import com.jakewharton.processphoenix.ProcessPhoenix
import com.teamwable.datastore.datasource.DefaultWablePreferenceDatasource
import com.teamwable.network.datasource.AuthService
import com.teamwable.network.util.UNKNOWN_ERROR_MESSAGE
import com.teamwable.network.util.toCustomError
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
import okhttp3.Interceptor
import okhttp3.Request
import okhttp3.Response
Expand Down Expand Up @@ -68,19 +65,22 @@ class TokenInterceptor @Inject constructor(
false -> false
}
} catch (e: Exception) {
val errorMessage = e.toCustomError().message ?: UNKNOWN_ERROR_MESSAGE
Toast.makeText(context, errorMessage, Toast.LENGTH_SHORT).show()
false
}
}
}

private fun handleFailedTokenReissue() {
private fun handleFailedTokenReissue() = with(context) {
CoroutineScope(Dispatchers.Main).launch {
withContext(Dispatchers.IO) {
defaultWablePreferenceDatasource.clear()
}
ProcessPhoenix.triggerRebirth(context)
defaultWablePreferenceDatasource.clear()
startActivity(
Intent.makeRestartActivityTask(
packageManager.getLaunchIntentForPackage(packageName)?.component,
).apply {
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
},
)
Toast.makeText(context, "재 로그인이 필요해요", Toast.LENGTH_SHORT).show()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ import kotlinx.serialization.Serializable
data class ResponseReissueTokenDto(
@SerialName("accessToken")
val accessToken: String,
@SerialName("refreshToken")
val refreshToken: String,
)
1 change: 0 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ lottie-compose = { group = "com.airbnb.android", name = "lottie-compose", versio
amplitude = { module = "com.amplitude:analytics-android", version.ref = "amplitude" }
amplitude-ads = { module = "com.google.android.gms:play-services-ads-identifier", version.ref = "amplitude-ads" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
process-phoenix = { group = "com.jakewharton", name = "process-phoenix", version.ref = "processPhoenix" }

## Compose
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" }
Expand Down

0 comments on commit 9c37662

Please sign in to comment.