Skip to content

Commit

Permalink
[feat]: 자동 로그인 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyuri1114 committed Jul 1, 2024
1 parent 3c4c537 commit 4543904
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class LoginActivity @Inject constructor(
super.onCreate(savedInstanceState)
setContentView(binding.root)

autoLogin()
kakaoLogin()
collectKakaoLogin()
setLoginViewPager()
Expand All @@ -61,6 +62,14 @@ class LoginActivity @Inject constructor(
}.launchIn(lifecycleScope)
}

private fun autoLogin() {
if (viewModel.autoLoginConfigured.value) {
navigateToMain()
} else {
Timber.d("Auto Login Configured False")
}
}

private fun navigateToMain() {
intent = Intent(this, MainActivity::class.java)
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ class LoginViewModel @Inject constructor(
private val _isLogin = MutableStateFlow(false)
val isLogin = _isLogin.asStateFlow()

private val _autoLoginConfigured = MutableStateFlow(networkPreference.autoLoginConfigured)
val autoLoginConfigured = _autoLoginConfigured.asStateFlow()

init {
//getKakaoUserInfo()
_autoLoginConfigured.value = networkPreference.autoLoginConfigured
}

fun loginWithKakaoApp(context: Context) {
Expand Down

0 comments on commit 4543904

Please sign in to comment.