Skip to content

Commit

Permalink
[AN/USER] fix: SwipeRefresh 무한 로딩 버그 수정 (#514) (#516)
Browse files Browse the repository at this point in the history
* fix: 축제 목록 swipe refresh 수정

* fix: 마이페이지 swipe refresh 수정

* fix: 티켓 목록 swipe refresh 수정

* fix: 축제 상세 swipe refresh 수정
  • Loading branch information
EmilyCh0 authored and BGuga committed Oct 17, 2023
1 parent 1f9333f commit df1ff0f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ class FestivalListFragment : Fragment(R.layout.fragment_festival_list) {

binding.srlFestivalList.setOnRefreshListener {
vm.loadFestivals()
binding.srlFestivalList.isRefreshing = false
}
}

private fun updateUi(uiState: FestivalListUiState) {
when (uiState) {
is FestivalListUiState.Loading,
is FestivalListUiState.Error,
-> binding.srlFestivalList.isRefreshing = false
-> Unit

is FestivalListUiState.Success -> handleSuccess(uiState)
}
}

private fun handleSuccess(uiState: FestivalListUiState.Success) {
adapter.submitList(uiState.festivals)
binding.srlFestivalList.isRefreshing = false
}

private fun handleEvent(event: FestivalListEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class MyPageFragment : Fragment(R.layout.fragment_my_page) {

is MyPageUiState.Success -> handleSuccess(uiState)
}
binding.srlMyPage.isRefreshing = false
}

private fun handleEvent(event: MyPageEvent) {
Expand Down Expand Up @@ -116,6 +115,7 @@ class MyPageFragment : Fragment(R.layout.fragment_my_page) {

binding.srlMyPage.setOnRefreshListener {
vm.loadUserInfo()
binding.srlMyPage.isRefreshing = false
}

binding.tvSchoolAuthorization.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ class TicketListFragment : Fragment(R.layout.fragment_ticket_list) {
when (uiState) {
is TicketListUiState.Loading,
is TicketListUiState.Error,
-> binding.srlTicketList.isRefreshing = false
-> Unit

is TicketListUiState.Success -> {
adapter.submitList(uiState.tickets)
binding.srlTicketList.isRefreshing = false
}
}
}
Expand Down Expand Up @@ -106,6 +105,7 @@ class TicketListFragment : Fragment(R.layout.fragment_ticket_list) {
private fun initRefresh() {
binding.srlTicketList.setOnRefreshListener {
vm.loadCurrentTickets()
binding.srlTicketList.isRefreshing = false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,21 @@ class TicketReserveActivity : AppCompatActivity() {
festivalId = intent.getLongExtra(KEY_FESTIVAL_ID, -1),
refresh = true,
)
binding.srlTicketReserve.isRefreshing = false
}
}

private fun updateUi(uiState: TicketReserveUiState) = when (uiState) {
is TicketReserveUiState.Loading,
is TicketReserveUiState.Error,
-> binding.srlTicketReserve.isRefreshing = false
-> Unit

is TicketReserveUiState.Success -> updateSuccess(uiState)
}

private fun updateSuccess(successState: TicketReserveUiState.Success) {
headerAdapter.submitList(listOf(successState.festival))
contentsAdapter.submitList(successState.stages)
binding.srlTicketReserve.isRefreshing = false
}

companion object {
Expand Down

0 comments on commit df1ff0f

Please sign in to comment.