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) .padding(20)
.background(Color(hex: "222222")) .background(Color(hex: "222222"))
.cornerRadius(16.7) .cornerRadius(16.7)
.padding(.top, 20)
.padding(.horizontal, 13.3) .padding(.horizontal, 13.3)
} }
} }

View File

@@ -6,6 +6,7 @@
// //
import SwiftUI import SwiftUI
import Kingfisher
struct UserProfileView: View { struct UserProfileView: View {
@@ -25,135 +26,19 @@ struct UserProfileView: View {
var body: some View { var body: some View {
GeometryReader { proxy in GeometryReader { proxy in
BaseView(isLoading: $viewModel.isLoading) { BaseView(isLoading: $viewModel.isLoading) {
VStack(spacing: 0) { ZStack(alignment: .top) {
HStack(spacing: 0) { VStack(spacing: 0) {
Button { ScrollView(.vertical, showsIndicators: false) {
if presentationMode.wrappedValue.isPresented { LazyVStack(spacing: 48) {
presentationMode.wrappedValue.dismiss() if let creatorProfile = viewModel.creatorProfile {
} else { ZStack(alignment: .bottomLeading) {
AppState.shared.back() KFImage(URL(string: creatorProfile.creator.profileUrl))
} .cancelOnDisappear(true)
} label: { .downsampling(size: CGSize(width: screenSize().width, height: screenSize().width))
Image("ic_back") .resizable()
.resizable() .aspectRatio(1, contentMode: .fill)
.frame(width: 20, height: 20) .frame(maxWidth: screenSize().width)
.clipped()
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)
} }
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) || creatorProfile.liveRoomList.count > 0 { 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 { if creatorProfile.userDonationRanking.count > 0 {
VStack(spacing: 26.7) { UserProfileDonationView(userId: userId, donationRankingResponse: creatorProfile.userDonationRanking)
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,
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("") HStack(spacing: 14) {
.navigationBarBackButtonHidden() Button {
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { if presentationMode.wrappedValue.isPresented {
HStack { presentationMode.wrappedValue.dismiss()
Spacer() } else {
Text(viewModel.errorMessage) AppState.shared.back()
.padding(.vertical, 13.3) }
.frame(width: screenSize().width - 66.7, alignment: .center) } label: {
.font(.custom(Font.medium.rawValue, size: 12)) Image("ic_back")
.background(Color.button) .resizable()
.foregroundColor(Color.white) .frame(width: 20, height: 20)
.multilineTextAlignment(.leading)
.cornerRadius(20) Text(viewModel.navigationTitle)
.padding(.bottom, 66.7) .font(.custom(Font.preBold.rawValue, size: 20))
.foregroundColor(Color.white)
}
Spacer() 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 { ZStack {
@@ -337,8 +310,7 @@ struct UserProfileView: View {
.ignoresSafeArea() .ignoresSafeArea()
} }
if let creatorProfile = viewModel.creatorProfile, if let creatorProfile = viewModel.creatorProfile, viewModel.isShowUesrBlockConfirm {
viewModel.isShowUesrBlockConfirm {
UserBlockConfirmDialogView( UserBlockConfirmDialogView(
isShowing: $viewModel.isShowUesrBlockConfirm, isShowing: $viewModel.isShowUesrBlockConfirm,
nickname: creatorProfile.creator.nickname, nickname: creatorProfile.creator.nickname,
@@ -369,32 +341,52 @@ struct UserProfileView: View {
} }
} }
if isShowFollowNotifyDialog { ZStack {
CreatorFollowNotifyDialog( if isShowFollowNotifyDialog {
isShowing: $isShowFollowNotifyDialog, CreatorFollowNotifyDialog(
onClickNotifyAll: { isShowing: $isShowFollowNotifyDialog,
viewModel.creatorFollow(follow: true, notify: true) onClickNotifyAll: {
}, viewModel.creatorFollow(follow: true, notify: true)
onClickNotifyNone: { },
viewModel.creatorFollow(follow: true, notify: false) onClickNotifyNone: {
}, viewModel.creatorFollow(follow: true, notify: false)
onClickUnFollow: { },
viewModel.creatorFollow(follow: false, 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 isShowMenuSettings {
if isShowRouletteSettings { MenuSettingsView(isShowing: $isShowMenuSettings)
RouletteSettingsView(isShowing: $isShowRouletteSettings, availableActive: false) { _, message in
viewModel.errorMessage = message
viewModel.isShowPopup = true
} }
} }
}
if isShowMenuSettings { .navigationTitle("")
MenuSettingsView(isShowing: $isShowMenuSettings) .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( .sheet(
isPresented: $viewModel.isShowShareView, isPresented: $viewModel.isShowShareView,
onDismiss: { viewModel.shareMessage = "" }, onDismiss: { viewModel.shareMessage = "" },