라이브 후원

- 비밀 후원 기능 추가
This commit is contained in:
Yu Sung
2024-08-26 20:07:37 +09:00
parent 81846f7f7b
commit 534a6e737e
9 changed files with 150 additions and 43 deletions

View File

@@ -323,7 +323,7 @@ struct ContentDetailView: View {
}
if viewModel.isShowDonationPopup {
LiveRoomDonationDialogView(isShowing: $viewModel.isShowDonationPopup, isAudioContentDonation: true) { can, comment in
LiveRoomDonationDialogView(isShowing: $viewModel.isShowDonationPopup, isAudioContentDonation: true) { can, comment, _ in
viewModel.donation(can: can, comment: comment)
}
}

View File

@@ -18,10 +18,11 @@ struct LiveRoomDonationDialogView: View {
@State private var donationMessage = ""
@State private var isShowErrorPopup = false
@State private var errorMessage = ""
@State private var isSecret = false
@Binding var isShowing: Bool
let isAudioContentDonation: Bool
let onClickDonation: (Int, String) -> Void
let onClickDonation: (Int, String, Bool) -> Void
@StateObject var keyboardHandler = KeyboardHandler()
@@ -82,6 +83,27 @@ struct LiveRoomDonationDialogView: View {
.foregroundColor(Color.gray90)
.padding(.top, 16)
if !isAudioContentDonation {
HStack(spacing: 0) {
Spacer()
HStack(spacing: 8) {
Image(isSecret ? "btn_select_checked" : "btn_select_normal")
.resizable()
.frame(width: 20, height: 20)
Text("비밀후원")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color.grayee)
}
.onTapGesture {
isSecret.toggle()
}
}
.padding(.horizontal, 20)
.padding(.top, 16)
}
TextField("몇 캔을 후원할까요?", text: $donationCan)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
@@ -221,7 +243,7 @@ struct LiveRoomDonationDialogView: View {
.onTapGesture {
if !donationCan.trimmingCharacters(in: .whitespaces).isEmpty,
let can = Int(donationCan) {
onClickDonation(can, donationMessage)
onClickDonation(can, donationMessage, isSecret)
isShowing = false
} else {
errorMessage = "1캔 이상 후원하실 수 있습니다."