feat(explorer): 채널 후원 목록/등록 기능을 추가한다
This commit is contained in:
@@ -14,6 +14,7 @@ struct UserProfileView: View {
|
||||
|
||||
@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
|
||||
@StateObject var viewModel = UserProfileViewModel()
|
||||
@StateObject private var channelDonationViewModel = ChannelDonationViewModel()
|
||||
@StateObject private var keyboardHandler = KeyboardHandler()
|
||||
|
||||
@State private var memberId: Int = 0
|
||||
@@ -22,6 +23,7 @@ struct UserProfileView: View {
|
||||
@State private var isShowRouletteSettings: Bool = false
|
||||
@State private var isShowMenuSettings: Bool = false
|
||||
@State private var isShowCreatorDetailDialog: Bool = false
|
||||
@State private var isShowChannelDonationDialog: Bool = false
|
||||
|
||||
@State private var maxCommunityPostHeight: CGFloat? = nil
|
||||
|
||||
@@ -191,6 +193,15 @@ struct UserProfileView: View {
|
||||
.setAppStep(step: .contentDetail(contentId: item.contentId))
|
||||
}
|
||||
}
|
||||
|
||||
UserProfileChannelDonationView(
|
||||
creatorId: creatorProfile.creator.creatorId,
|
||||
donationItems: creatorProfile.channelDonationList,
|
||||
onTapDonationButton: {
|
||||
channelDonationViewModel.setCreatorId(creatorProfile.creator.creatorId, shouldFetch: false)
|
||||
isShowChannelDonationDialog = true
|
||||
}
|
||||
)
|
||||
|
||||
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) || creatorProfile.liveRoomList.count > 0 {
|
||||
VStack(alignment: .leading, spacing: 14) {
|
||||
@@ -425,6 +436,25 @@ struct UserProfileView: View {
|
||||
}
|
||||
|
||||
ZStack {
|
||||
if isShowChannelDonationDialog {
|
||||
LiveRoomDonationDialogView(
|
||||
isShowing: $isShowChannelDonationDialog,
|
||||
isAudioContentDonation: false,
|
||||
messageLimit: 100,
|
||||
onClickDonation: { can, message, isSecret in
|
||||
channelDonationViewModel.postChannelDonation(
|
||||
can: can,
|
||||
message: message,
|
||||
isSecret: isSecret,
|
||||
reloadAfterSuccess: false,
|
||||
onSuccess: {
|
||||
viewModel.getCreatorProfile(userId: userId)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if viewModel.isShowPaymentDialog {
|
||||
LivePaymentDialog(
|
||||
title: viewModel.paymentDialogTitle,
|
||||
@@ -581,6 +611,21 @@ struct UserProfileView: View {
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.popup(isPresented: $channelDonationViewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(channelDonationViewModel.errorMessage)
|
||||
.padding(.vertical, 13.3)
|
||||
.frame(width: screenSize().width - 66.7, alignment: .center)
|
||||
.appFont(size: 12, weight: .medium)
|
||||
.background(Color.button)
|
||||
.foregroundColor(Color.white)
|
||||
.multilineTextAlignment(.leading)
|
||||
.cornerRadius(20)
|
||||
.padding(.bottom, 66.7)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.ignoresSafeArea(.container, edges: .all)
|
||||
.sheet(
|
||||
isPresented: $viewModel.isShowShareView,
|
||||
|
||||
Reference in New Issue
Block a user