diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift index 912ee4d..b3dd86e 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift @@ -6,6 +6,7 @@ // import SwiftUI +import GoogleMobileAds struct UserProfileView: View { @@ -45,48 +46,57 @@ struct UserProfileView: View { ScrollView(.vertical, showsIndicators: false) { VStack(spacing: 0) { if let creatorProfile = viewModel.creatorProfile { - UserProfileCreatorView( - creator: creatorProfile.creator) { - viewModel.creatorFollow() - } creatorUnFollow: { - viewModel.creatorUnFollow() - } shareChannel: { - viewModel.shareChannel(userId: userId) + VStack(spacing: 0) { + UserProfileCreatorView( + creator: creatorProfile.creator) { + viewModel.creatorFollow() + } creatorUnFollow: { + viewModel.creatorUnFollow() + } 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) + } } - - UserProfileActivitySummaryView(item: creatorProfile.activitySummary) + .padding(.horizontal, 26.7) + .padding(.vertical, 13.3) + .background(Color(hex: "fdca2f")) .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) { - Text( - creatorProfile.notice.trimmingCharacters(in: .whitespaces).isEmpty ? - "공지사항이 없습니다." : - creatorProfile.notice + BannerAdView(adUnitId: CREATOR_CHANNEL_BANNER_AD_UNIT_ID) + .frame( + width: screenSize().width, + height: GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(screenSize().width).size.height ) - .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) - .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() - } - } + .padding(.top, 26.7) if creatorProfile.contentList.count > 0 || userId == UserDefaults.int(forKey: .userId) @@ -95,7 +105,7 @@ struct UserProfileView: View { userId: userId, items: creatorProfile.contentList ) - .padding(.top, 46.7) + .padding(.top, 26.7) .padding(.horizontal, 13.3) } @@ -123,7 +133,7 @@ struct UserProfileView: View { } } ) - .padding(.top, 46.7) + .padding(.top, 26.7) .padding(.horizontal, 13.3) } @@ -153,37 +163,48 @@ struct UserProfileView: View { .padding(.top, 26.7) } - VStack(spacing: 26.7) { - UserProfileSimilarCreatorView( - creators: creatorProfile.similarCreatorList, - onClickCreator: { viewModel.getCreatorProfile(userId: $0) } + BannerAdView(adUnitId: CREATOR_CHANNEL_BANNER_AD_UNIT_ID) + .frame( + width: screenSize().width, + height: GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(screenSize().width).size.height ) - .padding(.horizontal, 13.3) - - Rectangle() - .frame(height: 6.7) - .foregroundColor(Color(hex: "909090").opacity(0.5)) - } - .padding(.top, 26.7) + .padding(.top, 26.7) - UserProfileFanTalkView( - 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) + VStack(spacing: 0) { + if creatorProfile.similarCreatorList.count > 0 { + VStack(spacing: 26.7) { + UserProfileSimilarCreatorView( + creators: creatorProfile.similarCreatorList, + onClickCreator: { viewModel.getCreatorProfile(userId: $0) } + ) + .padding(.horizontal, 13.3) + + Rectangle() + .frame(height: 6.7) + .foregroundColor(Color(hex: "909090").opacity(0.5)) + } + .padding(.top, 26.7) + } + + UserProfileFanTalkView( + 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) + } } } }