라이브 탭 새로고침 방법 변경 - 당겨서 새로고침 -> 지금 라이브 중 옆 새로고침 버튼으로 변경

This commit is contained in:
Yu Sung 2023-12-22 03:34:38 +09:00
parent ceef432695
commit 15421ca4d5
6 changed files with 42 additions and 11 deletions

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_refresh.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

View File

@ -19,12 +19,7 @@ struct LiveView: View {
GeometryReader { geo in
ZStack(alignment: .bottomTrailing) {
RefreshableScrollView(
refreshing: $viewModel.isRefresh,
action: {
viewModel.getSummary()
}
) {
ScrollView(.vertical, showsIndicators: false) {
LazyVStack(spacing: 40) {
if viewModel.recommendLiveItems.count > 0 {
SectionRecommendLiveView(items: viewModel.recommendLiveItems)
@ -47,6 +42,9 @@ struct LiveView: View {
},
onTapCreateLive: {
AppState.shared.setAppStep(step: .createLive(timeSettingMode: .NOW, onSuccess: onCreateSuccess))
},
onClickRefresh: {
viewModel.refreshLiveNow()
}
)

View File

@ -457,6 +457,14 @@ final class LiveViewModel: ObservableObject {
}
}
func refreshLiveNow() {
page = 1
isLast = false
self.liveNowItems.removeAll()
getLiveNowList()
}
private func getRoomDetail(roomId: Int, onSuccess: @escaping (GetRoomDetailResponse) -> Void) {
isLoading = true
repository.getRoomDetail(roomId: roomId)

View File

@ -13,6 +13,7 @@ struct SectionLiveNowView: View {
let onClickParticipant: (Int) -> Void
let onTapCreateLive: () -> Void
let onClickRefresh: () -> Void
var body: some View {
LazyVStack(spacing: 13.3) {
@ -25,6 +26,12 @@ struct SectionLiveNowView: View {
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "ff5c49"))
Image("ic_refresh")
.padding(.leading, 10)
.onTapGesture {
onClickRefresh()
}
Spacer()
if items.count > 0 {
@ -63,7 +70,6 @@ struct SectionLiveNowView: View {
}
.padding(.horizontal, 13.3)
}
.padding(.top, 28.3)
} else {
VStack(spacing: 0) {
Image("ic_no_item")
@ -81,7 +87,6 @@ struct SectionLiveNowView: View {
.frame(width: screenSize().width - 26.7)
.background(Color(hex: "13181b"))
.cornerRadius(4.7)
.padding(.top, 28.3)
}
}
}
@ -92,7 +97,8 @@ struct SectionLiveNowView_Previews: PreviewProvider {
SectionLiveNowView(
items: [],
onClickParticipant: { _ in },
onTapCreateLive: {}
onTapCreateLive: {},
onClickRefresh: {}
)
}
}

View File

@ -86,7 +86,6 @@ struct SectionLiveReservationView: View {
}
.padding(.horizontal, 13.3)
.frame(width: screenSize().width)
.padding(.top, 13.3)
} else {
VStack(spacing: 0) {
Image("ic_no_item")
@ -104,7 +103,6 @@ struct SectionLiveReservationView: View {
.frame(width: screenSize().width - 26.7)
.background(Color(hex: "13181b"))
.cornerRadius(4.7)
.padding(.top, 28.3)
}
}
}