비밀 미션

- 비밀 미션 이용 최소 금액 : 10캔 으로 설정
This commit is contained in:
Yu Sung 2024-11-21 00:25:29 +09:00
parent 8b7d673942
commit 65e9974451
2 changed files with 19 additions and 9 deletions

View File

@ -104,7 +104,7 @@ struct LiveRoomDonationDialogView: View {
.padding(.top, 16) .padding(.top, 16)
} }
TextField("몇 캔을 후원할까요?", text: $donationCan) TextField(isSecret ? "10캔 이상 입력하세요" : "1캔 이상 입력하세요", text: $donationCan)
.font(.custom(Font.medium.rawValue, size: 13.3)) .font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color.grayee) .foregroundColor(Color.grayee)
.padding(13.3) .padding(13.3)
@ -241,10 +241,17 @@ struct LiveRoomDonationDialogView: View {
.background(Color.button) .background(Color.button)
.cornerRadius(10) .cornerRadius(10)
.onTapGesture { .onTapGesture {
if !donationCan.trimmingCharacters(in: .whitespaces).isEmpty, if !donationCan.trimmingCharacters(in: .whitespaces).isEmpty, let can = Int(donationCan) {
let can = Int(donationCan) { if isSecret && can < 10 {
onClickDonation(can, donationMessage, isSecret) errorMessage = "비밀 미션은 최소 10캔 이상부터 이용이 가능합니다."
isShowing = false isShowErrorPopup = true
} else if can < 1 {
errorMessage = "1캔 이상 후원하실 수 있습니다."
isShowErrorPopup = true
} else {
onClickDonation(can, donationMessage, isSecret)
isShowing = false
}
} else { } else {
errorMessage = "1캔 이상 후원하실 수 있습니다." errorMessage = "1캔 이상 후원하실 수 있습니다."
isShowErrorPopup = true isShowErrorPopup = true

View File

@ -447,7 +447,13 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
} }
func donation(can: Int, message: String = "", isSecret: Bool = false) { func donation(can: Int, message: String = "", isSecret: Bool = false) {
if can > 0 { if isSecret && can < 10 {
popupContent = "비밀 미션은 최소 10캔 이상부터 이용이 가능합니다."
isShowPopup = true
} else if can < 1 {
popupContent = "1캔 이상 후원하실 수 있습니다."
isShowPopup = true
} else {
isLoading = true isLoading = true
repository.donation(roomId: AppState.shared.roomId, can: can, message: message, isSecret: isSecret) repository.donation(roomId: AppState.shared.roomId, can: can, message: message, isSecret: isSecret)
@ -567,9 +573,6 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
} }
} }
.store(in: &subscription) .store(in: &subscription)
} else {
popupContent = "1캔 이상 후원하실 수 있습니다."
isShowPopup = true
} }
} }