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] 온보딩 모듈 추가 #438

Merged
merged 30 commits into from
Oct 30, 2024
Merged

[Feature] 온보딩 모듈 추가 #438

merged 30 commits into from
Oct 30, 2024

Conversation

ThirFir
Copy link
Contributor

@ThirFir ThirFir commented Oct 28, 2024

🐥 개요

👾 상세 작업 내용

  • 식단 좋아요 삭제
  • 기능 소개를 위해 최초 1회에만 띄우던 툴팁 기능 -> 모듈 분리해서 하나의 클래스로 구현 (원래 있던 것을 모듈 분리 및 리팩토링 한 것임)
  • 알림 액티비티에 공지 키워드 알림 페이지 진입점 추가

👀 부가 설명

  • (클린 아키텍쳐 제외) 처음 해보는 모듈 분리라 미흡한 부분 바로 지적해주시면 감사드리겠습니다 🙏

🐰 결과

image image

@ThirFir ThirFir self-assigned this Oct 28, 2024
@ThirFir ThirFir requested a review from a team as a code owner October 28, 2024 04:06
@ThirFir ThirFir force-pushed the feature/onboarding branch from b1fba07 to 9f2792a Compare October 28, 2024 04:07
Copy link
Collaborator

@Jokwanhee Jokwanhee left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 🙇🏻

코드 작성할 때, 함수화 좀 신경써주면 좋을 것 같아요! 리뷰할 때 코드 읽기가 너무 힘들어서 뭐하는 코드인지 다시 한 번 확인하게 되네요 ㅠㅠ 🥲

추가로 궁금한거 몇 개 작성해놨는데, 답변 부탁드립니다~ 😎

[추가 질문]

onboarding 모듈이 정확히 하는게 뭔가요?

repeatOnLifecycle(Lifecycle.State.STARTED) {
val shouldShow = onboardingRepository.getShouldOnboarding(type.name)
delay(500)
withContext(mainDispatcher) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

이미 lifecycleScope 와 repeatOnLifecycle를 사용하는데, Main 디스패처를 주입해서 사용한 이유가 있나요?

Copy link
Contributor Author

@ThirFir ThirFir Oct 29, 2024

Choose a reason for hiding this comment

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

launch에 IO Dispatcher를 지정하려 했는데 안했네요 ㅎ.. 🤐

lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
val shouldShow = onboardingRepository.getShouldOnboarding(type.name)
withContext(mainDispatcher) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

이것도 마찬가지로 위와 같은 질문!

onboardingRepository: OnboardingRepository,
@ApplicationContext context: Context
): OnboardingManager {
return OnboardingManager(onboardingRepository, context, Dispatchers.Main)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Dispatchers.Main 이렇게 주입해서 사용할거면 클래스 생성자 dafult 파라미터는 어떠신가요~?
추가적으로 immediate를 사용하지 않고 그냥 Main 디스패처를 사용한 이유가 있나요?

Copy link
Contributor Author

@ThirFir ThirFir Oct 29, 2024

Choose a reason for hiding this comment

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

말씀대로 생성자로 옮겨도 될 거 같네요. 반영하겠습니다~
그리고 위 답(launch에 IO Dispatcher) 에 이어서 부모 코루틴이 IO Dispatcher CoroutineContext를 가지기 때문에, 어차피 Context Switching이 일어나야 하므로 Main 디스패처로 두었고, Main.Immediate는 구현하면서 고려는 하지 않았었습니다.

@@ -13,16 +13,4 @@ class DiningRepositoryImpl @Inject constructor(
override suspend fun getDining(date: String): List<Dining> {
return diningRemoteDataSource.getDining(date).map(DiningResponse::toDining)
Copy link
Collaborator

Choose a reason for hiding this comment

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

메서드 참조로 함수 호출한 이유가 있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

예전에 한거라 잘 기억은 안나네요...
특별한 이유는 없었을 겁니다...!

return kotlin.runCatching {
diningRepository.getAuthDining(date)
}
return kotlin.runCatching {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return kotlin.runCatching {
return runCatching {

kotlin 지워도 좋을 것 같네요~

@@ -268,7 +275,8 @@ class ArticleListFragment : Fragment() {
}

private fun createChip(text: String, isCheckable: Boolean, onChipClicked: () -> Unit): Chip {
val chip = layoutInflater.inflate(R.layout.chip_layout, binding.chipGroupMyKeywords, false) as Chip
val chip =
layoutInflater.inflate(R.layout.chip_layout, binding.chipGroupMyKeywords, false) as Chip
Copy link
Collaborator

Choose a reason for hiding this comment

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

다른 곳들도 as를 사용하셨네요! 안전성의 문제이고 논리적으로 원하는 형변환을 할 수 있지만 그래도 모든 상황을 예측할 수 없으니 as?로 통일해보는 것은 어떨까? 하는 의견을 내봅니다~ ☺️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영하겠습니다 ~

.stateIn(
val articlePagination: StateFlow<ArticlePaginationState> =
combine(currentBoard, currentPage, selectedKeyword) { board, page, query ->
_isLoading.value = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

flow onStart 중간 연산자 사용하는 건 어떠신가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

onStart는 flow가 처음 구독될 때만 실행되므로, currentBoard, currentPage, selectedKeyword가 바뀔 때마다 실행되지는 않기에 로딩 상태를 제대로 반영하지 못했습니다 !

articlePagination.toArticlePaginationState()
}
}.onEach {
_isLoading.value = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

이것도 onCompletion 사용하면 가독성이 더 좋아질 것 같아요! 개인적으로 onStart, onCompletion 사용하지 않으시면 편하실 때루 해도 괜춘해여~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hot Stream이기 때문에 Flow가 끝나지 않아, onCompletion은 호출되지 않는 것으로 알고 있습니다 ~!

viewLifecycleOwner.showOnboardingIfNeeded(
OnboardingType.DINING_SHARE,
) {
lifecycleScope.launch(Dispatchers.Default) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

백그라운드 스레드 사용한 이유가 있나요?
코루틴 스코프 때문이라면 showOnboardingIfNeeded 고차함수의 action 파라미터를 suspend로 사용하는건 어떠세요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

백그라운드 쓴 건 delay주려고 했던 건데, 다시 보니 백그라운드로 안해도 될 것 같네요 !

action을 suspend로 두지 않은 건, action 동작에서 UI 작업이 주를 이룰 것으로 예상하고 구현했기 때문입니다.

) {
lifecycleScope.launch(Dispatchers.Default) {
delay(200)
withContext(Dispatchers.Main) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

만약에 백그라운드 스레드가 제거되면 해당 디스패처 context 바꾸는 코드도 없어져도 좋을 것 같네요!

@ThirFir
Copy link
Contributor Author

ThirFir commented Oct 29, 2024

코드 작성할 때, 함수화 좀 신경써주면 좋을 것 같아요! 리뷰할 때 코드 읽기가 너무 힘들어서 뭐하는 코드인지 다시 한 번 확인하게 되네요 ㅠㅠ 🥲

이번 pr에서 어떤 부분에서 그런 점이 느껴졌는지 알려주시면 감사드리겠습니다 !
사실 이 PR이 코드 작성 자체가 많진 않은데, IDE에 의해 자동으로 코드 formatting이 일어나서 변경이 많아 보인 것 같고, 아마 그것 때문에 많이 헷갈리시지 않았을까 예상해봅니다...
그래서 예전에 작성했던 부분에 대해서 리뷰를 달아주신 부분도 많이 있는 것 같아요 ㅠ

IDE 코드 포맷팅을 꺼놔야겠습니다...

onboarding 모듈이 정확히 하는게 뭔가요?

사용자에게 최초 1회에만 실행시킬 동작을 제시할 때 사용하는 것으로 알아주시면 될 것 같습니다.
캠퍼스팀 작업하면서, 신기능 구현하면서 그에 대한 소개를 툴팁으로 제공하고 있는데, 툴팁 쓰이는 부분이 점점 많이지기에 모듈화해봤습니다 ~

@Jokwanhee
Copy link
Collaborator

그렇군용 IDE 포맷팅이 많이 들어가서 더 그랬던 것 같기도 하네요~

오늘 안드 회의하는데, 오프회의로 PR 보면서 리뷰에 대해서 복기해보는건 어떨까요? (어프도 바로 해드리고 ☺️)

@ThirFir
Copy link
Contributor Author

ThirFir commented Oct 29, 2024

오늘 안드 회의하는데, 오프회의로 PR 보면서 리뷰에 대해서 복기해보는건 어떨까요? (어프도 바로 해드리고 ☺️)

좋습니다 !!! 👊

Copy link
Collaborator

@Jokwanhee Jokwanhee left a comment

Choose a reason for hiding this comment

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

고생했습니다!

Copy link
Contributor

@hsgo2430 hsgo2430 left a comment

Choose a reason for hiding this comment

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

모듈화 힘드셨을텐데 고생하셨어요!

@ThirFir ThirFir merged commit 7861aab into develop Oct 30, 2024
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