시리즈 콘텐츠 리스트
- 정렬(최신순, 등록순) 추가
This commit is contained in:
@@ -20,6 +20,37 @@ struct SeriesContentAllView: View {
|
||||
VStack(spacing: 0) {
|
||||
DetailNavigationBar(title: "\(seriesTitle) - 전체회차 듣기")
|
||||
|
||||
HStack(spacing: 13.3) {
|
||||
Spacer()
|
||||
|
||||
Text("최신순")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(
|
||||
Color.graye2
|
||||
.opacity(viewModel.sortType == .NEWEST ? 1 : 0.5)
|
||||
)
|
||||
.onTapGesture {
|
||||
if viewModel.sortType != .NEWEST {
|
||||
viewModel.sortType = .NEWEST
|
||||
}
|
||||
}
|
||||
|
||||
Text("등록순")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(
|
||||
Color.graye2
|
||||
.opacity(viewModel.sortType == .OLDEST ? 1 : 0.5)
|
||||
)
|
||||
.onTapGesture {
|
||||
if viewModel.sortType != .OLDEST {
|
||||
viewModel.sortType = .OLDEST
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 13.3)
|
||||
.padding(.horizontal, 20)
|
||||
.background(Color.gray16)
|
||||
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
VStack(spacing: 12) {
|
||||
ForEach(0..<viewModel.seriesContentList.count, id: \.self) { index in
|
||||
|
||||
@@ -19,14 +19,24 @@ final class SeriesContentAllViewModel: ObservableObject {
|
||||
@Published var isShowPopup = false
|
||||
@Published var seriesContentList = [GetSeriesContentListItem]()
|
||||
|
||||
@Published var sortType: SeriesListAllViewModel.SeriesSortType = .NEWEST {
|
||||
didSet {
|
||||
page = 1
|
||||
isLast = false
|
||||
getSeriesContentList()
|
||||
}
|
||||
}
|
||||
|
||||
var page = 1
|
||||
var isLast = false
|
||||
private let pageSize = 10
|
||||
|
||||
func getSeriesContentList() {
|
||||
if !isLoading && !isLast {
|
||||
isLoading = true
|
||||
|
||||
repository
|
||||
.getSeriesContentList(seriesId: seriesId, page: page, size: pageSize)
|
||||
.getSeriesContentList(seriesId: seriesId, page: page, size: pageSize, sortType: sortType)
|
||||
.sink { result in
|
||||
switch result {
|
||||
case .finished:
|
||||
|
||||
Reference in New Issue
Block a user