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

Feature/mz 180 ledger list edit delete, error handling, category config #67

Merged
merged 18 commits into from
Jan 16, 2024

Conversation

jinukeu
Copy link
Member

@jinukeu jinukeu commented Jan 16, 2024

💡 Issue

🌱 Key changes

  • CategoryConfig (remote + cache)
  • 장부 목록 불러오기 (무한 스크롤)
  • 장부 편집/삭제
  • 에러 핸들링

✅ To Reviewers

LedgerDetailViewModeldeleteLedger()에서 에러 핸들링하는 부분 봐주세요.
지금부터 하는 작업에는 에러 핸들링 부탁드립니다~! @yangsooplus @syb8200

장부 편집, 삭제 시 -> api를 재호출하지 않고 편집/삭제된 장부를 로컬에서 업데이트 하는 로직으로 구현했습니다.

에러 핸들링의 경우, 공통으로 해야하는 작업이다보니 ASAP 라벨 추가했습니다.

@yangsooplus 님이 짜주신 SusuLimitDatePicker에 사소한 버그가 있어 수정했습니다.
fix: SusuDatePickerBottomSheet 무조건 기준 날짜로 보이는 현상 수정

Mvi 단점이 모든 상태와 사이드 이펙트를 관리해야해서 코드가 많아지는거같아요.
최대한 깔끔하게 짜보려고 했는데 많이 부족합니다.
피드백 환영합니다.

📸 스크린샷

무한 스크롤

default.mp4

장부 편집

default.mp4

장부 삭제

default.mp4

장부 삭제 에러 핸들링

default.mp4

@jinukeu jinukeu self-assigned this Jan 16, 2024
@jinukeu jinukeu changed the title Feature/mz 180 ledger list edit delete, error handling Feature/mz 180 ledger list edit delete, error handling, category config Jan 16, 2024
@@ -221,7 +221,7 @@ fun SusuLimitDatePickerBottomSheet(
InfiniteColumn(
modifier = Modifier.width(100.dp),
items = yearList,
initialItem = stringResource(R.string.word_year_format, criteriaYear),
initialItem = stringResource(R.string.word_year_format, selectedYear),
Copy link
Member

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 +21

@Singleton
@Provides
fun provideCategoryConfigDao(db: RoomInMemoryDataBase) = db.categoryConfigDao()
Copy link
Member

Choose a reason for hiding this comment

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

category 캐싱을 위해 도입했다고 이해하면 될까용?

Copy link
Member Author

Choose a reason for hiding this comment

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

네 맞습니다!

data class CategoryConfigEntity(
@PrimaryKey
val id: Int,
val seq: Int,
Copy link
Member

Choose a reason for hiding this comment

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

seq가 어떤 데이터인가요? 스웨거랑 정보 정의된거 봐도 감이 안 와서요 ㅎㅎ; 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

sequence 순서 같아요!
직렬화/역직렬화 과정에서 순서가 바뀔 수도 있어 내려주는거같습니다~!

Comment on lines 58 to 63
fun navigate(tab: MainNavigationTab) {
val navOptions = navOptions {
popUpTo(navController.graph.findStartDestination().id) {
popUpTo(SentRoute.route) {
saveState = true
}
launchSingleTop = true
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.

네 초기 루트여서 저렇게했어요!
navController.graph.findStartDestination().id로 하게되면 saveState가 제대로 안먹더라구요 ... !

Copy link
Member

Choose a reason for hiding this comment

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

compose navigation option들 많이 헷갈리네여,, 시간 나면 한번 파봐야겠어요

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 +69 to +74
DialogToken(
title = context.getString(com.susu.feature.received.R.string.ledger_detail_screen_dialog_title),
text = context.getString(com.susu.feature.received.R.string.ledger_detail_screen_dialog_description),
confirmText = context.getString(R.string.word_delete),
dismissText = context.getString(R.string.word_cancel),
onConfirmRequest = sideEffect.onConfirmRequest,
Copy link
Member

Choose a reason for hiding this comment

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

DialogTokenString 대신 @StringRes id를 받도록 할까요? Dialog 쓰는 곳에서 보기 안좋은거 같아서유

Copy link
Member Author

Choose a reason for hiding this comment

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

String이 더 범용적이어서 일단 조금 더 사용해보고 바꾸는거 어떠세요?

만약 DiglogToken의 text를 @StringRes 타입으로 바꾼다면 ...
Throwable의 message(String Type)를 DialogToken의 text에 대입할 수 없을거같아요!

Copy link
Member

Choose a reason for hiding this comment

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

Throwable msg를 생각 못했네요 유지합시다!

private var ledger = Ledger()

fun initData(backStackEntryLedgerUri: String?) {
if (backStackEntryLedgerUri == null) {
Copy link
Member

Choose a reason for hiding this comment

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

backStackEntryLedgerUri == null이 어떤 상황을 나타내는 건가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

아 ... 이거 주석을 넣는다는걸 깜빡했네요

LedgerDetail의 진입 경로는 2가지가 있어요.

  1. ReceivedScreen -> LedgerDetail (받아요 화면에서 장부 상세 화면으로 이동한 경우)
  2. LedgerEdit -> LedgerDetail (장부 편집 화면에서 장부 상세 화면으로 이동한 경우)

1번 케이스(받아요 -> 장부 상세)의 경우 routeargumentLedger를 받고
2번 케이스(장부 편집 -> 장부 상세)의 경우 navBackStackEntry로 부터 Ledger를 받습니다.

backStackEntryLedgerUri == null이 의미하는 건 navBackStackEntry로부터 Ledger를 받지 못한 상황입니다.
이 상황은 받아요 -> 장부 상세로 이동했다는걸 의미합니다.

Copy link
Member

Choose a reason for hiding this comment

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

아아 이해했습니다~! 명쾌하고 상세한 설명 감사해요!

Comment on lines +9 to +30
data class LedgerEditState(
val name: String = "",
val selectedCategoryId: Int = 0,
val customCategory: String = "",
val startYear: Int = 0,
val startMonth: Int = 0,
val startDay: Int = 0,
val endYear: Int = 0,
val endMonth: Int = 0,
val endDay: Int = 0,
val categoryConfigList: PersistentList<Category> = persistentListOf(Category()),
val showCustomCategoryButton: Boolean = false,
val isCustomCategoryChipSaved: Boolean = false,
val showStartDateBottomSheet: Boolean = false,
val showEndDateBottomSheet: Boolean = false,
) : UiState {
val isSelectedCustomCategory = selectedCategoryId == categoryConfigList.last().id
val saveButtonEnabled = when {
name.isEmpty() -> false
isSelectedCustomCategory && (customCategory.isEmpty() || isCustomCategoryChipSaved.not()) -> false
else -> true
}
Copy link
Member

Choose a reason for hiding this comment

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

정보도 많고 UI 요소도 많다보니 State가 어마어마하네요 ㅋㅋㅋㅋ

@jinukeu jinukeu merged commit d4fbfe5 into develop Jan 16, 2024
1 check passed
@jinukeu jinukeu deleted the feature/MZ-180-ledger-list-edit-delete branch January 22, 2024 04:06
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.

[Feat] 장부 목록, 편집, 서버 연동
2 participants