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