From 06e8df32d2664d7982e5e9e35b361befac74052b Mon Sep 17 00:00:00 2001 From: leeeha Date: Mon, 21 Aug 2023 22:09:51 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20#132=20=EB=8C=93=EA=B8=80=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=ED=9B=84=20=EC=9C=84=EB=8B=88=ED=94=BC=EB=93=9C=20?= =?UTF-8?q?=EB=8B=A4=EC=8B=9C=20=EB=8F=8C=EC=95=84=EC=98=A4=EB=A9=B4=20?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20=EC=88=98=EA=B0=80=20=EA=B0=B1=EC=8B=A0?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/go/sopt/winey/presentation/main/MainActivity.kt | 6 +++--- .../sopt/winey/presentation/main/feed/WineyFeedFragment.kt | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/android/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/com/android/go/sopt/winey/presentation/main/MainActivity.kt index dda3700e..870e6492 100644 --- a/app/src/main/java/com/android/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/com/android/go/sopt/winey/presentation/main/MainActivity.kt @@ -25,14 +25,14 @@ import kotlinx.coroutines.flow.onEach @AndroidEntryPoint class MainActivity : BindingActivity(R.layout.activity_main) { - private val viewModel by viewModels() + private val mainViewModel by viewModels() private val isUploadSuccess by lazy { intent.extras?.getBoolean(EXTRA_UPLOAD_KEY, false) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // 위니피드, 마이페이지 프래그먼트에서 getUserState 관찰 - viewModel.getUser() + mainViewModel.getUser() initFragment() initBnvItemSelectedListener() @@ -84,7 +84,7 @@ class MainActivity : BindingActivity(R.layout.activity_main } private fun setupLogoutState() { - viewModel.logoutState.flowWithLifecycle(lifecycle).onEach { state -> + mainViewModel.logoutState.flowWithLifecycle(lifecycle).onEach { state -> when (state) { is UiState.Loading -> { } diff --git a/app/src/main/java/com/android/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt b/app/src/main/java/com/android/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt index 64adf881..b9742eee 100644 --- a/app/src/main/java/com/android/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt +++ b/app/src/main/java/com/android/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt @@ -71,6 +71,12 @@ class WineyFeedFragment : BindingFragment(R.layout.fra initNotificationButtonClickListener() } + // 상세 피드 갔다가 다시 돌아오면 갱신된 데이터가 보이도록 + override fun onStart() { + super.onStart() + viewModel.getWineyFeed() + } + private fun initAdapter() { wineyFeedHeaderAdapter = WineyFeedHeaderAdapter() wineyFeedLoadAdapter = WineyFeedLoadAdapter()