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/#19] Week6 / 심화 과제 #22

Merged
merged 32 commits into from
Dec 12, 2023

Conversation

kangyuri1114
Copy link
Member

📌𝘐𝘴𝘴𝘶𝘦𝘴

📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯

  • 양방향 데이터 바인딩 사용해보기 (필수 과제에서 적용함)
  • 코루틴 suspend 사용해보기 (회원가입, 로그인, open API 친구리스트)
  • BindingAdaptor 사용 (타이틀 글자 키우기)

📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵

_2023_12_07_04_59_12_784.mp4

💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴

  1. 양방향 데이터 바인딩은 필수 과제에서 구현 했습니다.

  2. 회원가입, 로그인, open API 친구리스트 세 부분에서 API 통신 구현한 곳 모두 코루틴 suspend로 변경 했습니다.
    근데............................... 자신은 없네여ㅠㅠ 잘 한건가... 뭔가 쓸데없는 코드 있다 싶으면 바로 코리 부탁해염

  3. BindingAdaptor 사용해서 회원가입 시 모든 로그인 조건 만족 시 값자기 타이틀 글씨가 커지게 했습니다.
    왜냐면... 그냥 뭔가 애니메이션 느낌이 있으면 재밌을거 같아서여 (저만 재밌나여)

  4. 엄... 스낵바랑 토스트랑 다 섞여서 너무 보기 안 좋은데 이 부분은 차차 수정하겠습니당 ㅎㅎ;;

  5. 그리고 영상 보면 로그인 성공 토스트가 두번 뜨는데, 토스트 코드를 두번 썼나 하고 찾아보니까 한번만 썼는데 왜 두번 뜰까요? 두번이 뜬다는 건 로그인 액티비티에서 UiState.Success가 두번 간 거 같은데.... 왜...지..? 로딩도 아니고 왜 성공이 두번이지..

  6. API 통신 로그인, 회원가입만 신경써서 자동로그인 부분이랑 유저정보 불러오는 부분이 지금 다 엉망입니다 ㅠㅠ 이것도 유저정보 API 붙이게 될... 시간이 있다면 붙이면서 리팩토링 해볼게요..

@kangyuri1114 kangyuri1114 self-assigned this Dec 6, 2023
@kangyuri1114 kangyuri1114 added 🌱필수 필수 과제 🌳심화 심화 과제 and removed 🌱필수 필수 과제 labels Dec 6, 2023
Copy link
Member

@Marchbreeze Marchbreeze left a comment

Choose a reason for hiding this comment

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

진차... 야무지네요...

@@ -10,13 +10,13 @@ import retrofit2.http.POST
interface AuthService {
// 회원가입
@POST("api/v1/members")
fun signUp(
suspend fun signUp(
@Body request: RequestSignupDto,
): Call<Unit>
Copy link
Member

Choose a reason for hiding this comment

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

요 부분의 Call<>도 빼주셔도 될듯함다! 그 전에 Call이 여기서 어떤 역할을 했었고, 왜 이제 안 감싸주어도 작동이 되는지 공부해보면 더 좋을 듯 합니다 ~~


loginViewModel.loginResult.observe(
loginViewModel.getLoginInfo.observe(
Copy link
Member

Choose a reason for hiding this comment

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

옵저버는 onClickListener보다는 바깥쪽에 위치하는 게 더 좋을 것 같아요~!

Copy link
Member Author

Choose a reason for hiding this comment

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

오 생각해보니 그렇네염.,,,,,맞슴니다

Comment on lines +18 to +19
private val _getLoginInfo = MutableLiveData<UiState<User>>()
val getLoginInfo: LiveData<UiState<User>> get() = _getLoginInfo
Copy link
Member

Choose a reason for hiding this comment

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

변수명이 get으로 시작하면 너무 함수명같지 않나요..? ㅎㅎ

Copy link
Member Author

Choose a reason for hiding this comment

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

저 이제 변수명 정하는거 오류났어요
최종_진짜최종_찐최종 느낌..;; 좀 더 고민해볼게요 ㅎㅎ,,

}

val userId = uiState.data?.userId
showShortToast("로그인 성공, 유저 아이디 : $userId")
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.

ㅋㅋㅋㅋㅋ 제가 버튼을 두번 누르는 이슈였습니다 ..ㅎㅎ^^

Copy link
Member

Choose a reason for hiding this comment

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

@kangyuri1114 제 코드 중에 util에 setOnSingleClickListener 라구 있거덩요? 그거 가져와서 대신 쓰면 더블 클릭에 대응하지 않게 된답니다~~!

Comment on lines +56 to +57
val peopleList = uiState.data
peopleListAdapter.setUsers(ArrayList(peopleList))
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.

네~~ 주의할게요!

@@ -0,0 +1,13 @@
package org.sopt.dosopttemplate.util

sealed interface UiState<out T> {
Copy link
Member

Choose a reason for hiding this comment

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

혹시 제 UiState 가져오셧나요? ㅎㅎ 아님말구~

Copy link
Member Author

Choose a reason for hiding this comment

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

합세때 쓰던 거 가져왔어욤 ㅎㅎ

@kangyuri1114 kangyuri1114 changed the title Feat/#19 week6 advanced [FEAT/#19] Week6 / 도전 과제 Dec 7, 2023
Copy link
Member

@leeeyubin leeeyubin 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 +70 to +75
) { uiState ->
when (uiState) {
is UiState.Success -> {
if (binding.cbLoginAutologin.isChecked) {
signUpUser?.let {
loginViewModel.saveUserForAutoLogin(this, it)
Copy link
Member

Choose a reason for hiding this comment

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

저도 UiSate 써보고 싶었는데,, 다음에 할 때 참고해야게써요 최곱니다,,,

Comment on lines +50 to +54
RequestSignupDto(
inputId.value ?: "",
inputPw.value ?: "",
inputNickname.value ?: "",
),
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

Choose a reason for hiding this comment

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

저는 orEmpty를 썼는데 inputId.value.orEmpty로 하는 것과 inputId.value ?: "" 하는 것 중에 어느게 더 효율적인가요..?

Copy link
Member Author

Choose a reason for hiding this comment

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

음... 제 생각에는 orEmpty가 더 깔끔해서 시각적으로는 좋을 것 같네요 ㅎㅎ..성능부분까지는 모르겠슴다 ㅎㅎ..

@kangyuri1114 kangyuri1114 changed the title [FEAT/#19] Week6 / 도전 과제 [FEAT/#19] Week6 / 심화 과제 Dec 8, 2023
Copy link
Member

@DoReMinWoo DoReMinWoo 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 +137 to +158
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginHorizontal="30dp"-->
<!-- android:layout_marginTop="12dp"-->
<!-- android:text="@string/tv_signup_age"-->
<!-- android:textSize="20sp"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/et_signup_nickname" />-->

<!-- <EditText-->
<!-- android:id="@+id/et_signup_age"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginHorizontal="30dp"-->
<!-- android:layout_marginTop="5dp"-->
<!-- android:hint="@string/et_age_hint"-->
<!-- android:inputType="number"-->
<!-- android:singleLine="true"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/tv_signup_age" />-->
Copy link
Member

Choose a reason for hiding this comment

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

사용하지 않는 코드는 지워주면 좋을거같아요!


private fun observeValid() {
signUpViewModel.idFlag.observe(this) { idFlag ->
binding.telSignupId.error = if (idFlag) null else getString(R.string.id_layout_title)
Copy link
Member

Choose a reason for hiding this comment

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

오홍 이런식으로 if문 쓰는방법도 좋네요

Copy link
Member Author

Choose a reason for hiding this comment

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

조장이 고쳐줬어염 ㅎㅅㅎ

Comment on lines +50 to +54
RequestSignupDto(
inputId.value ?: "",
inputPw.value ?: "",
inputNickname.value ?: "",
),
Copy link
Member

Choose a reason for hiding this comment

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

저는 orEmpty를 썼는데 inputId.value.orEmpty로 하는 것과 inputId.value ?: "" 하는 것 중에 어느게 더 효율적인가요..?

@kangyuri1114 kangyuri1114 merged commit 968cd95 into feat/#18-week6-essential Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌳심화 심화 과제
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants