diff --git a/SodaLive/Resources/Assets.xcassets/ic_refresh.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/ic_refresh.imageset/Contents.json new file mode 100644 index 0000000..5c4a262 --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/ic_refresh.imageset/Contents.json @@ -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 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/ic_refresh.imageset/ic_refresh.png b/SodaLive/Resources/Assets.xcassets/ic_refresh.imageset/ic_refresh.png new file mode 100644 index 0000000..116c9c5 Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/ic_refresh.imageset/ic_refresh.png differ diff --git a/SodaLive/Sources/Live/LiveView.swift b/SodaLive/Sources/Live/LiveView.swift index 0767e95..acbbdfb 100644 --- a/SodaLive/Sources/Live/LiveView.swift +++ b/SodaLive/Sources/Live/LiveView.swift @@ -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() } ) diff --git a/SodaLive/Sources/Live/LiveViewModel.swift b/SodaLive/Sources/Live/LiveViewModel.swift index 3688c31..6a42667 100644 --- a/SodaLive/Sources/Live/LiveViewModel.swift +++ b/SodaLive/Sources/Live/LiveViewModel.swift @@ -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) diff --git a/SodaLive/Sources/Live/Now/SectionLiveNowView.swift b/SodaLive/Sources/Live/Now/SectionLiveNowView.swift index 1937f18..291bb74 100644 --- a/SodaLive/Sources/Live/Now/SectionLiveNowView.swift +++ b/SodaLive/Sources/Live/Now/SectionLiveNowView.swift @@ -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: {} ) } } diff --git a/SodaLive/Sources/Live/Reservation/SectionLiveReservationView.swift b/SodaLive/Sources/Live/Reservation/SectionLiveReservationView.swift index 90e10ac..3ff06d3 100644 --- a/SodaLive/Sources/Live/Reservation/SectionLiveReservationView.swift +++ b/SodaLive/Sources/Live/Reservation/SectionLiveReservationView.swift @@ -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) } } }