콘텐츠 상세 - 배너 광고 추가

This commit is contained in:
Yu Sung
2023-09-14 12:16:01 +09:00
parent 48b1093dac
commit b2f0975ad1
9 changed files with 577 additions and 66 deletions

View File

@@ -7,6 +7,7 @@
import SwiftUI
import Kingfisher
import GoogleMobileAds
import RefreshableScrollView
struct ContentDetailView: View {
@@ -66,56 +67,65 @@ struct ContentDetailView: View {
viewModel.getAudioContentDetail()
}) {
VStack(spacing: 0) {
LazyVStack(spacing: 0) {
ContentDetailPlayView(
audioContent: audioContent,
isShowPreviewAlert: $viewModel.isShowPreviewAlert
)
ContentDetailInfoView(
isExpandDescription: $viewModel.isExpandDescription,
isShowPreviewAlert: $viewModel.isShowPreviewAlert,
audioContent: audioContent,
onClickLike: { viewModel.likeContent() },
onClickShare: {
viewModel.shareAudioContent(
contentImage: audioContent.coverImageUrl,
contentTitle: "\(audioContent.title) - \(audioContent.creator.nickname)"
)
},
onClickDonation: { viewModel.isShowDonationPopup = true }
)
if audioContent.price > 0 &&
!audioContent.existOrdered &&
audioContent.orderType == nil &&
audioContent.creator.creatorId != UserDefaults.int(forKey: .userId) {
ContentDetailPurchaseButton(price: audioContent.price)
.contentShape(Rectangle())
.onTapGesture { isShowOrderView = true }
}
if audioContent.isCommentAvailable {
ContentDetailCommentView(
commentCount: audioContent.commentCount,
commentList: audioContent.commentList,
registerComment: { comment in
self.viewModel.registerComment(comment: comment)
}
ContentDetailPlayView(
audioContent: audioContent,
isShowPreviewAlert: $viewModel.isShowPreviewAlert
)
if audioContent.price <= 0 || (audioContent.price > 0 && !audioContent.existOrdered) {
BannerAdView(adUnitId: FREE_CONTENT_BANNER_AD_UNIT_ID)
.frame(
width: screenSize().width,
height: GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(screenSize().width).size.height
)
.padding(10.3)
.background(Color.white.opacity(0.1))
.cornerRadius(5.3)
.padding(.top, 13.3)
}
ContentDetailInfoView(
isExpandDescription: $viewModel.isExpandDescription,
isShowPreviewAlert: $viewModel.isShowPreviewAlert,
audioContent: audioContent,
onClickLike: { viewModel.likeContent() },
onClickShare: {
viewModel.shareAudioContent(
contentImage: audioContent.coverImageUrl,
contentTitle: "\(audioContent.title) - \(audioContent.creator.nickname)"
)
},
onClickDonation: { viewModel.isShowDonationPopup = true }
)
.padding(.horizontal, 13.3)
if audioContent.price > 0 &&
!audioContent.existOrdered &&
audioContent.orderType == nil &&
audioContent.creator.creatorId != UserDefaults.int(forKey: .userId) {
ContentDetailPurchaseButton(price: audioContent.price)
.contentShape(Rectangle())
.onTapGesture {
if audioContent.commentCount > 0 {
isShowCommentListView = true
}
.padding(.horizontal, 13.3)
.onTapGesture { isShowOrderView = true }
}
if audioContent.isCommentAvailable {
ContentDetailCommentView(
commentCount: audioContent.commentCount,
commentList: audioContent.commentList,
registerComment: { comment in
self.viewModel.registerComment(comment: comment)
}
)
.padding(10.3)
.background(Color.white.opacity(0.1))
.cornerRadius(5.3)
.padding(.top, 13.3)
.contentShape(Rectangle())
.padding(.horizontal, 13.3)
.onTapGesture {
if audioContent.commentCount > 0 {
isShowCommentListView = true
}
}
}
.padding(.horizontal, 13.3)
Rectangle()
.foregroundColor(Color(hex: "232323"))