Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT/seminar1] 심화과제 / 도전과제 #6

Merged
merged 11 commits into from
Nov 8, 2023

Conversation

emjayMJkim
Copy link
Member

✍️ Work Description

심화과제

  • EditText 한 줄 제한 & 엔터키 누르면 다음 EditText로 넘어가기
  • 키보드 올릴 때 화면 같이 올리기
  • 배경 터치 시 화면 내리기

도전과제

  • 자동로그인
  • 앱 종료 프로세스 구현
  • 로그아웃
  • 뒤로 가기 버튼 두번 누르면 앱 종료

📸 ScreenShot

심화과제

1_2.mp4

도전과제

1_3.mp4

🍀 Issues

#5

✔️ PR point

심화과제

  • 키보드 올릴 때 가려지는 부분은 스크롤되도록 했습니다

도전과제

  • 로그아웃을 했을때 앱 종료가 아닌, 앱의 첫 화면(로그인 화면)으로 돌아가도록 했습니다
  • 앱의 어느 화면에서든 뒤로 가기 버튼을 두 번 클릭해야 앱이 종료되도록 했습니다

Copy link
Member

@Jokwanhee Jokwanhee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 잘 봤습니다! 고생하셨습니다~~! 👍깔~끔하네요

return super.dispatchTouchEvent(ev)
}

private fun hideKeyboard() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 이 부분 코드리뷰로 확장함수를 처리해서 사용하니 다른 곳에서도 확장성있게 사용할 수 있어서! 좋았습니다!

import org.sopt.dosopttemplate.data.entity.UserData


object SharedPreference {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오.. 저도 SharedPreference 사용할 때 object 를 사용하면 범용성있게 사용할 수 있겠네요.. 저도 리팩토링할 때 참고하도록 하겠습니다

fun isValidUserData() = prefs.getString(USER_ID, "")?.isNotBlank() ?: false

fun setUserData(user: UserData) {
with(prefs.edit()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요 부분 SharedPreference ktx 사용하면 아래 코드처럼 사용할 수 있더라구요 (의진이가 알려줬습니다!)

prefs.edit(commit = true) {
  putString(USER_ID, user.id)
   putString(USER_PW, user.pw)
  putString(USER_NICKNAME, user.nickName)
  putString(USER_MBTI, user.mbti)
}

@@ -16,58 +17,69 @@ import org.sopt.dosopttemplate.util.getParcelable

class LogInActivity : BaseActivity<ActivityLoginBinding>(R.layout.activity_login) {
private lateinit var resultLauncher: ActivityResultLauncher<Intent>
private lateinit var userData: UserData
private var userData: UserData = UserData("", "", "", "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UserData 객체를 할당할 때, 생성자로 값을 넘겨주는 것보단 코틀린에서는 default value 를 제공해주니깐 아래와 같이 사용해도 좋을 것 같다는 개인적인 생각을 했습니다!

data class UserData (
  val id: String = ""
)
private var userData: UserData = UserData()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 식으로 사용하는 게 더 좋을 것 같네요!!

Copy link
Member

@kez-lab kez-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전체적으로 너무 깔끔해서 리뷰해드릴게 많이 없었네요!! 좋은 코드 잘보구 갑니다

Comment on lines 38 to 50
private fun initFinishApp() {
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if (System.currentTimeMillis() - backPressedTime >= 2000L) {
backPressedTime = System.currentTimeMillis()
SnackBar.makeSnackBar(binding.root, BACK_MESSAGE)
} else {
finishAffinity()
}
}
}
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수명이 조금 모호한 것 같아요! 혹시 더 좋은 네이밍 없을까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어렵다.. 네이밍..

@emjayMJkim emjayMJkim merged commit 46af437 into develop Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants