크리에이터 채널 - 크리에이터 커뮤니티 영역 추가
This commit is contained in:
parent
7d34a4e27a
commit
c84f1042e3
|
@ -72,8 +72,6 @@ enum AppStep {
|
|||
|
||||
case userProfileFanTalkAll(userId: Int)
|
||||
|
||||
case creatorNoticeWrite(notice: String)
|
||||
|
||||
case createLive(
|
||||
timeSettingMode: LiveRoomCreateViewModel.TimeSettingMode,
|
||||
onSuccess: (CreateLiveRoomResponse) -> Void
|
||||
|
|
|
@ -95,9 +95,6 @@ struct ContentView: View {
|
|||
case .followerList(let userId):
|
||||
FollowerListView(userId: userId)
|
||||
|
||||
case .creatorNoticeWrite(let notice):
|
||||
CreatorNoticeWriteView(notice: notice)
|
||||
|
||||
case .modifyContent(let contentId):
|
||||
ContentModifyView(contentId: contentId)
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
//
|
||||
// CreatorCommunityItemView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/12/14.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CreatorCommunityItemView: View {
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
HStack(spacing: 11) {
|
||||
Image("ic_place_holder")
|
||||
.resizable()
|
||||
.frame(width: 40, height: 40)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text("민하나")
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("1일")
|
||||
.font(.custom(Font.light.rawValue, size: 13.3))
|
||||
.foregroundColor(Color(hex: "777777"))
|
||||
}
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Text("너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!")
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.lineLimit(3)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image("btn_plus_round_rect")
|
||||
.resizable()
|
||||
.frame(width: 53.3, height: 53.3)
|
||||
.cornerRadius(4.7)
|
||||
}
|
||||
|
||||
HStack(spacing: 13.3) {
|
||||
HStack(spacing: 6) {
|
||||
Image("ic_heart_777")
|
||||
.resizable()
|
||||
.frame(width: 13.3, height: 13.3)
|
||||
|
||||
Text("7,680")
|
||||
.font(.custom(Font.medium.rawValue, size: 11))
|
||||
.foregroundColor(Color(hex: "777777"))
|
||||
}
|
||||
|
||||
HStack(spacing: 6) {
|
||||
Image("ic_message_square_777")
|
||||
.resizable()
|
||||
.frame(width: 13.3, height: 13.3)
|
||||
|
||||
Text("150")
|
||||
.font(.custom(Font.medium.rawValue, size: 11))
|
||||
.foregroundColor(Color(hex: "777777"))
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(13.3)
|
||||
.background(Color(hex: "222222"))
|
||||
.cornerRadius(11)
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorCommunityItemView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CreatorCommunityItemView()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// CreatorCommunityMoreItemView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/12/14.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CreatorCommunityMoreItemView: View {
|
||||
var body: some View {
|
||||
VStack(spacing: 11) {
|
||||
Image("btn_item_more")
|
||||
.resizable()
|
||||
.frame(width: 40, height: 40)
|
||||
|
||||
Text("더보기")
|
||||
.font(.custom(Font.light.rawValue, size: 11))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorCommunityMoreItemView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CreatorCommunityMoreItemView()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// CreatorCommunityNoPostsItemView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/12/14.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CreatorCommunityNoPostsItemView: View {
|
||||
var body: some View {
|
||||
VStack(spacing: 10.3) {
|
||||
CreatorCommunityWriteItemView()
|
||||
|
||||
Text("게시물 등록")
|
||||
.font(.custom(Font.bold.rawValue, size: 14.7))
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
|
||||
Text("게시 후에 게시물이 여기에 표시되고\n커뮤니티에 공개됩니다.")
|
||||
.font(.custom(Font.medium.rawValue, size: 12))
|
||||
.foregroundColor(Color(hex: "777777"))
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
.padding(.vertical, 16.7)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color(hex: "222222"))
|
||||
.cornerRadius(10.3)
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorCommunityNoPostsItemView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CreatorCommunityNoPostsItemView()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// CreatorCommunityWriteItemView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/12/14.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CreatorCommunityWriteItemView: View {
|
||||
var body: some View {
|
||||
Image("ic_make_message")
|
||||
.padding(13)
|
||||
.background(Color(hex: "333333"))
|
||||
.cornerRadius(13.3)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 13.3)
|
||||
.stroke(lineWidth: 1)
|
||||
.foregroundColor(Color(hex: "555555"))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorCommunityWriteItemView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CreatorCommunityWriteItemView()
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
//
|
||||
// CreatorNoticeWriteView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/11.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Combine
|
||||
|
||||
struct CreatorNoticeWriteView: View {
|
||||
|
||||
let notice: String
|
||||
|
||||
@ObservedObject var viewModel = CreatorNoticeWriteViewModel()
|
||||
|
||||
var body: some View {
|
||||
BaseView(isLoading: $viewModel.isLoading) {
|
||||
VStack(spacing: 0) {
|
||||
DetailNavigationBar(title: "공지사항 쓰기")
|
||||
|
||||
TextViewWrapper(
|
||||
text: $viewModel.writeNotice,
|
||||
placeholder: viewModel.placeholder,
|
||||
textColorHex: "eeeeee",
|
||||
backgroundColorHex: "222222",
|
||||
notice: notice
|
||||
)
|
||||
.frame(width: screenSize().width - 26.7, height: 300)
|
||||
.padding(.top, 13.3)
|
||||
|
||||
Text("저장")
|
||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
||||
.foregroundColor(Color(hex: "ffffff"))
|
||||
.padding(.vertical, 11.7)
|
||||
.frame(width: screenSize().width - 26.7)
|
||||
.background(Color(hex: "9970ff"))
|
||||
.cornerRadius(5.3)
|
||||
.padding(.top, 20)
|
||||
.onTapGesture {
|
||||
hideKeyboard()
|
||||
viewModel.writeCreatorNotice()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.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(hex: "9970ff"))
|
||||
.foregroundColor(Color.white)
|
||||
.multilineTextAlignment(.leading)
|
||||
.cornerRadius(20)
|
||||
.padding(.bottom, 66.7)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
hideKeyboard()
|
||||
}
|
||||
.onAppear {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
viewModel.writeNotice = notice
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
//
|
||||
// CreatorNoticeWriteViewModel.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/11.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
final class CreatorNoticeWriteViewModel: ObservableObject {
|
||||
let repository = ExplorerRepository()
|
||||
private var subscription = Set<AnyCancellable>()
|
||||
|
||||
@Published var isLoading = false
|
||||
@Published var errorMessage = ""
|
||||
@Published var isShowPopup = false
|
||||
|
||||
@Published var writeNotice = ""
|
||||
|
||||
var placeholder = "공지사항을 입력해 주세요"
|
||||
|
||||
func writeCreatorNotice() {
|
||||
isLoading = true
|
||||
|
||||
repository.writeCreatorNotice(notice: writeNotice.trimmingCharacters(in: .whitespacesAndNewlines) != placeholder ? writeNotice : "")
|
||||
.sink { result in
|
||||
switch result {
|
||||
case .finished:
|
||||
DEBUG_LOG("finish")
|
||||
case .failure(let error):
|
||||
ERROR_LOG(error.localizedDescription)
|
||||
}
|
||||
} receiveValue: { response in
|
||||
let responseData = response.data
|
||||
|
||||
do {
|
||||
let jsonDecoder = JSONDecoder()
|
||||
let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData)
|
||||
|
||||
if let message = decoded.message {
|
||||
self.errorMessage = message
|
||||
} else {
|
||||
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
||||
}
|
||||
|
||||
self.isShowPopup = true
|
||||
|
||||
if decoded.success {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
AppState.shared.back()
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
||||
self.isShowPopup = true
|
||||
}
|
||||
|
||||
self.isLoading = false
|
||||
}
|
||||
.store(in: &subscription)
|
||||
}
|
||||
}
|
|
@ -59,35 +59,27 @@ struct UserProfileView: View {
|
|||
.padding(.top, 13.3)
|
||||
.padding(.horizontal, 13.3)
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Text(
|
||||
creatorProfile.notice.trimmingCharacters(in: .whitespaces).isEmpty ?
|
||||
"공지사항이 없습니다." :
|
||||
creatorProfile.notice
|
||||
)
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color(hex: "000000"))
|
||||
.lineLimit(viewModel.isExpandNotice ? Int.max : 1)
|
||||
|
||||
Spacer()
|
||||
|
||||
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
|
||||
Image("ic_review")
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 26.7)
|
||||
.padding(.vertical, 13.3)
|
||||
.background(Color(hex: "fdca2f"))
|
||||
.padding(.top, 13.3)
|
||||
.onTapGesture {
|
||||
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
|
||||
AppState.shared.setAppStep(step: .creatorNoticeWrite(notice: creatorProfile.notice))
|
||||
} else {
|
||||
viewModel.isExpandNotice.toggle()
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
LazyHStack(spacing: 13.3) {
|
||||
if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId {
|
||||
CreatorCommunityWriteItemView()
|
||||
}
|
||||
|
||||
CreatorCommunityItemView()
|
||||
.frame(width: 320)
|
||||
|
||||
CreatorCommunityItemView()
|
||||
.frame(width: 320)
|
||||
|
||||
CreatorCommunityItemView()
|
||||
.frame(width: 320)
|
||||
|
||||
CreatorCommunityMoreItemView()
|
||||
}
|
||||
.padding(.horizontal, 15)
|
||||
}
|
||||
.frame(minHeight: 146)
|
||||
.padding(.top, 26.7)
|
||||
}
|
||||
|
||||
if creatorProfile.contentList.count > 0 ||
|
||||
|
|
|
@ -22,8 +22,6 @@ final class UserProfileViewModel: ObservableObject {
|
|||
@Published var isShowPopup = false
|
||||
@Published var isLoading = false
|
||||
|
||||
@Published var isExpandNotice = false
|
||||
|
||||
@Published var paymentDialogTitle = ""
|
||||
@Published var paymentDialogDesc = ""
|
||||
@Published var isShowPaymentDialog = false
|
||||
|
|
Loading…
Reference in New Issue