parent
dd6c2fe469
commit
92608b5449
|
@ -6,5 +6,5 @@
|
|||
//
|
||||
|
||||
enum AuditionApplicantSortType: String, Codable {
|
||||
case NEWEST, LIKE
|
||||
case NEWEST, LIKES
|
||||
}
|
||||
|
|
|
@ -41,10 +41,12 @@ struct AuditionView: View {
|
|||
|
||||
AuditionItemView(item: item)
|
||||
.onTapGesture {
|
||||
AppState.shared
|
||||
.setAppStep(
|
||||
step: .auditionDetail(auditionId: item.id)
|
||||
)
|
||||
if !item.isOff {
|
||||
AppState.shared
|
||||
.setAppStep(
|
||||
step: .auditionDetail(auditionId: item.id)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if $0 == viewModel.firstIsOffIndex {
|
||||
|
@ -74,19 +76,23 @@ struct AuditionView: View {
|
|||
AuditionItemView(item: item)
|
||||
.padding(.top, 16.7)
|
||||
.onTapGesture {
|
||||
AppState.shared
|
||||
.setAppStep(
|
||||
step: .auditionDetail(auditionId: item.id)
|
||||
)
|
||||
if !item.isOff {
|
||||
AppState.shared
|
||||
.setAppStep(
|
||||
step: .auditionDetail(auditionId: item.id)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
AuditionItemView(item: item)
|
||||
.onTapGesture {
|
||||
AppState.shared
|
||||
.setAppStep(
|
||||
step: .auditionDetail(auditionId: item.id)
|
||||
)
|
||||
if !item.isOff {
|
||||
AppState.shared
|
||||
.setAppStep(
|
||||
step: .auditionDetail(auditionId: item.id)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,10 +47,12 @@ struct AuditionDetailView: View {
|
|||
ForEach(0..<response.roleList.count, id: \.self) {
|
||||
let role = response.roleList[$0]
|
||||
|
||||
AuditionDetailRoleItemView(item: response.roleList[$0])
|
||||
AuditionDetailRoleItemView(item: role)
|
||||
.onTapGesture {
|
||||
AppState.shared
|
||||
.setAppStep(step: .auditionRoleDetail(roleId: role.roleId))
|
||||
if !role.isComplete {
|
||||
AppState.shared
|
||||
.setAppStep(step: .auditionRoleDetail(roleId: role.roleId))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,43 @@ struct AuditionRoleDetailView: View {
|
|||
.foregroundColor(Color.grayee)
|
||||
.padding(.top, 15)
|
||||
} else {
|
||||
HStack(spacing: 0) {
|
||||
Text("참여자")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color.graybb)
|
||||
|
||||
Text("\(viewModel.totalCount)")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color.button)
|
||||
.padding(.leading, 2.3)
|
||||
|
||||
Text("명")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color.graybb)
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("최신순")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(
|
||||
viewModel.sortType == .NEWEST ? Color.button : Color.graybb
|
||||
)
|
||||
.onTapGesture {
|
||||
viewModel.setSortType(sortType: .NEWEST)
|
||||
}
|
||||
|
||||
Text("좋아요순")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(
|
||||
viewModel.sortType == .LIKES ? Color.button : Color.graybb
|
||||
)
|
||||
.onTapGesture {
|
||||
viewModel.setSortType(sortType: .LIKES)
|
||||
}
|
||||
.padding(.leading, 13.3)
|
||||
}
|
||||
.padding(.top, 15)
|
||||
|
||||
VStack(spacing: 5.3) {
|
||||
ForEach(0..<viewModel.applicantList.count, id: \.self) {
|
||||
let applicant = viewModel.applicantList[$0]
|
||||
|
|
|
@ -24,11 +24,9 @@ final class AuditionRoleDetailViewModel: ObservableObject {
|
|||
@Published var name = "보이스온"
|
||||
@Published var auditionRoleDetail: GetAuditionRoleDetailResponse? = nil
|
||||
|
||||
@Published var sortType = AuditionApplicantSortType.NEWEST {
|
||||
@Published private (set) var sortType = AuditionApplicantSortType.NEWEST {
|
||||
didSet {
|
||||
page = 1
|
||||
isLast = false
|
||||
getAuditionRoleDetail()
|
||||
refreshApplicantList()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,6 +55,12 @@ final class AuditionRoleDetailViewModel: ObservableObject {
|
|||
|
||||
var onFailure: () -> Void = {}
|
||||
|
||||
func setSortType(sortType: AuditionApplicantSortType) {
|
||||
if self.sortType != sortType {
|
||||
self.sortType = sortType
|
||||
}
|
||||
}
|
||||
|
||||
func getAuditionRoleDetail() {
|
||||
isLoading = true
|
||||
|
||||
|
@ -237,13 +241,8 @@ final class AuditionRoleDetailViewModel: ObservableObject {
|
|||
self.phoneNumber = ""
|
||||
self.fileName = ""
|
||||
self.soundData = nil
|
||||
self.applicantList = []
|
||||
self.totalCount = 0
|
||||
|
||||
self.page = 1
|
||||
self.isLast = false
|
||||
self.getAuditionRoleDetail()
|
||||
|
||||
self.refreshApplicantList()
|
||||
onSuccess()
|
||||
} else {
|
||||
if let message = decoded.message {
|
||||
|
@ -323,6 +322,14 @@ final class AuditionRoleDetailViewModel: ObservableObject {
|
|||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
private func refreshApplicantList() {
|
||||
self.page = 1
|
||||
self.isLast = false
|
||||
self.totalCount = 0
|
||||
self.applicantList = []
|
||||
self.getAuditionApplicantList()
|
||||
}
|
||||
|
||||
func deleteAllRecordingFilesWithNamePrefix(_ prefix: String) {
|
||||
let fileManager = FileManager.default
|
||||
let documentsURL = getDocumentsDirectory()
|
||||
|
|
Loading…
Reference in New Issue