Skip to content

Commit

Permalink
[fix] #132 댓글 생성 후 위니피드 다시 돌아오면 댓글 수가 갱신되도록
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeha committed Aug 21, 2023
1 parent 092707d commit 06e8df3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import kotlinx.coroutines.flow.onEach

@AndroidEntryPoint
class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main) {
private val viewModel by viewModels<MainViewModel>()
private val mainViewModel by viewModels<MainViewModel>()
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()
Expand Down Expand Up @@ -84,7 +84,7 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
}

private fun setupLogoutState() {
viewModel.logoutState.flowWithLifecycle(lifecycle).onEach { state ->
mainViewModel.logoutState.flowWithLifecycle(lifecycle).onEach { state ->
when (state) {
is UiState.Loading -> {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ class WineyFeedFragment : BindingFragment<FragmentWineyFeedBinding>(R.layout.fra
initNotificationButtonClickListener()
}

// 상세 피드 갔다가 다시 돌아오면 갱신된 데이터가 보이도록
override fun onStart() {
super.onStart()
viewModel.getWineyFeed()
}

private fun initAdapter() {
wineyFeedHeaderAdapter = WineyFeedHeaderAdapter()
wineyFeedLoadAdapter = WineyFeedLoadAdapter()
Expand Down

0 comments on commit 06e8df3

Please sign in to comment.