Skip to content

Commit

Permalink
[CHORE/#6] 함수명 및 변수명 보완
Browse files Browse the repository at this point in the history
  • Loading branch information
b1urrrr committed May 5, 2023
1 parent 4b98612 commit 312cede
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class LoginActivity : BindingActivity<ActivityLoginBinding>(R.layout.activity_lo
super.onCreate(savedInstanceState)
binding.vm = viewModel

initLayout()
initLayoutClickListener()
initSignupBtnClickListener()
setupLoginState()
}

private fun initLayout() {
private fun initLayoutClickListener() {
binding.layoutLogin.setOnSingleClickListener { hideKeyboard() }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class LoginViewModel @Inject constructor(
val pwd = MutableLiveData("")

init {
checkAutoLogin()
setupAutoLogin()
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

initNavigationBar()
initBnvItemSelectedListener()
}

private fun initNavigationBar() {
private fun initBnvItemSelectedListener() {
supportFragmentManager.findFragmentById(R.id.fcv_main_container)
?: navigateTo<HomeFragment>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ class ProfileFragment : BindingFragment<FragmentProfileBinding>(R.layout.fragmen

private fun initLogoutAndLeaveBtnClickListener() {
binding.btnProfileLogoutAndLeave.setOnSingleClickListener {
// TODO: show Logout And Leave Dialog
viewModel.clearLocalPref()
requireContext().showToast(getString(R.string.profile_logout_and_leave_msg))
Intent(activity, LoginActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(this)
}
intentToLogin()
}
}

private fun intentToLogin() {
Intent(activity, LoginActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(this)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import dagger.hilt.android.AndroidEntryPoint
import org.android.go.sopt.R
import org.android.go.sopt.databinding.ActivitySignupBinding
import org.android.go.sopt.presentation.login.LoginActivity
import org.android.go.sopt.presentation.signup.SignupViewModel.Companion.INVALID_ID_CODE
import org.android.go.sopt.presentation.signup.SignupViewModel.Companion.INVALID_PWD_CODE
import org.android.go.sopt.presentation.signup.SignupViewModel.Companion.CODE_INVALID_ID
import org.android.go.sopt.presentation.signup.SignupViewModel.Companion.CODE_INVALID_PWD
import org.android.go.sopt.util.UiState.Failure
import org.android.go.sopt.util.UiState.Success
import org.android.go.sopt.util.binding.BindingActivity
Expand All @@ -26,11 +26,11 @@ class SignupActivity : BindingActivity<ActivitySignupBinding>(R.layout.activity_
super.onCreate(savedInstanceState)
binding.vm = viewModel

initLayout()
initLayoutClickListener()
setupSignupState()
}

private fun initLayout() {
private fun initLayoutClickListener() {
with(binding) {
layoutSignup.setOnSingleClickListener { hideKeyboard() }
svSignup.setOnSingleClickListener { hideKeyboard() }
Expand All @@ -44,11 +44,11 @@ class SignupActivity : BindingActivity<ActivitySignupBinding>(R.layout.activity_
is Success -> intentToLogin()
is Failure -> {
when (state.code) {
INVALID_ID_CODE -> showSnackbar(
CODE_INVALID_ID -> showSnackbar(
binding.root,
getString(R.string.signup_invalid_id_msg),
)
INVALID_PWD_CODE -> showSnackbar(
CODE_INVALID_PWD -> showSnackbar(
binding.root,
getString(R.string.signup_invalid_pwd_msg),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class SignupViewModel @Inject constructor(

fun signup() {
if (!isValidId(id.value)) {
_signupState.value = Failure(INVALID_ID_CODE)
_signupState.value = Failure(CODE_INVALID_ID)
return
}
if (!isValidPwd(pwd.value)) {
_signupState.value = Failure(INVALID_PWD_CODE)
_signupState.value = Failure(CODE_INVALID_PWD)
return
}
authRepository.setSignedUpUser(getUser())
Expand All @@ -62,7 +62,7 @@ class SignupViewModel @Inject constructor(
const val MIN_PWD_LENGTH = 8
const val MAX_PWD_LENGTH = 12

const val INVALID_ID_CODE = 100
const val INVALID_PWD_CODE = 101
const val CODE_INVALID_ID = 100
const val CODE_INVALID_PWD = 101
}
}

0 comments on commit 312cede

Please sign in to comment.