SodaLive
Preview Content
Resources
Sources
Agora
App
Audition
Common
Content
CustomView
Debug
Dialog
Explorer
Profile
CreatorCommunity
FanTalk
FollowerList
Series
GetCheersResponse.swift
GetCreatorProfileResponse.swift
GetDonationAllResponse.swift
MemberBlockRequest.swift
PostCreatorNoticeRequest.swift
UserProfileActivitySummaryView.swift
UserProfileContentView.swift
UserProfileCreatorView.swift
UserProfileDonationAllView.swift
UserProfileDonationAllViewModel.swift
UserProfileDonationView.swift
UserProfileIntroduceView.swift
UserProfileLiveView.swift
UserProfileView.swift
UserProfileViewModel.swift
ExplorerApi.swift
ExplorerRepository.swift
ExplorerSectionView.swift
ExplorerView.swift
ExplorerViewModel.swift
GetExplorerResponse.swift
Extensions
Follow
Font
FortuneWheel
IAP
ImagePicker
Keyboard
Live
Main
Message
MyPage
NavigationBar
Onboarding
Report
SearchChannel
Settings
Shape
Splash
Tracking
UI
User
Utils
ContentView.swift
SodaLive.entitlements
SodaLive.xcworkspace
generated
.gitignore
Podfile
Podfile.lock
SodaLive-dev.entitlements
model-SodaLive-dev.json
model-SodaLive.json
172 lines
7.0 KiB
Swift
172 lines
7.0 KiB
Swift
//
|
|
// UserProfileCreatorView.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2023/08/11.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Kingfisher
|
|
|
|
struct UserProfileCreatorView: View {
|
|
|
|
let creator: CreatorResponse
|
|
let isCreator: Bool
|
|
|
|
let creatorFollow: () -> Void
|
|
let showCreatorFollowNotifyDialog: () -> Void
|
|
let shareChannel: () -> Void
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 0) {
|
|
HStack(spacing: 20) {
|
|
KFImage(URL(string: creator.profileUrl))
|
|
.cancelOnDisappear(true)
|
|
.downsampling(
|
|
size: CGSize(
|
|
width: 90,
|
|
height: 90
|
|
)
|
|
)
|
|
.resizable()
|
|
.scaledToFill()
|
|
.frame(width: 90, height: 90)
|
|
.background(Color(hex: "3e3358"))
|
|
.clipShape(Circle())
|
|
|
|
VStack(alignment: .leading, spacing: 0) {
|
|
HStack(spacing: 0) {
|
|
Text(creator.nickname)
|
|
.font(.custom(Font.bold.rawValue, size: 20))
|
|
.foregroundColor(Color(hex: "eeeeee"))
|
|
.padding(.top, 6.7)
|
|
|
|
Spacer()
|
|
|
|
if isCreator {
|
|
Image("btn_big_share")
|
|
.resizable()
|
|
.frame(width: 33.3, height: 33.3)
|
|
.onTapGesture { shareChannel() }
|
|
}
|
|
}
|
|
|
|
if creator.creatorId == UserDefaults.int(forKey: .userId) {
|
|
Text("팔로워 리스트")
|
|
.font(.custom(Font.bold.rawValue, size: 12))
|
|
.foregroundColor(Color.white)
|
|
.padding(.vertical, 8)
|
|
.padding(.horizontal, 16)
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 16.7)
|
|
.stroke(Color.button, lineWidth: 1)
|
|
)
|
|
.padding(.top, 13.3)
|
|
.onTapGesture {
|
|
AppState.shared.setAppStep(step: .followerList(userId: creator.creatorId))
|
|
}
|
|
} else {
|
|
VStack(alignment: .leading, spacing: 9.3) {
|
|
Image(
|
|
creator.isFollow ?
|
|
creator.isNotify ? "btn_following_big": "btn_following_no_alarm_big"
|
|
: "btn_follow_big"
|
|
)
|
|
.resizable()
|
|
.frame(width: 83.3, height: 26.7)
|
|
.onTapGesture {
|
|
if creator.isFollow {
|
|
showCreatorFollowNotifyDialog()
|
|
} else {
|
|
creatorFollow()
|
|
}
|
|
}
|
|
|
|
Text("팔로워 \(creator.notificationRecipientCount)명")
|
|
.font(.custom(Font.light.rawValue, size: 12))
|
|
.foregroundColor(Color(hex: "bbbbbb"))
|
|
}
|
|
.padding(.top, 13.3)
|
|
}
|
|
}
|
|
}
|
|
|
|
Text(creator.tags.map { "#\($0)" }.joined(separator: " "))
|
|
.font(.custom(Font.medium.rawValue, size: 13.3))
|
|
.foregroundColor(Color.button)
|
|
.padding(.top, creator.tags.count > 0 ? 13.3 : 0)
|
|
|
|
HStack(spacing: 10) {
|
|
Spacer()
|
|
|
|
if let websiteUrl = creator.websiteUrl, websiteUrl.count > 0, let url = URL(string: websiteUrl), UIApplication.shared.canOpenURL(url) {
|
|
Button(action: {UIApplication.shared.open(url)}) {
|
|
Image("ic_website_circle")
|
|
.resizable()
|
|
.frame(width: 40, height: 40)
|
|
}
|
|
.padding(.top, 13.3)
|
|
}
|
|
|
|
if let blogUrl = creator.blogUrl, blogUrl.count > 0, let url = URL(string: blogUrl), UIApplication.shared.canOpenURL(url) {
|
|
Button(action: {UIApplication.shared.open(url)}) {
|
|
Image("ic_blog_circle")
|
|
.resizable()
|
|
.frame(width: 40, height: 40)
|
|
}
|
|
.padding(.top, 13.3)
|
|
}
|
|
|
|
if let instagramUrl = creator.instagramUrl, instagramUrl.count > 0, let url = URL(string: instagramUrl), UIApplication.shared.canOpenURL(url) {
|
|
Button(action: {UIApplication.shared.open(url)}) {
|
|
Image("ic_instagram_circle")
|
|
.resizable()
|
|
.frame(width: 40, height: 40)
|
|
}
|
|
.padding(.top, 13.3)
|
|
}
|
|
|
|
if let youtubeUrl = creator.youtubeUrl, youtubeUrl.count > 0, let url = URL(string: youtubeUrl), UIApplication.shared.canOpenURL(url) {
|
|
Button(action: {UIApplication.shared.open(url)}) {
|
|
Image("ic_youtube_circle")
|
|
.resizable()
|
|
.frame(width: 40, height: 40)
|
|
}
|
|
.padding(.top, 13.3)
|
|
}
|
|
}
|
|
}
|
|
.padding(20)
|
|
.background(Color(hex: "222222"))
|
|
.cornerRadius(16.7)
|
|
.padding(.top, 20)
|
|
.padding(.horizontal, 13.3)
|
|
}
|
|
}
|
|
|
|
struct UserProfileCreatorView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
UserProfileCreatorView(
|
|
creator: CreatorResponse(
|
|
creatorId: 2,
|
|
profileUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
|
|
nickname: "수다친구1",
|
|
tags: ["썸", "연애", "부부"],
|
|
introduce: "상담사1 입니다.yyyyyyy\n\n\n\n\n\n\njgdgjdgjdgicyifyicyi\n\n\n\n\n\n\n\n\n\n\n\n",
|
|
instagramUrl: Optional("3x2tfZnfLRo"),
|
|
youtubeUrl: Optional("https://www.youtube.com/watch?v=3x2tfZnfLRo"),
|
|
websiteUrl: Optional("https://instagram.com/dear.zia"),
|
|
blogUrl: Optional("dear.zia"),
|
|
isFollow: false,
|
|
isNotify: false,
|
|
isNotification: false,
|
|
notificationRecipientCount: 2
|
|
),
|
|
isCreator: false
|
|
) {
|
|
} showCreatorFollowNotifyDialog: {
|
|
} shareChannel: {
|
|
}
|
|
}
|
|
}
|