Skip to content

Commit

Permalink
[Fix] kustaurant#98 깃 충돌 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
MinseoSONG committed Nov 14, 2024
1 parent c5de68d commit 502e63c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.kust.kustaurant.data.network

import android.content.Context
import android.content.Intent
import android.util.Log
import com.kust.kustaurant.data.getAccessToken
import com.kust.kustaurant.data.saveAccessToken
import com.kust.kustaurant.presentation.ui.splash.StartActivity
import okhttp3.Authenticator
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.OkHttpClient
Expand All @@ -24,6 +26,7 @@ class TokenAuthenticator(private val context: Context) : Authenticator {
.header("Authorization", "Bearer $newToken")
.build()
} else {
handleLogout()
null
}
}
Expand All @@ -49,4 +52,16 @@ class TokenAuthenticator(private val context: Context) : Authenticator {
}
return null
}

private fun handleLogout(){
context.getSharedPreferences("app_preferences", Context.MODE_PRIVATE).edit().clear().apply()

val intent = Intent(context, StartActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TOP
}

context.startActivity(intent)
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.2.0"
agp = "8.7.0"
flexbox = "3.0.0"
kotlin = "1.9.23"
coreKtx = "1.13.1"
Expand Down

0 comments on commit 502e63c

Please sign in to comment.