From 65e9974451f5dcaf20b54f928e0612aea24096dd Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Thu, 21 Nov 2024 00:25:29 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=EB=B0=80=20=EB=AF=B8=EC=85=98=20-=20?= =?UTF-8?q?=EB=B9=84=EB=B0=80=20=EB=AF=B8=EC=85=98=20=EC=9D=B4=EC=9A=A9=20?= =?UTF-8?q?=EC=B5=9C=EC=86=8C=20=EA=B8=88=EC=95=A1=20:=2010=EC=BA=94=20?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail/LiveRoomDonationDialogView.swift | 17 ++++++++++++----- .../Sources/Live/Room/LiveRoomViewModel.swift | 11 +++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/SodaLive/Sources/Content/Detail/LiveRoomDonationDialogView.swift b/SodaLive/Sources/Content/Detail/LiveRoomDonationDialogView.swift index 564df26..6665efe 100644 --- a/SodaLive/Sources/Content/Detail/LiveRoomDonationDialogView.swift +++ b/SodaLive/Sources/Content/Detail/LiveRoomDonationDialogView.swift @@ -104,7 +104,7 @@ struct LiveRoomDonationDialogView: View { .padding(.top, 16) } - TextField("몇 캔을 후원할까요?", text: $donationCan) + TextField(isSecret ? "10캔 이상 입력하세요" : "1캔 이상 입력하세요", text: $donationCan) .font(.custom(Font.medium.rawValue, size: 13.3)) .foregroundColor(Color.grayee) .padding(13.3) @@ -241,10 +241,17 @@ struct LiveRoomDonationDialogView: View { .background(Color.button) .cornerRadius(10) .onTapGesture { - if !donationCan.trimmingCharacters(in: .whitespaces).isEmpty, - let can = Int(donationCan) { - onClickDonation(can, donationMessage, isSecret) - isShowing = false + if !donationCan.trimmingCharacters(in: .whitespaces).isEmpty, let can = Int(donationCan) { + if isSecret && can < 10 { + errorMessage = "비밀 미션은 최소 10캔 이상부터 이용이 가능합니다." + isShowErrorPopup = true + } else if can < 1 { + errorMessage = "1캔 이상 후원하실 수 있습니다." + isShowErrorPopup = true + } else { + onClickDonation(can, donationMessage, isSecret) + isShowing = false + } } else { errorMessage = "1캔 이상 후원하실 수 있습니다." isShowErrorPopup = true diff --git a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift index 71024e9..237cc12 100644 --- a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift +++ b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift @@ -447,7 +447,13 @@ final class LiveRoomViewModel: NSObject, ObservableObject { } 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 repository.donation(roomId: AppState.shared.roomId, can: can, message: message, isSecret: isSecret) @@ -567,9 +573,6 @@ final class LiveRoomViewModel: NSObject, ObservableObject { } } .store(in: &subscription) - } else { - popupContent = "1캔 이상 후원하실 수 있습니다." - isShowPopup = true } }