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

kuring-227 드래그 LazyList, 카테고리 순서 DB 구현 #404

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

mwy3055
Copy link
Member

@mwy3055 mwy3055 commented Dec 25, 2024

https://kuring.atlassian.net/browse/KURING-227?atlOrigin=eyJpIjoiODliNjhlODc0ZGRiNDJmZTgyY2M3MTA5NzUwNzVmYzUiLCJwIjoiaiJ9

요약

카테고리 순서 변경의 첫 번째 작업으로, 드래그 가능한 리스트 DraggableLazyColumn과 카테고리 순서 DB를 구현했습니다.

  • DraggableLazyColumn여기을 많이 참고했습니다. 코드를 자세히 보기는 조금 어려울 수도 있습니다. 프리뷰를 참고하여 보시면 됩니다.
  • 카테고리 순서 DB는 entity 정의, Dao 정의, 도메인 객체 추가, UserRepository에 기능 노출 순서대로 구현되어 있습니다. 매우 전형적인 흐름이므로 리뷰하시기 한결 쉬울 것 같습니다.

@Composable
fun rememberDragDropState(lazyListState: LazyListState, onMove: (Int, Int) -> Unit): DragDropState {
val scope = rememberCoroutineScope()
val state = remember(lazyListState) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Q) 이거 onMove 변경될때에도 state 값 갱신해야하지 않을까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

실질적으로 onMove가 바뀔 일은 별로 없겠지만, 일단 추가하는 게 맞는 것 같아 수정했습니다.

3a08787

Comment on lines 1 to 6
package com.ku_stacks.ku_ring.designsystem.components.dragdrop

fun <T> MutableList<T>.move(from: Int, to: Int) {
if (from == to) return
val element = this.removeAt(from)
this.add(to, element)
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기에서만 쓰이는거라면 internal 붙여도 될 듯 합니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

여기에서만 쓰일 것 같아서 internal 붙였습니다.

b576065

Copy link
Collaborator

@l2hyunwoo l2hyunwoo left a comment

Choose a reason for hiding this comment

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

두개의 PR이 하나의 PR로 합쳐진 것 같은데...

  • DraggableLazyColumn
  • CategoryOrder DB 구현

이렇게 두개로 쪼개도 괜찮았을듯합니다.

@mwy3055
Copy link
Member Author

mwy3055 commented Dec 26, 2024

컨플릭은 따로 보겠습니다. 근데 그냥 import 이슈네요

@boiledEgg-s
Copy link
Collaborator

확실히 리드님의 코드는 다르네요,, 킹우영👑

@mwy3055 mwy3055 requested a review from l2hyunwoo January 8, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants