Skip to content

Commit

Permalink
[FEAT/#1] intent flag 활용하여 task 관리
Browse files Browse the repository at this point in the history
  • Loading branch information
b1urrrr committed Apr 5, 2023
1 parent 54b38da commit a734309
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/org/android/go/sopt/data/entity/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.android.go.sopt.util.type.MBTI
data class User(
val id: String = "",
val pwd: String = "",
val name: String? = null,
val specialty: String? = null,
val name: String? = "",
val specialty: String? = "",
val mbti: MBTI? = null,
) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ class LoginActivity : BindingActivity<ActivityLoginBinding>(R.layout.activity_lo
when (state) {
is Success -> {
showToast(getString(R.string.login_login_success_msg))
startActivity(Intent(this, MainActivity::class.java))
finish()
Intent(this, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(this)
}
}
is Failure -> showSnackbar(binding.root, getString(R.string.wrong_input_msg))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LoginViewModel @Inject constructor(
}

private fun checkAutoLogin() {
if (authRepository.getAutoLogin()) _loginState.value = Success
if (authRepository.getAutoLogin() && authRepository.getSignedUpUser() != null) _loginState.value = Success
}

fun setSavedUser(savedUser: User) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
with(binding) {
tvMainName.text = getString(R.string.main_name, user.name)
tvMainSpecialty.text = getString(R.string.main_specialty, user.specialty)
tvMainMbti.text = getString(R.string.main_mbti, user.mbti)
tvMainMbti.text = getString(R.string.main_mbti, user.mbti ?: "")
}
}
}
Expand Down

0 comments on commit a734309

Please sign in to comment.