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

[REFACTOR] 코스 발견 / 전면 리팩토링 #284

Merged
merged 114 commits into from
Dec 13, 2023

Conversation

leeeha
Copy link
Member

@leeeha leeeha commented Dec 6, 2023

📌 개요

✨ 작업 내용

  • 이슈에서 자세한 내용 확인 부탁드립니다!!
  • 리사이클러뷰를 감싸고 있는 NestedScrollView를 걷어내고 중첩리사이클러뷰 & 멀티뷰 타입 구조로 바꾼 것이 가장 큰 변경사항입니다.
  • 배너 뷰페이저는 CollapsingToolbarLayout 으로 바꿨는데, 일정 시간 간격으로 스와이프 되는 애니메이션은 별도의 feature 브랜치에서 리팩토링과 함께 구현하겠습니다.
  • 무한 스크롤 부분은 서버 응답 데이터가 바뀔 예정이라 아직 구현하지 않았습니다. (전체 페이지 개수 또는 마지막 페이지까지 왔는지 알 수 있는 속성을 추천 코스 조회 api 응답 데이터에 같이 보내줄 예정 -> 현재는 별도의 api로 분리되어 있음.)
  • 추천 코스 정렬 기준을 최신순, 스크랩순으로 바꾸는 기능은 별도의 feature 브랜치에서 구현하겠습니다.
  • 코스 상세페이지에서 하트 스크랩 수 표시하는 것도 구현했는데, 스크랩 버튼 클릭에 따라 아래 숫자가 증감되는 기능은 별도의 feature 브랜치에서 구현하겠습니다.
  • 상세페이지에서 제목이나 스크랩에 변경 사항이 생겼을 때, 바로 이전 메인 페이지에도 반영하는 로직도 별도 브랜치에서 구현하겠습니다! (스크랩 반영과 관련해서 서버 측에서 이슈가 조금 있는 거 같아요)

✨ PR 포인트

  • 마라톤 코스, 추천 코스가 모두 조회되고 나서 뷰가 떠야 하는데, 간혹 데이터 로딩 시간이 걸리는 경우에는 데이터 조회 보다 뷰 갱신이 먼저 이루어져, 내부 로직에 따라 무한 로딩 상태에 빠지는 문제가 발생하고 있습니다. 이 부분에서 더 제대로 된 동기 처리 로직이 필요할 거 같습니다. (관련 코드 코멘트 남겨둘게요!)
  • 마라톤 코스 조회 하려면 노드 서버 말고 테스트 서버에서 실행시켜야 합니다!!
  • 중첩 리사이클러뷰 & 멀티뷰 타입 구조는 아래 그림을 보면 이해하는 데 도움이 될 거 같아요!

image

📸 스크린샷/동영상

course_discover.mp4

…into feature/refactor-course-discover-screen
- 뷰홀더 안의 onBind 함수에서 역할에 따라 함수화
- 중복되는 이미지 로딩 코드는 바인딩 어댑터 사용
- StorageRepository, CourseRepository에서 로직이 동일한 함수 중에 하나만 남김.
- UiStateV2 코드 일부 적용
- data layer에서 service, source, data/repository, domain/repository 코드 전면 수정
- 생성자로 context 넘기지 않도록
- On[Where/What]ItemClick 으로 네이밍 통일
@Runnect Runnect deleted a comment from Android-unam Dec 10, 2023
@Runnect Runnect deleted a comment from Android-unam Dec 10, 2023
@Runnect Runnect deleted a comment from Android-unam Dec 11, 2023
}

fun getRecommendCourses(pageNo: Int) {
viewModel.getRecommendCourse(pageNo = pageNo, "date")
Copy link
Contributor

Choose a reason for hiding this comment

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

아마 복붙 이슈로 이쪽 함수에서 named argument가 누락된 것 같은데 전반적으로 확인 한 번 부탁드립니다!!

@Runnect Runnect deleted a comment from Android-unam Dec 11, 2023
super.onScrolled(recyclerView, dx, dy)

// 스크롤을 내리면 원형 버튼이 보이도록
if (dy > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

여기 숫자 0이 무슨 의미인지 잘 모를 수 있으니 상수로 적어주시면 이해에 도움이 될 것 같습니다!

@Runnect Runnect deleted a comment from Android-unam Dec 11, 2023
private fun initAppBarOffsetChangedListener() {
// CollapsingToolbarLayout의 높이가 완전히 확장되면 텍스트가 포함된 버튼이 보이도록
binding.appBarDiscover.addOnOffsetChangedListener { appBarLayout, verticalOffset ->
if (verticalOffset == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

여기도 숫자 0을 상수로 바꿔주시면 이해에 도움이 될 것 같아요!

@Runnect Runnect deleted a comment from Android-unam Dec 11, 2023
@Runnect Runnect deleted a comment from Android-unam Dec 11, 2023
@Runnect Runnect deleted a comment from Android-unam Dec 11, 2023
@Runnect Runnect deleted a comment from Android-unam Dec 11, 2023
@Runnect Runnect deleted a comment from Android-unam Dec 11, 2023
@Runnect Runnect deleted a comment from Android-unam Dec 11, 2023
@leeeha leeeha merged commit 3d45ced into develop Dec 13, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FEAT ✨ 새로운 기능 구현 REFACTOR 🧹 코드 리팩토링 하은 🐰 하은 담당
Projects
Development

Successfully merging this pull request may close these issues.

[REFACTOR] 코스 발견 / 전면 리팩토링
3 participants