diff --git a/app/src/main/java/org/sopt/pingle/presentation/ui/auth/AuthActivity.kt b/app/src/main/java/org/sopt/pingle/presentation/ui/auth/AuthActivity.kt index 98518314..a52dea53 100644 --- a/app/src/main/java/org/sopt/pingle/presentation/ui/auth/AuthActivity.kt +++ b/app/src/main/java/org/sopt/pingle/presentation/ui/auth/AuthActivity.kt @@ -2,20 +2,22 @@ package org.sopt.pingle.presentation.ui.auth import android.content.Intent import android.os.Bundle +import android.util.Log import androidx.activity.viewModels import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import dagger.hilt.android.AndroidEntryPoint -import javax.inject.Inject import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import org.sopt.pingle.R import org.sopt.pingle.data.service.KakaoAuthService import org.sopt.pingle.databinding.ActivityAuthBinding +import org.sopt.pingle.presentation.ui.main.MainActivity import org.sopt.pingle.presentation.ui.onboarding.OnBoardingActivity import org.sopt.pingle.util.base.BindingActivity import org.sopt.pingle.util.view.UiState import timber.log.Timber +import javax.inject.Inject @AndroidEntryPoint class AuthActivity : BindingActivity(R.layout.activity_auth) { @@ -51,8 +53,14 @@ class AuthActivity : BindingActivity(R.layout.activity_auth } private fun navigateToOnBoarding() { - Intent(this, OnBoardingActivity::class.java).apply { - startActivity(this) + if (viewModel.isLocalGroupId()) { + Intent(this, MainActivity::class.java).apply { + startActivity(this) + } + } else { + Intent(this, OnBoardingActivity::class.java).apply { + startActivity(this) + } } } diff --git a/app/src/main/java/org/sopt/pingle/presentation/ui/auth/AuthViewModel.kt b/app/src/main/java/org/sopt/pingle/presentation/ui/auth/AuthViewModel.kt index 535a98aa..64c815b1 100644 --- a/app/src/main/java/org/sopt/pingle/presentation/ui/auth/AuthViewModel.kt +++ b/app/src/main/java/org/sopt/pingle/presentation/ui/auth/AuthViewModel.kt @@ -3,7 +3,6 @@ package org.sopt.pingle.presentation.ui.auth import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel -import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch @@ -11,6 +10,7 @@ import org.sopt.pingle.data.datasource.local.PingleLocalDataSource import org.sopt.pingle.data.model.remote.request.RequestAuthDto import org.sopt.pingle.domain.repository.AuthRepository import org.sopt.pingle.util.view.UiState +import javax.inject.Inject @HiltViewModel class AuthViewModel @Inject constructor( @@ -42,6 +42,8 @@ class AuthViewModel @Inject constructor( localStorage.userName = userName } + fun isLocalGroupId(): Boolean = localStorage.groupId == -1 + companion object { const val LOGIN_PLATFORM = "KAKAO" const val HEADER_BEARER = "Bearer " diff --git a/app/src/main/java/org/sopt/pingle/presentation/ui/splash/SplashActivity.kt b/app/src/main/java/org/sopt/pingle/presentation/ui/splash/SplashActivity.kt index b577f546..64696374 100644 --- a/app/src/main/java/org/sopt/pingle/presentation/ui/splash/SplashActivity.kt +++ b/app/src/main/java/org/sopt/pingle/presentation/ui/splash/SplashActivity.kt @@ -31,7 +31,9 @@ class SplashActivity : BindingActivity(R.layout.activity_ val storage = PingleLocalDataSourceImpl(this) val nextActivity = - if (storage.isLogin) MainActivity::class.java else AuthActivity::class.java + if (storage.isLogin) { + MainActivity::class.java + } else if (storage.groupId != -1) MainActivity::class.java else AuthActivity::class.java startActivity(Intent(this, nextActivity)) finish()