parent
fa849dd5b6
commit
d1a90ad599
|
@ -14,6 +14,7 @@ struct AudioContentCommentListView: View {
|
|||
|
||||
let creatorId: Int
|
||||
let audioContentId: Int
|
||||
let isShowSecret: Bool
|
||||
|
||||
@StateObject var viewModel = AudioContentCommentListViewModel()
|
||||
|
||||
|
@ -50,6 +51,28 @@ struct AudioContentCommentListView: View {
|
|||
.padding(.bottom, 13.3)
|
||||
.padding(.horizontal, 13.3)
|
||||
|
||||
if isShowSecret {
|
||||
HStack(spacing: 8) {
|
||||
Spacer()
|
||||
|
||||
Image(viewModel.isSecret ? "btn_select_checked" : "btn_select_normal")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
.onTapGesture {
|
||||
viewModel.isSecret.toggle()
|
||||
}
|
||||
|
||||
Text("비밀댓글")
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.foregroundColor(Color.grayee)
|
||||
.onTapGesture {
|
||||
viewModel.isSecret.toggle()
|
||||
}
|
||||
}
|
||||
.padding(.bottom, 13.3)
|
||||
.padding(.horizontal, 13.3)
|
||||
}
|
||||
|
||||
HStack(spacing: 8) {
|
||||
KFImage(URL(string: UserDefaults.string(forKey: .profileImage)))
|
||||
.cancelOnDisappear(true)
|
||||
|
|
|
@ -22,6 +22,8 @@ class AudioContentCommentListViewModel: ObservableObject {
|
|||
@Published var totalCommentCount = 0
|
||||
@Published var commentList = [GetAudioContentCommentListItem]()
|
||||
|
||||
@Published var isSecret = false
|
||||
|
||||
var audioContentId = 0
|
||||
var page = 1
|
||||
var isLast = false
|
||||
|
@ -84,7 +86,7 @@ class AudioContentCommentListViewModel: ObservableObject {
|
|||
|
||||
isLoading = true
|
||||
|
||||
repository.registerComment(audioContentId: audioContentId, comment: comment)
|
||||
repository.registerComment(audioContentId: audioContentId, comment: comment, isSecret: isSecret)
|
||||
.sink { result in
|
||||
switch result {
|
||||
case .finished:
|
||||
|
|
|
@ -361,7 +361,8 @@ struct ContentDetailView: View {
|
|||
AudioContentCommentListView(
|
||||
isPresented: $isShowCommentListView,
|
||||
creatorId: viewModel.audioContent!.creator.creatorId,
|
||||
audioContentId: viewModel.audioContent!.contentId
|
||||
audioContentId: viewModel.audioContent!.contentId,
|
||||
isShowSecret: viewModel.audioContent!.existOrdered
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue