diff --git a/SodaLive/Resources/Assets.xcassets/ic_new_share.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/ic_new_share.imageset/Contents.json new file mode 100644 index 0000000..f4341be --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/ic_new_share.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "ic_new_share.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/ic_new_share.imageset/ic_new_share.png b/SodaLive/Resources/Assets.xcassets/ic_new_share.imageset/ic_new_share.png new file mode 100644 index 0000000..89f28ab Binary files /dev/null and b/SodaLive/Resources/Assets.xcassets/ic_new_share.imageset/ic_new_share.png differ diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileCreatorView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileCreatorView.swift index 79e2c91..4282cb0 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileCreatorView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileCreatorView.swift @@ -139,7 +139,6 @@ struct UserProfileCreatorView: View { .padding(20) .background(Color(hex: "222222")) .cornerRadius(16.7) - .padding(.top, 20) .padding(.horizontal, 13.3) } } diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift index 2afc57c..f44c780 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift @@ -6,6 +6,7 @@ // import SwiftUI +import Kingfisher struct UserProfileView: View { @@ -25,135 +26,19 @@ struct UserProfileView: View { var body: some View { GeometryReader { proxy in BaseView(isLoading: $viewModel.isLoading) { - VStack(spacing: 0) { - HStack(spacing: 0) { - Button { - if presentationMode.wrappedValue.isPresented { - presentationMode.wrappedValue.dismiss() - } else { - AppState.shared.back() - } - } label: { - Image("ic_back") - .resizable() - .frame(width: 20, height: 20) - - Text(viewModel.navigationTitle) - .font(.custom(Font.bold.rawValue, size: 18.3)) - .foregroundColor(Color(hex: "eeeeee")) - } - - Spacer() - - if userId != UserDefaults.int(forKey: .userId) { - Image("ic_seemore_vertical") - .onTapGesture { - viewModel.isShowReportMenu = true - } - } - } - .padding(.horizontal, 13.3) - .frame(height: 50) - .background(Color.black) - - ScrollView(.vertical, showsIndicators: false) { - VStack(spacing: 0) { - if let creatorProfile = viewModel.creatorProfile { - VStack(spacing: 0) { - UserProfileCreatorView(creator: creatorProfile.creator, isCreator: creatorProfile.isCreatorRole) { - viewModel.creatorFollow() - } showCreatorFollowNotifyDialog: { - isShowFollowNotifyDialog = true - } shareChannel: { - viewModel.shareChannel( - userId: creatorProfile.creator.creatorId, - nickname: creatorProfile.creator.nickname, - profileImage: creatorProfile.creator.profileUrl - ) - } - - if creatorProfile.isCreatorRole { - if viewModel.communityPostList.count > 0 { - ScrollView(.horizontal, showsIndicators: false) { - LazyHStack(spacing: 13.3) { - if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId { - CreatorCommunityWriteItemView() - .onTapGesture { - AppState.shared.setAppStep( - step: .creatorCommunityWrite( - onSuccess: creatorCommunityWriteSuccess - ) - ) - } - } - - ForEach(0.. 0 || - userId == UserDefaults.int(forKey: .userId) - { - UserProfileContentView( - userId: userId, - items: creatorProfile.contentList - ) - .padding(.top, 26.7) - .padding(.horizontal, 13.3) + ZStack(alignment: .top) { + VStack(spacing: 0) { + ScrollView(.vertical, showsIndicators: false) { + LazyVStack(spacing: 48) { + if let creatorProfile = viewModel.creatorProfile { + ZStack(alignment: .bottomLeading) { + KFImage(URL(string: creatorProfile.creator.profileUrl)) + .cancelOnDisappear(true) + .downsampling(size: CGSize(width: screenSize().width, height: screenSize().width)) + .resizable() + .aspectRatio(1, contentMode: .fill) + .frame(maxWidth: screenSize().width) + .clipped() } if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) || creatorProfile.liveRoomList.count > 0 { @@ -210,65 +95,153 @@ struct UserProfileView: View { ) } } - .padding(.top, 26.7) - .padding(.horizontal, 13.3) + } + + if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) || creatorProfile.contentList.count > 0 { + UserProfileContentView( + userId: userId, + items: creatorProfile.contentList + ) + } + + if viewModel.communityPostList.count > 0 { + ScrollView(.horizontal, showsIndicators: false) { + LazyHStack(spacing: 13.3) { + if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId { + CreatorCommunityWriteItemView() + .onTapGesture { + AppState.shared.setAppStep( + step: .creatorCommunityWrite( + onSuccess: creatorCommunityWriteSuccess + ) + ) + } + } + + ForEach(0.. 0 { - VStack(spacing: 26.7) { - UserProfileDonationView(userId: userId, donationRankingResponse: creatorProfile.userDonationRanking) - .padding(.horizontal, 13.3) - - Rectangle() - .frame(height: 6.7) - .foregroundColor(Color.gray90.opacity(0.5)) - } - .padding(.top, 26.7) + UserProfileDonationView(userId: userId, donationRankingResponse: creatorProfile.userDonationRanking) } + + 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 + }, + profilePopup: { + self.memberId = $0 + self.isShowMemberProfilePopup = true + }, + isLoading: $viewModel.isLoading + ) } - - 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 - }, - profilePopup: { - self.memberId = $0 - self.isShowMemberProfilePopup = true - }, - isLoading: $viewModel.isLoading - ) - .padding(.top, 26.7) } } } - } - .navigationTitle("") - .navigationBarBackButtonHidden() - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .font(.custom(Font.medium.rawValue, size: 12)) - .background(Color.button) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) + + HStack(spacing: 14) { + Button { + if presentationMode.wrappedValue.isPresented { + presentationMode.wrappedValue.dismiss() + } else { + AppState.shared.back() + } + } label: { + Image("ic_back") + .resizable() + .frame(width: 20, height: 20) + + Text(viewModel.navigationTitle) + .font(.custom(Font.preBold.rawValue, size: 20)) + .foregroundColor(Color.white) + } + Spacer() + + if let creatorProfile = viewModel.creatorProfile { + Image("ic_new_share") + .resizable() + .frame(width: 24, height: 24) + .onTapGesture { + viewModel.shareChannel( + userId: creatorProfile.creator.creatorId, + nickname: creatorProfile.creator.nickname, + profileImage: creatorProfile.creator.profileUrl + ) + } + } + + if userId != UserDefaults.int(forKey: .userId) { + Image("ic_seemore_vertical") + .resizable() + .frame(width: 24, height: 24) + .onTapGesture { + viewModel.isShowReportMenu = true + } + } } + .padding(.top, proxy.safeAreaInsets.top) + .padding(.horizontal, 24) + .frame(height: proxy.safeAreaInsets.top + 50) } ZStack { @@ -337,8 +310,7 @@ struct UserProfileView: View { .ignoresSafeArea() } - if let creatorProfile = viewModel.creatorProfile, - viewModel.isShowUesrBlockConfirm { + if let creatorProfile = viewModel.creatorProfile, viewModel.isShowUesrBlockConfirm { UserBlockConfirmDialogView( isShowing: $viewModel.isShowUesrBlockConfirm, nickname: creatorProfile.creator.nickname, @@ -369,32 +341,52 @@ struct UserProfileView: View { } } - if isShowFollowNotifyDialog { - CreatorFollowNotifyDialog( - isShowing: $isShowFollowNotifyDialog, - onClickNotifyAll: { - viewModel.creatorFollow(follow: true, notify: true) - }, - onClickNotifyNone: { - viewModel.creatorFollow(follow: true, notify: false) - }, - onClickUnFollow: { - viewModel.creatorFollow(follow: false, notify: false) + ZStack { + if isShowFollowNotifyDialog { + CreatorFollowNotifyDialog( + isShowing: $isShowFollowNotifyDialog, + onClickNotifyAll: { + viewModel.creatorFollow(follow: true, notify: true) + }, + onClickNotifyNone: { + viewModel.creatorFollow(follow: true, notify: false) + }, + onClickUnFollow: { + viewModel.creatorFollow(follow: false, notify: false) + } + ) + } + + if isShowRouletteSettings { + RouletteSettingsView(isShowing: $isShowRouletteSettings, availableActive: false) { _, message in + viewModel.errorMessage = message + viewModel.isShowPopup = true } - ) - } - - if isShowRouletteSettings { - RouletteSettingsView(isShowing: $isShowRouletteSettings, availableActive: false) { _, message in - viewModel.errorMessage = message - viewModel.isShowPopup = true + } + + if isShowMenuSettings { + MenuSettingsView(isShowing: $isShowMenuSettings) } } - - if isShowMenuSettings { - MenuSettingsView(isShowing: $isShowMenuSettings) + } + .navigationTitle("") + .navigationBarBackButtonHidden() + .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { + HStack { + Spacer() + Text(viewModel.errorMessage) + .padding(.vertical, 13.3) + .frame(width: screenSize().width - 66.7, alignment: .center) + .font(.custom(Font.medium.rawValue, size: 12)) + .background(Color.button) + .foregroundColor(Color.white) + .multilineTextAlignment(.leading) + .cornerRadius(20) + .padding(.bottom, 66.7) + Spacer() } } + .ignoresSafeArea() .sheet( isPresented: $viewModel.isShowShareView, onDismiss: { viewModel.shareMessage = "" },