From ab96f498fda68ee48114ff118482efa8552f3f80 Mon Sep 17 00:00:00 2001 From: stellar-halo Date: Thu, 14 Mar 2024 12:57:48 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=EB=8B=A4=EB=A5=B8=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=A1=9C=20=ED=95=A0=EB=8B=B9=ED=95=B4=EC=84=9C=20=EB=8D=AE?= =?UTF-8?q?=EC=96=B4=EC=93=B0=EC=A7=80=20=EC=95=8A=EA=B3=A0=20=EC=83=88?= =?UTF-8?q?=EB=A1=9C=20=EB=B0=98=ED=99=98=ED=95=98=EA=B8=B0,=20try-catch?= =?UTF-8?q?=EB=AC=B8=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/sopetit/softie/di/RetrofitModule.kt | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/sopetit/softie/di/RetrofitModule.kt b/app/src/main/java/com/sopetit/softie/di/RetrofitModule.kt index bddd6ade..69577af3 100644 --- a/app/src/main/java/com/sopetit/softie/di/RetrofitModule.kt +++ b/app/src/main/java/com/sopetit/softie/di/RetrofitModule.kt @@ -15,6 +15,7 @@ import okhttp3.MediaType.Companion.toMediaType import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Retrofit +import timber.log.Timber import java.util.concurrent.TimeUnit import javax.inject.Qualifier import javax.inject.Singleton @@ -49,26 +50,29 @@ object RetrofitModule { .build() ) when (response.code) { - EXPIRED_TOKEN -> { - response.close() + + EXPIRED_TOKEN -> try { runBlocking { refreshTokenRepository.postRefreshToken().onSuccess { accessToken -> refreshTokenRepository.setAccessToken(accessToken.accessToken) - response = chain.proceed( - request - .newBuilder() - .addHeader(CONTENT_TYPE, APPLICATION_JSON) - .addHeader( - AUTHORIZATION, - BEARER + localDataSource.accessToken - ) - .build() - ) } } + response.close() + + val newRequest = chain.request() + var newResponse = chain.proceed( + newRequest + .newBuilder() + .addHeader(CONTENT_TYPE, APPLICATION_JSON) + .addHeader(AUTHORIZATION, BEARER + localDataSource.accessToken) + .build() + ) + return@Interceptor newResponse + } catch (t: Throwable) { + Timber.e(t.message) } } - response + return@Interceptor response } @Provides From a04abefbbcf8f351c5c84f23c30fa8947d1c1555 Mon Sep 17 00:00:00 2001 From: stellar-halo Date: Thu, 14 Mar 2024 12:58:19 +0900 Subject: [PATCH 2/4] =?UTF-8?q?product=20server=EB=A1=9C=20url=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index fb66e28f..1fecca5b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -23,7 +23,7 @@ android { versionCode = 1 versionName = "1.0.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - buildConfigField("String", "BASE_URL", getApiKey("BASE_URL")) + buildConfigField("String", "BASE_URL", getApiKey("PROD_BASE_URL")) buildConfigField("String", "KAKAO_NATIVE_APP_KEY", getApiKey("KAKAO_NATIVE_APP_KEY")) manifestPlaceholders["KAKAO_REDIRECT_SCHEME"] = getApiKey("KAKAO_REDIRECT_SCHEME") } From e7f102db5c01a51e5336107de22fe867a7e01ea0 Mon Sep 17 00:00:00 2001 From: stellar-halo Date: Thu, 14 Mar 2024 13:08:08 +0900 Subject: [PATCH 3/4] =?UTF-8?q?versionCode=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1fecca5b..d0e68246 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -20,10 +20,10 @@ android { applicationId = "com.sopetit.softie" minSdk = 28 targetSdk = 34 - versionCode = 1 + versionCode = 6 versionName = "1.0.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - buildConfigField("String", "BASE_URL", getApiKey("PROD_BASE_URL")) + buildConfigField("String", "BASE_URL", getApiKey("DEV_BASE_URL")) buildConfigField("String", "KAKAO_NATIVE_APP_KEY", getApiKey("KAKAO_NATIVE_APP_KEY")) manifestPlaceholders["KAKAO_REDIRECT_SCHEME"] = getApiKey("KAKAO_REDIRECT_SCHEME") } From 79ab9d47de8b893ec8729bd31a190bf48150cbf4 Mon Sep 17 00:00:00 2001 From: stellar-halo Date: Fri, 15 Mar 2024 10:05:45 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=EC=B9=B4=EC=B9=B4=EC=98=A4=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=84=B1=EA=B3=B5=20boolean=EA=B0=92?= =?UTF-8?q?=EC=9D=84=20=EB=B0=94=EA=BF=94=EC=A3=BC=EB=8A=94=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=9C=84=EC=B9=98=EB=A5=BC=20sharedPreference=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=EC=9D=B4=ED=9B=84=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/sopetit/softie/ui/login/LoginViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/sopetit/softie/ui/login/LoginViewModel.kt b/app/src/main/java/com/sopetit/softie/ui/login/LoginViewModel.kt index c35bbce4..d25ff265 100644 --- a/app/src/main/java/com/sopetit/softie/ui/login/LoginViewModel.kt +++ b/app/src/main/java/com/sopetit/softie/ui/login/LoginViewModel.kt @@ -28,7 +28,6 @@ class LoginViewModel @Inject constructor( val kakaoLoginCallback: (OAuthToken?, Throwable?) -> Unit = { token, error -> KakaoLoginCallback { accessToken -> - _isKakaoLogin.value = true initTokenUseCase( accessToken = accessToken, refreshToken = "", @@ -36,6 +35,7 @@ class LoginViewModel @Inject constructor( isSignedUp = false ) }.handleResult(token, error) + _isKakaoLogin.value = true } fun postLogin() {