-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
There was a problem hiding this 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() { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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("", "", "", "") |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런 식으로 사용하는 게 더 좋을 것 같네요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전체적으로 너무 깔끔해서 리뷰해드릴게 많이 없었네요!! 좋은 코드 잘보구 갑니다
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() | ||
} | ||
} | ||
} | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수명이 조금 모호한 것 같아요! 혹시 더 좋은 네이밍 없을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어렵다.. 네이밍..
✍️ Work Description
심화과제
도전과제
📸 ScreenShot
심화과제
1_2.mp4
도전과제
1_3.mp4
🍀 Issues
#5
✔️ PR point
심화과제
도전과제