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] 마이페이지 / 마이페이지 진입 시 서버와의 통신 이전에 데이터스토어에 저장된 정보 출력 #191

Merged
merged 3 commits into from
Sep 9, 2023
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 @@ -16,6 +16,7 @@ import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import org.go.sopt.winey.R
import org.go.sopt.winey.databinding.FragmentMyPageBinding
import org.go.sopt.winey.domain.entity.User
Expand Down Expand Up @@ -50,6 +51,8 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
amplitudeUtils.logEvent("view_mypage")

initUserData()
initNavigation()
init1On1ButtonClickListener()
initTermsButtonClickListener()
Expand Down Expand Up @@ -84,6 +87,16 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_
mainViewModel.getUser()
}

private fun initUserData() {
viewLifeCycleScope.launch {
val data = dataStoreRepository.getUserInfo().first()
if (data != null) {
updateUserInfo(data)
initTargetModifyButtonClickListener(data)
}
}
}

Copy link
Member

Choose a reason for hiding this comment

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

서버 통신으로 데이터 가져오는데 걸리는 로딩 시간 때문에, 매번 캐릭터 이미지가 깜박거리는 게 신경쓰였는데 넘 좋네용!! 👍👍

private fun initNicknameButtonClickListener() {
binding.ivMypageNickname.setOnClickListener {
amplitudeUtils.logEvent("click_edit_nickname")
Expand Down