Skip to content

Commit

Permalink
Merge pull request #247 from TeamPINGLE/fix-reissue
Browse files Browse the repository at this point in the history
[fix] 토큰 재발급 이슈 해결
  • Loading branch information
jihyunniiii committed Mar 10, 2024
2 parents 4e63014 + dab9dae commit 7b9727c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import androidx.fragment.app.activityViewModels
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.sopt.pingle.R
Expand Down Expand Up @@ -134,6 +136,20 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
}

private fun collectData() {
combine(
homeViewModel.category.flowWithLifecycle(viewLifecycleOwner.lifecycle).distinctUntilChanged(),
homeViewModel.searchWord.flowWithLifecycle(viewLifecycleOwner.lifecycle).distinctUntilChanged(),
homeViewModel.mainListOrderType.flowWithLifecycle(viewLifecycleOwner.lifecycle).distinctUntilChanged(),
homeViewModel.homeViewType.flowWithLifecycle(viewLifecycleOwner.lifecycle).distinctUntilChanged()
) { _, _, _, homeViewType ->
homeViewType
}.onEach { homeViewType ->
when (homeViewType) {
HomeViewType.MAIN_LIST -> homeViewModel.getMainListPingleList()
HomeViewType.MAP -> homeViewModel.getPinListWithoutFilter()
}
}.launchIn(viewLifecycleOwner.lifecycleScope)

homeViewModel.homeViewType.flowWithLifecycle(viewLifecycleOwner.lifecycle).onEach {
with(binding) {
vpHome.setCurrentItem(homeViewModel.homeViewType.value.index, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.sopt.pingle.R
Expand Down Expand Up @@ -122,18 +120,6 @@ class MainListFragment : BindingFragment<FragmentMainListBinding>(R.layout.fragm
}

private fun collectData() {
combine(
homeViewModel.searchWord.flowWithLifecycle(viewLifecycleOwner.lifecycle)
.distinctUntilChanged(),
homeViewModel.category.flowWithLifecycle(viewLifecycleOwner.lifecycle)
.distinctUntilChanged(),
homeViewModel.mainListOrderType.flowWithLifecycle(viewLifecycleOwner.lifecycle)
.distinctUntilChanged()
) { _, _, _ ->
}.onEach {
homeViewModel.getMainListPingleList()
}.launchIn(viewLifecycleOwner.lifecycleScope)

homeViewModel.mainListPingleListState.flowWithLifecycle(
viewLifecycleOwner.lifecycle,
Lifecycle.State.CREATED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import com.naver.maps.map.OnMapReadyCallback
import com.naver.maps.map.overlay.OverlayImage
import com.naver.maps.map.util.FusedLocationSource
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
Expand Down Expand Up @@ -194,16 +193,6 @@ class MapFragment : BindingFragment<FragmentMapBinding>(R.layout.fragment_map),
}

private fun collectData() {
combine(
homeViewModel.category.flowWithLifecycle(viewLifecycleOwner.lifecycle)
.distinctUntilChanged(),
homeViewModel.searchWord.flowWithLifecycle(viewLifecycleOwner.lifecycle)
.distinctUntilChanged()
) { _, _ ->
}.onEach {
homeViewModel.getPinListWithoutFilter()
}.launchIn(viewLifecycleOwner.lifecycleScope)

homeViewModel.markerModelData.flowWithLifecycle(viewLifecycleOwner.lifecycle)
.onEach { markerModelData ->
(markerModelData.first == DEFAULT_SELECTED_MARKER_POSITION).let { isMarkerUnselected ->
Expand Down

0 comments on commit 7b9727c

Please sign in to comment.