From b5b53f95c7165d69bf8716502a3b24b646353f77 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Wed, 8 Jan 2025 16:21:29 +0900 Subject: [PATCH] =?UTF-8?q?=EC=98=A4=EB=94=94=EC=85=98=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20-=20=EC=A7=80=EC=9B=90=EB=A6=AC=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=9C=A0=EC=A0=80=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=EC=9D=84=20=EB=88=84=EB=A5=B4=EB=A9=B4=20=EC=B1=84?= =?UTF-8?q?=EB=84=90=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Applicant/AuditionApplicantItemView.swift | 6 + .../Profile/GetCreatorProfileResponse.swift | 1 + .../Profile/UserProfileCreatorView.swift | 14 +- .../Explorer/Profile/UserProfileView.swift | 297 +++++++++--------- 4 files changed, 166 insertions(+), 152 deletions(-) diff --git a/SodaLive/Sources/Audition/Applicant/AuditionApplicantItemView.swift b/SodaLive/Sources/Audition/Applicant/AuditionApplicantItemView.swift index 3325340..50082e7 100644 --- a/SodaLive/Sources/Audition/Applicant/AuditionApplicantItemView.swift +++ b/SodaLive/Sources/Audition/Applicant/AuditionApplicantItemView.swift @@ -36,12 +36,18 @@ struct AuditionApplicantItemView: View { ) } } + .onTapGesture { + AppState.shared.setAppStep(step: .creatorDetail(userId: item.memberId)) + } VStack(spacing: 8) { HStack(spacing: 0) { Text(item.nickname.count > 9 ? "\(item.nickname.prefix(9))..." : item.nickname) .font(.custom(Font.medium.rawValue, size: 12)) .foregroundColor(Color.white) + .onTapGesture { + AppState.shared.setAppStep(step: .creatorDetail(userId: item.memberId)) + } Spacer() diff --git a/SodaLive/Sources/Explorer/Profile/GetCreatorProfileResponse.swift b/SodaLive/Sources/Explorer/Profile/GetCreatorProfileResponse.swift index 48f75f3..e51cbe7 100644 --- a/SodaLive/Sources/Explorer/Profile/GetCreatorProfileResponse.swift +++ b/SodaLive/Sources/Explorer/Profile/GetCreatorProfileResponse.swift @@ -19,6 +19,7 @@ struct GetCreatorProfileResponse: Decodable { let activitySummary: GetCreatorActivitySummary let seriesList: [SeriesListItem] let isBlock: Bool + let isCreatorRole: Bool } struct CreatorResponse: Decodable { diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileCreatorView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileCreatorView.swift index 80c422c..79e2c91 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileCreatorView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileCreatorView.swift @@ -11,6 +11,7 @@ import Kingfisher struct UserProfileCreatorView: View { let creator: CreatorResponse + let isCreator: Bool let creatorFollow: () -> Void let showCreatorFollowNotifyDialog: () -> Void @@ -42,10 +43,12 @@ struct UserProfileCreatorView: View { Spacer() - Image("btn_big_share") - .resizable() - .frame(width: 33.3, height: 33.3) - .onTapGesture { shareChannel() } + if isCreator { + Image("btn_big_share") + .resizable() + .frame(width: 33.3, height: 33.3) + .onTapGesture { shareChannel() } + } } if creator.creatorId == UserDefaults.int(forKey: .userId) { @@ -158,7 +161,8 @@ struct UserProfileCreatorView_Previews: PreviewProvider { isNotify: false, isNotification: false, notificationRecipientCount: 2 - ) + ), + isCreator: false ) { } showCreatorFollowNotifyDialog: { } shareChannel: { diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift index 11486e6..8e383cb 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift @@ -52,171 +52,174 @@ struct UserProfileView: View { VStack(spacing: 0) { if let creatorProfile = viewModel.creatorProfile { VStack(spacing: 0) { - UserProfileCreatorView( - creator: creatorProfile.creator) { - viewModel.creatorFollow() - } showCreatorFollowNotifyDialog: { - isShowFollowNotifyDialog = true - } shareChannel: { - viewModel.shareChannel(userId: userId) - } + UserProfileCreatorView(creator: creatorProfile.creator, isCreator: creatorProfile.isCreatorRole) { + viewModel.creatorFollow() + } showCreatorFollowNotifyDialog: { + isShowFollowNotifyDialog = true + } shareChannel: { + viewModel.shareChannel(userId: userId) + } - UserProfileActivitySummaryView(item: creatorProfile.activitySummary) - .padding(.top, 13.3) - .padding(.horizontal, 13.3) - - 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 + if creatorProfile.isCreatorRole { + UserProfileActivitySummaryView(item: creatorProfile.activitySummary) + .padding(.top, 13.3) + .padding(.horizontal, 13.3) + + 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) - } - - if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) || creatorProfile.liveRoomList.count > 0 { - VStack(alignment: .leading, spacing: 26.7) { - Text("라이브") - .font(.custom(Font.bold.rawValue, size: 16.7)) - .foregroundColor(Color.grayee) - - if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) { - HStack(spacing: 8) { - Text("룰렛 설정") - .font(.custom(Font.bold.rawValue, size: 15)) - .foregroundColor(Color.grayee) - .padding(.vertical, 17) - .frame(maxWidth: .infinity) - .background(Color.button) - .cornerRadius(5.3) - .onTapGesture { isShowRouletteSettings = true } - - Text("메뉴 설정") - .font(.custom(Font.bold.rawValue, size: 15)) - .foregroundColor(Color.grayee) - .padding(.vertical, 17) - .frame(maxWidth: .infinity) - .background(Color.button) - .cornerRadius(5.3) - .onTapGesture { isShowMenuSettings = true } + } else { + if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId { + CreatorCommunityNoPostsItemView( + onSuccess: creatorCommunityWriteSuccess + ) + .padding(.top, 26.7) + .padding(.horizontal, 13.3) } } - - if creatorProfile.liveRoomList.count > 0 { - UserProfileLiveView( - userId: userId, - liveRoomList: creatorProfile.liveRoomList, - onClickParticipant: { liveRoom in - if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) { - viewModel.errorMessage = "현재 라이브 중입니다." - viewModel.isShowPopup = true - } else { - AppState.shared.isShowPlayer = false - DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { - viewModel.enterLiveRoom(roomId: liveRoom.roomId) + } + } + + if creatorProfile.isCreatorRole { + if !creatorProfile.seriesList.isEmpty { + UserProfileSeriesView( + creatorId: creatorProfile.creator.creatorId, + items: creatorProfile.seriesList + ) + .padding(.top, 26.7) + .padding(.horizontal, 13.3) + } + + if creatorProfile.contentList.count > 0 || + userId == UserDefaults.int(forKey: .userId) + { + UserProfileContentView( + userId: userId, + items: creatorProfile.contentList + ) + .padding(.top, 26.7) + .padding(.horizontal, 13.3) + } + + if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) || creatorProfile.liveRoomList.count > 0 { + VStack(alignment: .leading, spacing: 26.7) { + Text("라이브") + .font(.custom(Font.bold.rawValue, size: 16.7)) + .foregroundColor(Color.grayee) + + if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) { + HStack(spacing: 8) { + Text("룰렛 설정") + .font(.custom(Font.bold.rawValue, size: 15)) + .foregroundColor(Color.grayee) + .padding(.vertical, 17) + .frame(maxWidth: .infinity) + .background(Color.button) + .cornerRadius(5.3) + .onTapGesture { isShowRouletteSettings = true } + + Text("메뉴 설정") + .font(.custom(Font.bold.rawValue, size: 15)) + .foregroundColor(Color.grayee) + .padding(.vertical, 17) + .frame(maxWidth: .infinity) + .background(Color.button) + .cornerRadius(5.3) + .onTapGesture { isShowMenuSettings = true } + } + } + + if creatorProfile.liveRoomList.count > 0 { + UserProfileLiveView( + userId: userId, + liveRoomList: creatorProfile.liveRoomList, + onClickParticipant: { liveRoom in + if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) { + viewModel.errorMessage = "현재 라이브 중입니다." + viewModel.isShowPopup = true + } else { + AppState.shared.isShowPlayer = false + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { + viewModel.enterLiveRoom(roomId: liveRoom.roomId) + } + } + }, + onClickReservation: { liveRoom in + if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) { + viewModel.errorMessage = "내가 만든 라이브는 예약할 수 없습니다." + viewModel.isShowPopup = true + } else { + viewModel.reservationLiveRoom(roomId: liveRoom.roomId) } } - }, - onClickReservation: { liveRoom in - if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) { - viewModel.errorMessage = "내가 만든 라이브는 예약할 수 없습니다." - viewModel.isShowPopup = true - } else { - viewModel.reservationLiveRoom(roomId: liveRoom.roomId) - } - } - ) + ) + } } - } - .padding(.top, 26.7) - .padding(.horizontal, 13.3) - } - - VStack(spacing: 26.7) { - let introduce = creatorProfile.creator.introduce - UserProfileIntroduceView( - introduce: introduce.trimmingCharacters(in: .whitespaces).count <= 0 ? - "채널 소개내용이 없습니다." : - introduce) - - Rectangle() - .frame(height: 1) - .foregroundColor(Color(hex: "909090").opacity(0.5)) + .padding(.top, 26.7) .padding(.horizontal, 13.3) - } - .padding(.top, 26.7) - - if creatorProfile.userDonationRanking.count > 0 { + } + VStack(spacing: 26.7) { - UserProfileDonationView(userId: userId, donationRankingResponse: creatorProfile.userDonationRanking) - .padding(.horizontal, 13.3) + let introduce = creatorProfile.creator.introduce + UserProfileIntroduceView( + introduce: introduce.trimmingCharacters(in: .whitespaces).count <= 0 ? + "채널 소개내용이 없습니다." : + introduce) Rectangle() - .frame(height: 6.7) - .foregroundColor(Color.gray90.opacity(0.5)) + .frame(height: 1) + .foregroundColor(Color(hex: "909090").opacity(0.5)) + .padding(.horizontal, 13.3) } .padding(.top, 26.7) + + if creatorProfile.userDonationRanking.count > 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) + } } - + UserProfileFanTalkView( userId: userId, cheers: creatorProfile.cheers,