From 9f32c39f588f1947876ed78893e1d2b07749c76d Mon Sep 17 00:00:00 2001 From: Sangwook123 Date: Fri, 8 Sep 2023 05:19:26 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[feat]=20#190=20=EC=B4=88=EA=B8=B0=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=EC=A0=95=EB=B3=B4=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=EC=8A=A4=ED=86=A0=EC=96=B4=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B0=9B=EC=95=84=EC=99=80=EC=84=9C=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/mypage/MyPageFragment.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt index 09559145..2ab22f6a 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt @@ -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.runBlocking import org.go.sopt.winey.R import org.go.sopt.winey.databinding.FragmentMyPageBinding import org.go.sopt.winey.domain.entity.User @@ -51,6 +52,7 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ super.onViewCreated(view, savedInstanceState) amplitudeUtils.logEvent("view_mypage") + initUserData() init1On1ButtonClickListener() initTermsButtonClickListener() initLevelHelpButtonClickListener() @@ -84,6 +86,14 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ mainViewModel.getUser() } + private fun initUserData() { + val data = runBlocking { dataStoreRepository.getUserInfo().first() } + if (data != null) { + updateUserInfo(data) + initTargetModifyButtonClickListener(data) + } + } + private fun initNicknameButtonClickListener() { binding.ivMypageNickname.setOnClickListener { amplitudeUtils.logEvent("click_edit_nickname") From 86041aca86dc86c514362fa171860da848fb02f9 Mon Sep 17 00:00:00 2001 From: Sangwook123 Date: Sat, 9 Sep 2023 18:12:56 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[mod]=20#190=20viewLifeCycleScope=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/mypage/MyPageFragment.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt index 24085cd3..90011349 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/MyPageFragment.kt @@ -16,7 +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.runBlocking +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 @@ -88,10 +88,12 @@ class MyPageFragment : BindingFragment(R.layout.fragment_ } private fun initUserData() { - val data = runBlocking { dataStoreRepository.getUserInfo().first() } - if (data != null) { - updateUserInfo(data) - initTargetModifyButtonClickListener(data) + viewLifeCycleScope.launch { + val data = dataStoreRepository.getUserInfo().first() + if (data != null) { + updateUserInfo(data) + initTargetModifyButtonClickListener(data) + } } }