feat(creator-channel): 프로필 이미지 표시 방식 변경 및 UI 표시 순서 변경

This commit is contained in:
Yu Sung
2025-10-17 04:20:01 +09:00
parent 76774d3d95
commit 88a03ff5d5
4 changed files with 214 additions and 202 deletions

View File

@@ -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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

View File

@@ -139,7 +139,6 @@ struct UserProfileCreatorView: View {
.padding(20)
.background(Color(hex: "222222"))
.cornerRadius(16.7)
.padding(.top, 20)
.padding(.horizontal, 13.3)
}
}

View File

@@ -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..<viewModel.communityPostList.count, id: \.self) { index in
let item = viewModel.communityPostList[index]
CreatorCommunityItemView(item: item)
.frame(width: 320)
.onTapGesture {
AppState.shared
.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
.background(
GeometryReader { geo in
Color.clear
.preference(key: HeightPreferenceKey.self, value: geo.size.height)
}
)
}
CreatorCommunityMoreItemView {
AppState.shared
.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
}
.padding(.horizontal, 13.3)
.frame(height: maxCommunityPostHeight)
.onPreferenceChange(HeightPreferenceKey.self) { value in
if let current = maxCommunityPostHeight {
maxCommunityPostHeight = max(current, value)
} else {
maxCommunityPostHeight = value
}
}
}
.padding(.top, 26.7)
} else {
if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId {
CreatorCommunityNoPostsItemView(
onSuccess: creatorCommunityWriteSuccess
)
.padding(.top, 26.7)
.padding(.horizontal, 13.3)
}
}
}
}
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)
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..<viewModel.communityPostList.count, id: \.self) { index in
let item = viewModel.communityPostList[index]
CreatorCommunityItemView(item: item)
.frame(width: 320)
.onTapGesture {
AppState.shared
.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
.background(
GeometryReader { geo in
Color.clear
.preference(key: HeightPreferenceKey.self, value: geo.size.height)
}
)
}
CreatorCommunityMoreItemView {
AppState.shared
.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
}
.padding(.horizontal, 13.3)
.frame(height: maxCommunityPostHeight)
.onPreferenceChange(HeightPreferenceKey.self) { value in
if let current = maxCommunityPostHeight {
maxCommunityPostHeight = max(current, value)
} else {
maxCommunityPostHeight = value
}
}
}
} else {
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
CreatorCommunityNoPostsItemView(
onSuccess: creatorCommunityWriteSuccess
)
}
}
if !creatorProfile.seriesList.isEmpty {
UserProfileSeriesView(
creatorId: creatorProfile.creator.creatorId,
items: creatorProfile.seriesList
)
}
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)
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 = "" },