크리에이터 프로필 - 배너 광고 추가

This commit is contained in:
Yu Sung 2023-09-15 18:11:40 +09:00
parent 9a72e21fda
commit f44ef505cf
1 changed files with 90 additions and 69 deletions

View File

@ -6,6 +6,7 @@
// //
import SwiftUI import SwiftUI
import GoogleMobileAds
struct UserProfileView: View { struct UserProfileView: View {
@ -45,48 +46,57 @@ struct UserProfileView: View {
ScrollView(.vertical, showsIndicators: false) { ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 0) { VStack(spacing: 0) {
if let creatorProfile = viewModel.creatorProfile { if let creatorProfile = viewModel.creatorProfile {
UserProfileCreatorView( VStack(spacing: 0) {
creator: creatorProfile.creator) { UserProfileCreatorView(
viewModel.creatorFollow() creator: creatorProfile.creator) {
} creatorUnFollow: { viewModel.creatorFollow()
viewModel.creatorUnFollow() } creatorUnFollow: {
} shareChannel: { viewModel.creatorUnFollow()
viewModel.shareChannel(userId: userId) } shareChannel: {
viewModel.shareChannel(userId: userId)
}
UserProfileActivitySummaryView(item: creatorProfile.activitySummary)
.padding(.top, 13.3)
.padding(.horizontal, 13.3)
HStack(spacing: 0) {
Text(
creatorProfile.notice.trimmingCharacters(in: .whitespaces).isEmpty ?
"공지사항이 없습니다." :
creatorProfile.notice
)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "000000"))
.lineLimit(viewModel.isExpandNotice ? Int.max : 1)
Spacer()
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
Image("ic_review")
.resizable()
.frame(width: 20, height: 20)
}
} }
.padding(.horizontal, 26.7)
UserProfileActivitySummaryView(item: creatorProfile.activitySummary) .padding(.vertical, 13.3)
.background(Color(hex: "fdca2f"))
.padding(.top, 13.3) .padding(.top, 13.3)
.padding(.horizontal, 13.3) .onTapGesture {
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
AppState.shared.setAppStep(step: .creatorNoticeWrite(notice: creatorProfile.notice))
} else {
viewModel.isExpandNotice.toggle()
}
}
}
HStack(spacing: 0) { BannerAdView(adUnitId: CREATOR_CHANNEL_BANNER_AD_UNIT_ID)
Text( .frame(
creatorProfile.notice.trimmingCharacters(in: .whitespaces).isEmpty ? width: screenSize().width,
"공지사항이 없습니다." : height: GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(screenSize().width).size.height
creatorProfile.notice
) )
.font(.custom(Font.medium.rawValue, size: 13.3)) .padding(.top, 26.7)
.foregroundColor(Color(hex: "000000"))
.lineLimit(viewModel.isExpandNotice ? Int.max : 1)
Spacer()
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
Image("ic_review")
.resizable()
.frame(width: 20, height: 20)
}
}
.padding(.horizontal, 26.7)
.padding(.vertical, 13.3)
.background(Color(hex: "fdca2f"))
.padding(.top, 13.3)
.onTapGesture {
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
AppState.shared.setAppStep(step: .creatorNoticeWrite(notice: creatorProfile.notice))
} else {
viewModel.isExpandNotice.toggle()
}
}
if creatorProfile.contentList.count > 0 || if creatorProfile.contentList.count > 0 ||
userId == UserDefaults.int(forKey: .userId) userId == UserDefaults.int(forKey: .userId)
@ -95,7 +105,7 @@ struct UserProfileView: View {
userId: userId, userId: userId,
items: creatorProfile.contentList items: creatorProfile.contentList
) )
.padding(.top, 46.7) .padding(.top, 26.7)
.padding(.horizontal, 13.3) .padding(.horizontal, 13.3)
} }
@ -123,7 +133,7 @@ struct UserProfileView: View {
} }
} }
) )
.padding(.top, 46.7) .padding(.top, 26.7)
.padding(.horizontal, 13.3) .padding(.horizontal, 13.3)
} }
@ -153,37 +163,48 @@ struct UserProfileView: View {
.padding(.top, 26.7) .padding(.top, 26.7)
} }
VStack(spacing: 26.7) { BannerAdView(adUnitId: CREATOR_CHANNEL_BANNER_AD_UNIT_ID)
UserProfileSimilarCreatorView( .frame(
creators: creatorProfile.similarCreatorList, width: screenSize().width,
onClickCreator: { viewModel.getCreatorProfile(userId: $0) } height: GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(screenSize().width).size.height
) )
.padding(.horizontal, 13.3) .padding(.top, 26.7)
Rectangle()
.frame(height: 6.7)
.foregroundColor(Color(hex: "909090").opacity(0.5))
}
.padding(.top, 26.7)
UserProfileFanTalkView( VStack(spacing: 0) {
userId: userId, if creatorProfile.similarCreatorList.count > 0 {
cheers: creatorProfile.cheers, VStack(spacing: 26.7) {
errorPopup: { message in UserProfileSimilarCreatorView(
viewModel.errorMessage = message creators: creatorProfile.similarCreatorList,
viewModel.isShowPopup = true onClickCreator: { viewModel.getCreatorProfile(userId: $0) }
}, )
reportPopup: { cheerId in .padding(.horizontal, 13.3)
viewModel.cheersId = cheerId
viewModel.isShowCheersReportView = true Rectangle()
}, .frame(height: 6.7)
deletePopup: { cheerId in .foregroundColor(Color(hex: "909090").opacity(0.5))
viewModel.cheersId = cheerId }
viewModel.isShowCheersDeleteView = true .padding(.top, 26.7)
}, }
isLoading: $viewModel.isLoading
) UserProfileFanTalkView(
.padding(.top, 26.7) userId: userId,
cheers: creatorProfile.cheers,
errorPopup: { message in
viewModel.errorMessage = message
viewModel.isShowPopup = true
},
reportPopup: { cheerId in
viewModel.cheersId = cheerId
viewModel.isShowCheersReportView = true
},
deletePopup: { cheerId in
viewModel.cheersId = cheerId
viewModel.isShowCheersDeleteView = true
},
isLoading: $viewModel.isLoading
)
.padding(.top, 26.7)
}
} }
} }
} }