-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Feature] 온보딩 모듈 추가 #438
Conversation
b1fba07
to
9f2792a
Compare
There was a problem hiding this 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이미 lifecycleScope 와 repeatOnLifecycle를 사용하는데, Main 디스패처를 주입해서 사용한 이유가 있나요?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 디스패처를 사용한 이유가 있나요?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메서드 참조로 함수 호출한 이유가 있나요?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
다른 곳들도 as를 사용하셨네요! 안전성의 문제이고 논리적으로 원하는 형변환을 할 수 있지만 그래도 모든 상황을 예측할 수 없으니 as?로 통일해보는 것은 어떨까? 하는 의견을 내봅니다~
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flow onStart 중간 연산자 사용하는 건 어떠신가요?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이것도 onCompletion 사용하면 가독성이 더 좋아질 것 같아요! 개인적으로 onStart, onCompletion 사용하지 않으시면 편하실 때루 해도 괜춘해여~
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
백그라운드 스레드 사용한 이유가 있나요?
코루틴 스코프 때문이라면 showOnboardingIfNeeded 고차함수의 action 파라미터를 suspend로 사용하는건 어떠세요?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
만약에 백그라운드 스레드가 제거되면 해당 디스패처 context 바꾸는 코드도 없어져도 좋을 것 같네요!
이번 pr에서 어떤 부분에서 그런 점이 느껴졌는지 알려주시면 감사드리겠습니다 ! IDE 코드 포맷팅을 꺼놔야겠습니다...
사용자에게 최초 1회에만 실행시킬 동작을 제시할 때 사용하는 것으로 알아주시면 될 것 같습니다. |
그렇군용 IDE 포맷팅이 많이 들어가서 더 그랬던 것 같기도 하네요~ 오늘 안드 회의하는데, 오프회의로 PR 보면서 리뷰에 대해서 복기해보는건 어떨까요? (어프도 바로 해드리고 |
좋습니다 !!! 👊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
모듈화 힘드셨을텐데 고생하셨어요!
🐥 개요
👾 상세 작업 내용
👀 부가 설명
🐰 결과