Skip to content

Commit

Permalink
[FIX/#5] 무한 로딩 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Jul 6, 2024
1 parent 3540521 commit 4bcb604
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 2 additions & 4 deletions app/src/main/java/com/terning/point/MyApp.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.terning.point

import android.app.Application
import android.util.Log
import androidx.appcompat.app.AppCompatDelegate
import com.kakao.sdk.common.KakaoSdk
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber
import com.kakao.sdk.common.KakaoSdk
import com.kakao.sdk.common.util.Utility

@HiltAndroidApp
class MyApp : Application() {
Expand All @@ -27,7 +25,7 @@ class MyApp : Application() {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}

private fun initKakoSdk(){
private fun initKakoSdk() {
KakaoSdk.init(this, BuildConfig.NATIVE_APP_KEY)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.toast
import com.terning.feature.R
import com.terning.feature.home.navigation.navigateHome
import com.terning.feature.mypage.navigation.navigateMyPage
import com.terning.feature.onboarding.signin.component.KakaoButton

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,21 @@ class SignInViewModel @Inject constructor() : ViewModel() {
private fun signInResult(context: Context, token: OAuthToken?, error: Throwable?) {
viewModelScope.launch {
if (error != null) {
signInFailure(context, token, error)
signInFailure(context, error)
} else if (token != null) {
signInSuccess(token)
}
}
}

private fun signInFailure(context: Context, token: OAuthToken?, error: Throwable?) {
private fun signInFailure(context: Context, error: Throwable?) {
if (error.toString().contains(KAKAO_NOT_LOGGED_IN)) {
UserApiClient.instance.loginWithKakaoAccount(context) { _, _ ->
signInResult(context, token, error)
UserApiClient.instance.loginWithKakaoAccount(context) { token, _ ->
if (error != null) {
sigInCancellationOrError(error)
} else if (token != null) {
signInSuccess(token)
}
}
} else {
sigInCancellationOrError(error)
Expand Down

0 comments on commit 4bcb604

Please sign in to comment.