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

[refactor] 마이페이지 / 로딩프로그레스바 - 애니메이션 간의 실행순서 보장 로직 개선 #298

Merged
merged 2 commits into from
Jun 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import androidx.fragment.app.activityViewModels
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand Down Expand Up @@ -285,13 +283,14 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
when (state) {
is UiState.Success -> {
dismissLoadingProgressBar()
delay(100)
val data = dataStoreRepository.getUserInfo().first() ?: return@launch
updateUserInfo(data)
setUpUserGoalByLevel(data)
setUpUserDataByGoal(data)
animate2weeksSaveGraph(data.amountSavedTwoWeeks)
animate2weeksSpendGraph(data.amountSpentTwoWeeks)
binding.root.post {
val data = state.data ?: return@post
updateUserInfo(data)
setUpUserGoalByLevel(data)
setUpUserDataByGoal(data)
animate2weeksSaveGraph(data.amountSavedTwoWeeks)
animate2weeksSpendGraph(data.amountSpentTwoWeeks)
}
Copy link
Member

Choose a reason for hiding this comment

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

저도 덕분에 스레드 간 통신에 사용되는 Handler, Looper, 메시지 큐 개념에 대해 복습할 수 있었어요 ㅎㅎ
delay 함수로 UI 스레드 블로킹 하는 것보다 훨씬 나은 방식인 거 같습니다! 👍

}

is UiState.Failure -> {
Expand Down
Loading