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] 마이페이지 / 2주 절약, 낭비 기능 구현 #261

Merged
merged 41 commits into from
Mar 2, 2024

Conversation

sxunea
Copy link
Contributor

@sxunea sxunea commented Mar 2, 2024

📝 Work Description

  • getUser API 연결 및 기능 구현
  • 2주 절약, 낭비 애니메이션 구현
  • 레벨별, 낭비/절약 현재 상태 별로 디자인 및 문구 적용

📸 Screenshot

📣 To Reviewers

  • 자세한 사항은 위니 노션 칸반보드에 적어두었습니다 ~!

…eks-animation

# Conflicts:
#	app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt
#	app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt
@sxunea sxunea added feat ✨ 새로운 기능 구현 혜선 🐱 labels Mar 2, 2024
@sxunea sxunea self-assigned this Mar 2, 2024
Copy link
Member

@leeeha leeeha left a comment

Choose a reason for hiding this comment

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

혹시 마이페이지 프래그먼트에서 목표 관련 체크박스가 4가지 경우로 케이스 분류되고 있나요??

  • 금액 o, 횟수 o
  • 금액 o, 횟수 x
  • 금액 x, 횟수 o
  • 금액 x, 횟수 x

저는 목표여정 화면에서 위의 4가지 경우에 따라 이미지 리소스를 바꾸는 식으로 구현했는데, 해당 기능 반영되어 있는지 궁금합니다!

@@ -44,6 +44,7 @@ class MainViewModel @Inject constructor(
Timber.e("SUCCESS GET USER IN MAIN")
dataStoreRepository.saveUserInfo(response)
_getUserState.value = UiState.Success(response)
_getUserState.value = UiState.Empty
Copy link
Member

Choose a reason for hiding this comment

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

Empty로 초기화 한 이유를 알 수 있을까요??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

getUser()가 실행되면 UiState.Loading으로 지정되니 UiState.Empty로 다시 초기화 해주어서 마이 피드 삭제 후 getUserState가 Success 상태로 유지되어 관찰이 안되는 문제를 해결했습니다 ! 마이페이지에서 마이피드 삭제 후 finish() 했을 때 금액이 줄어들지 않는 문제를 해결하기 위해 도입했어요

Copy link
Member

@leeeha leeeha Mar 2, 2024

Choose a reason for hiding this comment

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

아하!! 이런 부분은 주석을 안 적어놓으면 나중에 코드 파악이 어렵더라구요..😂

// 상세피드 들어갔다 나올 때 성공 상태가 계속 관찰되어
// 이미 삭제된 항목이 되살아나는 일이 없도록 UiState 초기화
viewModel.initGetWineyFeedState()
// 상세피드 들어갔다 나올 때 성공 상태가 계속 관찰되어
// 스낵바가 반복해서 뜨지 않도록 UiState 초기화
viewModel.initDeleteFeedState()

그래서 저는 이렇게 위니피드 프래그먼트에 주석을 적어뒀습니다! 참고해서 반영하면 좋을 거 같아요!

}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

res/values 폴더 아래에 target_money.xml 파일 만들어서 int array 정의해뒀는데 해당 리소스 활용해도 좋을 거 같습니다!

Copy link
Member

Choose a reason for hiding this comment

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

UserLevel도 presentation/model 패키지 아래에 이넘 클래스로 정의해뒀는데 활용하면 좋을 거 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

맞아요 안그래도 리뷰하면서 머지되면 함께 반영할 수 있겠다 싶었습니다 ! 이제 머지되고 있으니까 적용할게요 감사합니다 👍

}
}

fun formatWithCommaForMoney(number: Int): String {
Copy link
Member

Choose a reason for hiding this comment

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

저는 이걸 확장함수로 만들어뒀는데 서로 방식이 통일되면 좋을 거 같습니다..! 🙏

}
textView.text = spannableString
}

Copy link
Member

Choose a reason for hiding this comment

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

전반적으로 매직넘버, 매직 리터럴이 많은데 상수화 또는 리소스화 시킬 수 있는 게 있다면, 나중에 확장성을 위해 리팩토링 하면 좋을 거 같습니다!

"CHICKEN" -> "30만원 x "
"CHICKEN" -> "3만원 x "
"SNEAKERS" -> "15만원 x "
"AIRPODS" -> "30만원 x "
else -> ""
Copy link
Member

@leeeha leeeha Mar 2, 2024

Choose a reason for hiding this comment

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

어쩐지 치킨이 30만원이더라 ㅋㅋㅋㅋ 저도 앞으로 pr 더 꼼꼼히 확인할게요 😘

…eks-animation

# Conflicts:
#	app/src/main/java/org/go/sopt/winey/data/model/remote/response/ResponseGetUserDto.kt
#	app/src/main/java/org/go/sopt/winey/data/repository/DataStoreRepositoryImpl.kt
#	app/src/main/java/org/go/sopt/winey/domain/entity/UserV2.kt
#	app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt
@sxunea
Copy link
Contributor Author

sxunea commented Mar 2, 2024

@leeeha 4dc014e 에서 isLevelUpAmountConditionMet, isLevelUpCountConditionMet 라는 Boolean 값을 만들고 이를 통해 달성 여부를 각각 반환하고 있어요 ! 이 값을 받아와서 마이페이지 프래그먼트의 setUpUserDataByGoal() 에서 체크박스 상태를 관리해주고 있습니다 : )

@sxunea sxunea merged commit b2a8e4e into develop Mar 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat ✨ 새로운 기능 구현 혜선 🐱
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] 마이페이지 / 2주 절약, 낭비 기능 구현
2 participants