699 lines
		
	
	
		
			41 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			699 lines
		
	
	
		
			41 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  ContentCreateView.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 2023/08/11.
 | 
						|
//
 | 
						|
 | 
						|
import SwiftUI
 | 
						|
import Kingfisher
 | 
						|
 | 
						|
struct ContentCreateView: View {
 | 
						|
    
 | 
						|
    @StateObject var keyboardHandler = KeyboardHandler()
 | 
						|
    @StateObject private var viewModel = ContentCreateViewModel()
 | 
						|
    
 | 
						|
    @State private var isShowPhotoPicker = false
 | 
						|
    @State private var isShowSelectAudioView = false
 | 
						|
    @State private var isShowSelectThemeView = false
 | 
						|
    @State private var isShowSelectDateView = false
 | 
						|
    @State private var isShowSelectTimeView = false
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        BaseView(isLoading: $viewModel.isLoading) {
 | 
						|
            GeometryReader { proxy in
 | 
						|
                ZStack {
 | 
						|
                    VStack(spacing: 0) {
 | 
						|
                        DetailNavigationBar(title: "콘텐츠 등록")
 | 
						|
                        
 | 
						|
                        ScrollView(.vertical, showsIndicators: false) {
 | 
						|
                            VStack(spacing: 0) {
 | 
						|
                                Text("썸네일")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                
 | 
						|
                                ZStack {
 | 
						|
                                    if let selectedImage = viewModel.coverImage {
 | 
						|
                                        Image(uiImage: selectedImage)
 | 
						|
                                            .resizable()
 | 
						|
                                            .scaledToFill()
 | 
						|
                                            .frame(width: 107, height: 107)
 | 
						|
                                            .background(Color.bg)
 | 
						|
                                            .cornerRadius(8)
 | 
						|
                                            .clipped()
 | 
						|
                                    } else {
 | 
						|
                                        Image("ic_logo")
 | 
						|
                                            .resizable()
 | 
						|
                                            .scaledToFit()
 | 
						|
                                            .padding(13.3)
 | 
						|
                                            .frame(width: 107, height: 107)
 | 
						|
                                            .background(Color.bg)
 | 
						|
                                            .cornerRadius(8)
 | 
						|
                                    }
 | 
						|
                                    
 | 
						|
                                    Image("ic_camera")
 | 
						|
                                        .padding(10)
 | 
						|
                                        .background(Color.button)
 | 
						|
                                        .cornerRadius(30)
 | 
						|
                                        .offset(x: 50, y: 36)
 | 
						|
                                }
 | 
						|
                                .frame(alignment: .bottomTrailing)
 | 
						|
                                .onTapGesture { isShowPhotoPicker = true }
 | 
						|
                                
 | 
						|
                                Text("등록")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                    .padding(.top, 13.3)
 | 
						|
                                
 | 
						|
                                Text(viewModel.fileName.trimmingCharacters(in: .whitespacesAndNewlines) == "" ? "파일선택" : viewModel.fileName)
 | 
						|
                                    .font(.custom(Font.medium.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.button)
 | 
						|
                                    .padding(.vertical, 10)
 | 
						|
                                    .frame(maxWidth: .infinity)
 | 
						|
                                    .background(Color.bg)
 | 
						|
                                    .cornerRadius(5.3)
 | 
						|
                                    .overlay(
 | 
						|
                                        RoundedCorner(radius: 8)
 | 
						|
                                            .stroke(lineWidth: 2)
 | 
						|
                                            .foregroundColor(Color.button)
 | 
						|
                                    )
 | 
						|
                                    .padding(.top, 13.3)
 | 
						|
                                    .onTapGesture { isShowSelectAudioView = true }
 | 
						|
                            }
 | 
						|
                            .padding(.top, 13.3)
 | 
						|
                            .padding(.horizontal, 13.3)
 | 
						|
                            
 | 
						|
                            Rectangle()
 | 
						|
                                .foregroundColor(Color.gray23)
 | 
						|
                                .frame(height: 6.7)
 | 
						|
                                .padding(.top, 26.7)
 | 
						|
                            
 | 
						|
                            VStack(spacing: 0) {
 | 
						|
                                Text("제목")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                
 | 
						|
                                TextField("제목을 입력하세요", text: $viewModel.title)
 | 
						|
                                    .autocapitalization(.none)
 | 
						|
                                    .disableAutocorrection(true)
 | 
						|
                                    .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .padding(.vertical, 16.7)
 | 
						|
                                    .padding(.horizontal, 13.3)
 | 
						|
                                    .background(Color.gray22)
 | 
						|
                                    .cornerRadius(6.7)
 | 
						|
                                    .keyboardType(.default)
 | 
						|
                                    .padding(.top, 13.3)
 | 
						|
                                
 | 
						|
                                HStack(spacing: 0) {
 | 
						|
                                    Text("내용")
 | 
						|
                                        .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                        .foregroundColor(Color.grayee)
 | 
						|
                                    
 | 
						|
                                    Spacer()
 | 
						|
                                    
 | 
						|
                                    Text("\(viewModel.detail.count)자")
 | 
						|
                                        .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                        .foregroundColor(Color.mainRed) +
 | 
						|
                                    Text(" / 최대 500자")
 | 
						|
                                        .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                        .foregroundColor(Color.gray77)
 | 
						|
                                }
 | 
						|
                                .padding(.top, 26.7)
 | 
						|
                                
 | 
						|
                                TextViewWrapper(
 | 
						|
                                    text: $viewModel.detail,
 | 
						|
                                    placeholder: viewModel.placeholder,
 | 
						|
                                    textColorHex: "eeeeee",
 | 
						|
                                    backgroundColorHex: "222222"
 | 
						|
                                )
 | 
						|
                                .frame(height: 184)
 | 
						|
                                .cornerRadius(6.7)
 | 
						|
                                .padding(.top, 13.3)
 | 
						|
                                
 | 
						|
                                Text("테마")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                    .padding(.top, 26.7)
 | 
						|
                                
 | 
						|
                                HStack(spacing: 13.3) {
 | 
						|
                                    if let theme = viewModel.theme {
 | 
						|
                                        KFImage(URL(string: theme.image))
 | 
						|
                                            .cancelOnDisappear(true)
 | 
						|
                                            .downsampling(
 | 
						|
                                                size: CGSize(
 | 
						|
                                                    width: 33.3,
 | 
						|
                                                    height: 33.3
 | 
						|
                                                )
 | 
						|
                                            )
 | 
						|
                                            .resizable()
 | 
						|
                                            .frame(width: 33.3, height: 33.3)
 | 
						|
                                            .clipShape(Circle())
 | 
						|
                                    }
 | 
						|
                                    
 | 
						|
                                    Text(viewModel.theme != nil ?
 | 
						|
                                         viewModel.theme!.theme :
 | 
						|
                                            "테마 선택")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.button)
 | 
						|
                                }
 | 
						|
                                .padding(.vertical, viewModel.theme != nil ? 8 : 13.3)
 | 
						|
                                .frame(maxWidth: .infinity)
 | 
						|
                                .background(Color.bg)
 | 
						|
                                .cornerRadius(24)
 | 
						|
                                .overlay(
 | 
						|
                                    RoundedRectangle(cornerRadius: 24)
 | 
						|
                                        .stroke(lineWidth: 2)
 | 
						|
                                        .foregroundColor(Color.button)
 | 
						|
                                )
 | 
						|
                                .padding(.top, 13.3)
 | 
						|
                                .onTapGesture {
 | 
						|
                                    isShowSelectThemeView = true
 | 
						|
                                    hideKeyboard()
 | 
						|
                                }
 | 
						|
                                
 | 
						|
                                Text("태그")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                    .padding(.top, 26.7)
 | 
						|
                                
 | 
						|
                                TextField("예: #연애 #커버곡", text: $viewModel.hashtags)
 | 
						|
                                    .autocapitalization(.none)
 | 
						|
                                    .disableAutocorrection(true)
 | 
						|
                                    .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .padding(.vertical, 16.7)
 | 
						|
                                    .padding(.horizontal, 13.3)
 | 
						|
                                    .background(Color.gray22)
 | 
						|
                                    .cornerRadius(6.7)
 | 
						|
                                    .keyboardType(.default)
 | 
						|
                                    .padding(.top, 13.3)
 | 
						|
                            }
 | 
						|
                            .padding(.top, 26.7)
 | 
						|
                            .padding(.horizontal, 13.3)
 | 
						|
                            
 | 
						|
                            Rectangle()
 | 
						|
                                .foregroundColor(Color.gray23)
 | 
						|
                                .frame(height: 6.7)
 | 
						|
                                .padding(.top, 26.7)
 | 
						|
                            
 | 
						|
                            VStack(spacing: 13.3) {
 | 
						|
                                Text("가격 설정")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                
 | 
						|
                                HStack(spacing: 13.3) {
 | 
						|
                                    SelectButtonView(title: "무료", isChecked: viewModel.isFree) {
 | 
						|
                                        if !viewModel.isFree {
 | 
						|
                                            viewModel.isFree = true
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                    
 | 
						|
                                    SelectButtonView(title: "유료", isChecked: !viewModel.isFree) {
 | 
						|
                                        if viewModel.isFree {
 | 
						|
                                            viewModel.isFree = false
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                }
 | 
						|
                                
 | 
						|
                                if !viewModel.isFree {
 | 
						|
                                    VStack(spacing: 13.3) {
 | 
						|
                                        Text("소장 설정")
 | 
						|
                                            .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                            .foregroundColor(Color.grayee)
 | 
						|
                                            .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                        
 | 
						|
                                        HStack(spacing: 6.7) {
 | 
						|
                                            SelectButtonView(title: "소장/대여", isChecked: viewModel.purchaseOption == .BOTH) {
 | 
						|
                                                if viewModel.purchaseOption != .BOTH {
 | 
						|
                                                    viewModel.purchaseOption = .BOTH
 | 
						|
                                                }
 | 
						|
                                            }
 | 
						|
                                            
 | 
						|
                                            SelectButtonView(title: "소장만", isChecked: viewModel.purchaseOption == .BUY_ONLY) {
 | 
						|
                                                if viewModel.purchaseOption != .BUY_ONLY {
 | 
						|
                                                    viewModel.purchaseOption = .BUY_ONLY
 | 
						|
                                                }
 | 
						|
                                            }
 | 
						|
                                            
 | 
						|
                                            SelectButtonView(title: "대여만", isChecked: viewModel.purchaseOption == .RENT_ONLY) {
 | 
						|
                                                if viewModel.purchaseOption != .RENT_ONLY {
 | 
						|
                                                    viewModel.purchaseOption = .RENT_ONLY
 | 
						|
                                                }
 | 
						|
                                            }
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                    .padding(.top, 13.3)
 | 
						|
                                    
 | 
						|
                                    VStack(spacing: 0) {
 | 
						|
                                        Text(viewModel.purchaseOption == .RENT_ONLY ? "대여 가격" : "소장 가격")
 | 
						|
                                            .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                            .foregroundColor(Color.grayd2)
 | 
						|
                                            .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                        
 | 
						|
                                        HStack(spacing: 0) {
 | 
						|
                                            TextField("가격을 입력하세요(5캔 이상)", text: $viewModel.priceString)
 | 
						|
                                                .autocapitalization(.none)
 | 
						|
                                                .disableAutocorrection(true)
 | 
						|
                                                .font(.custom(Font.bold.rawValue, size: 14.7))
 | 
						|
                                                .foregroundColor(Color.grayee)
 | 
						|
                                                .cornerRadius(6.7)
 | 
						|
                                                .keyboardType(.numberPad)
 | 
						|
                                                .padding(.trailing, 10)
 | 
						|
                                            
 | 
						|
                                            Spacer()
 | 
						|
                                            
 | 
						|
                                            Text("캔")
 | 
						|
                                                .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                                .foregroundColor(Color.gray77)
 | 
						|
                                        }
 | 
						|
                                        .padding(.vertical, 17)
 | 
						|
                                        .padding(.horizontal, 13.3)
 | 
						|
                                        .background(Color.gray22)
 | 
						|
                                        .cornerRadius(5.3)
 | 
						|
                                        .padding(.top, 5.3)
 | 
						|
                                        
 | 
						|
                                        Rectangle()
 | 
						|
                                            .foregroundColor(Color.gray23)
 | 
						|
                                            .frame(height: 1)
 | 
						|
                                            .padding(.top, 11)
 | 
						|
                                        
 | 
						|
                                        Text("※ 이용기간 대여 (5일) | 소장 (서비스종료시까지)")
 | 
						|
                                            .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                            .foregroundColor(Color.gray77)
 | 
						|
                                            .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                            .padding(.top, 13.3)
 | 
						|
                                        
 | 
						|
                                        Text("※ 대여가격은 소장가격의 70%로 자동 반영")
 | 
						|
                                            .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                            .foregroundColor(Color.gray77)
 | 
						|
                                            .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                        
 | 
						|
                                        Text("※ 콘텐츠의 최소금액은 5캔 입니다")
 | 
						|
                                            .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                            .foregroundColor(Color.gray77)
 | 
						|
                                            .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                    }
 | 
						|
                                    .padding(.top, 26.7)
 | 
						|
                                    
 | 
						|
                                    if viewModel.price > 0 && viewModel.purchaseOption != .RENT_ONLY {
 | 
						|
                                        VStack(spacing: 13.3) {
 | 
						|
                                            Text("한정판 설정")
 | 
						|
                                                .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                                .foregroundColor(Color.grayee)
 | 
						|
                                                .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                            
 | 
						|
                                            HStack(spacing: 13.3) {
 | 
						|
                                                SelectButtonView(title: "무제한", isChecked: !viewModel.isLimited) {
 | 
						|
                                                    if viewModel.isLimited {
 | 
						|
                                                        viewModel.isLimited = false
 | 
						|
                                                    }
 | 
						|
                                                }
 | 
						|
                                                
 | 
						|
                                                SelectButtonView(title: "한정판", isChecked: viewModel.isLimited) {
 | 
						|
                                                    if !viewModel.isLimited {
 | 
						|
                                                        viewModel.isLimited = true
 | 
						|
                                                    }
 | 
						|
                                                }
 | 
						|
                                            }
 | 
						|
                                            
 | 
						|
                                            if viewModel.isLimited {
 | 
						|
                                                TextField("한정판 개수를 입력하세요", text: $viewModel.limitedString)
 | 
						|
                                                    .autocapitalization(.none)
 | 
						|
                                                    .disableAutocorrection(true)
 | 
						|
                                                    .font(.custom(Font.bold.rawValue, size: 14.7))
 | 
						|
                                                    .foregroundColor(Color.grayee)
 | 
						|
                                                    .cornerRadius(6.7)
 | 
						|
                                                    .keyboardType(.numberPad)
 | 
						|
                                                    .padding(.vertical, 17)
 | 
						|
                                                    .padding(.horizontal, 13.3)
 | 
						|
                                                    .background(Color.gray22)
 | 
						|
                                                    .cornerRadius(5.3)
 | 
						|
                                            }
 | 
						|
                                        }
 | 
						|
                                        .padding(.top, 26.7)
 | 
						|
                                    }
 | 
						|
                                    
 | 
						|
                                    VStack(spacing: 13.3) {
 | 
						|
                                        Text("미리듣기")
 | 
						|
                                            .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                            .foregroundColor(Color.grayee)
 | 
						|
                                            .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                        
 | 
						|
                                        HStack(spacing: 13.3) {
 | 
						|
                                            SelectButtonView(title: "생성", isChecked: viewModel.isGeneratePreview) {
 | 
						|
                                                if !viewModel.isGeneratePreview {
 | 
						|
                                                    viewModel.isGeneratePreview = true
 | 
						|
                                                }
 | 
						|
                                            }
 | 
						|
                                            
 | 
						|
                                            SelectButtonView(title: "생성 안 함", isChecked: !viewModel.isGeneratePreview) {
 | 
						|
                                                if viewModel.isGeneratePreview {
 | 
						|
                                                    viewModel.isGeneratePreview = false
 | 
						|
                                                }
 | 
						|
                                            }
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                    .padding(.top, 26.7)
 | 
						|
                                    
 | 
						|
                                    if viewModel.isGeneratePreview {
 | 
						|
                                        VStack(spacing: 10) {
 | 
						|
                                            Text("미리듣기 시간 설정")
 | 
						|
                                                .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                                .foregroundColor(Color.grayee)
 | 
						|
                                                .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                            
 | 
						|
                                            Text("미리듣기 시간을 직접 설정하지 않으면 콘텐츠 앞부분 15초가 자동으로 설정됩니다. 미리듣기의 시간제한은 없습니다.")
 | 
						|
                                                .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                                .foregroundColor(Color.gray77)
 | 
						|
                                                .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                            
 | 
						|
                                            HStack(spacing: 13.3) {
 | 
						|
                                                VStack(spacing: 5.3) {
 | 
						|
                                                    Text("시작 시간")
 | 
						|
                                                        .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                                        .foregroundColor(Color.grayd2)
 | 
						|
                                                        .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                                    
 | 
						|
                                                    TextField("00:00:00", text: $viewModel.previewStartTime)
 | 
						|
                                                        .autocapitalization(.none)
 | 
						|
                                                        .disableAutocorrection(true)
 | 
						|
                                                        .font(.custom(Font.bold.rawValue, size: 14.6))
 | 
						|
                                                        .foregroundColor(Color.gray77)
 | 
						|
                                                        .padding(.vertical, 16.7)
 | 
						|
                                                        .padding(.horizontal, 13.3)
 | 
						|
                                                        .background(Color.gray22)
 | 
						|
                                                        .cornerRadius(6.7)
 | 
						|
                                                        .keyboardType(.default)
 | 
						|
                                                        .multilineTextAlignment(.center)
 | 
						|
                                                }
 | 
						|
                                                
 | 
						|
                                                VStack(spacing: 5.3) {
 | 
						|
                                                    Text("종료 시간")
 | 
						|
                                                        .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                                        .foregroundColor(Color.grayd2)
 | 
						|
                                                        .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                                    
 | 
						|
                                                    TextField("00:00:15", text: $viewModel.previewEndTime)
 | 
						|
                                                        .autocapitalization(.none)
 | 
						|
                                                        .disableAutocorrection(true)
 | 
						|
                                                        .font(.custom(Font.bold.rawValue, size: 14.6))
 | 
						|
                                                        .foregroundColor(Color.gray77)
 | 
						|
                                                        .padding(.vertical, 16.7)
 | 
						|
                                                        .padding(.horizontal, 13.3)
 | 
						|
                                                        .background(Color.gray22)
 | 
						|
                                                        .cornerRadius(6.7)
 | 
						|
                                                        .keyboardType(.default)
 | 
						|
                                                        .multilineTextAlignment(.center)
 | 
						|
                                                }
 | 
						|
                                            }
 | 
						|
                                            .padding(.top, 3.3)
 | 
						|
                                        }
 | 
						|
                                        .padding(.top, 26.7)
 | 
						|
                                    }
 | 
						|
                                }
 | 
						|
                            }
 | 
						|
                            .padding(.top, 26.7)
 | 
						|
                            .padding(.horizontal, 13.3)
 | 
						|
                            
 | 
						|
                            VStack(spacing: 13.3) {
 | 
						|
                                Text("연령 제한")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                
 | 
						|
                                HStack(spacing: 13.3) {
 | 
						|
                                    SelectButtonView(title: "전체 연령", isChecked: !viewModel.isAdult) {
 | 
						|
                                        if viewModel.isAdult {
 | 
						|
                                            viewModel.isAdult = false
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                    
 | 
						|
                                    SelectButtonView(title: "19세 이상", isChecked: viewModel.isAdult) {
 | 
						|
                                        if !viewModel.isAdult {
 | 
						|
                                            viewModel.isAdult = true
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                }
 | 
						|
                                
 | 
						|
                                Text("성인콘텐츠를 전체관람가로 등록할 시 발생하는 법적 책임은 회사와 상관없이 콘텐츠를 등록한 본인에게 있습니다.\n콘텐츠 내용은 물론 제목도 19금 여부를 체크해 주시기 바랍니다.")
 | 
						|
                                    .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(Color.mainRed3)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                    .padding(.top, 13.3)
 | 
						|
                            }
 | 
						|
                            .padding(.top, 26.7)
 | 
						|
                            .padding(.horizontal, 13.3)
 | 
						|
                            
 | 
						|
                            VStack(spacing: 13.3) {
 | 
						|
                                Text("댓글 가능 여부")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                
 | 
						|
                                HStack(spacing: 13.3) {
 | 
						|
                                    SelectButtonView(title: "댓글 가능", isChecked: viewModel.isAvailableComment) {
 | 
						|
                                        if !viewModel.isAvailableComment {
 | 
						|
                                            viewModel.isAvailableComment = true
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                    
 | 
						|
                                    SelectButtonView(title: "댓글 불가", isChecked: !viewModel.isAvailableComment) {
 | 
						|
                                        if viewModel.isAvailableComment {
 | 
						|
                                            viewModel.isAvailableComment = false
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                }
 | 
						|
                            }
 | 
						|
                            .padding(.top, 26.7)
 | 
						|
                            .padding(.horizontal, 13.3)
 | 
						|
                            
 | 
						|
                            VStack(spacing: 13.3) {
 | 
						|
                                Text("예약 공개")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 16.7))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                                    .frame(maxWidth: .infinity, alignment: .leading)
 | 
						|
                                
 | 
						|
                                HStack(spacing: 13.3) {
 | 
						|
                                    SelectButtonView(title: "지금 공개", isChecked: !viewModel.isActiveReservation) {
 | 
						|
                                        if viewModel.isActiveReservation {
 | 
						|
                                            viewModel.isActiveReservation = false
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                    
 | 
						|
                                    SelectButtonView(title: "예약 공개", isChecked: viewModel.isActiveReservation) {
 | 
						|
                                        if !viewModel.isActiveReservation {
 | 
						|
                                            viewModel.isActiveReservation = true
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                }
 | 
						|
                                
 | 
						|
                                if viewModel.isActiveReservation {
 | 
						|
                                    HStack(spacing: 13.3) {
 | 
						|
                                        VStack(alignment: .leading, spacing: 6.7) {
 | 
						|
                                            Text("예약 날짜")
 | 
						|
                                                .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                                .foregroundColor(Color.grayee)
 | 
						|
                                            
 | 
						|
                                            Button(action: {
 | 
						|
                                                hideKeyboard()
 | 
						|
                                                self.isShowSelectDateView = true
 | 
						|
                                            }) {
 | 
						|
                                                Text(viewModel.releaseDateString)
 | 
						|
                                                    .font(.custom(Font.medium.rawValue, size: 14.7))
 | 
						|
                                                    .foregroundColor(Color.grayee)
 | 
						|
                                                    .frame(maxWidth: .infinity)
 | 
						|
                                                    .frame(height: 48.7)
 | 
						|
                                                    .overlay(
 | 
						|
                                                        RoundedRectangle(cornerRadius: 6.7)
 | 
						|
                                                            .stroke(Color.button, lineWidth: 1.3)
 | 
						|
                                                    )
 | 
						|
                                            }
 | 
						|
                                        }
 | 
						|
                                        
 | 
						|
                                        VStack(alignment: .leading, spacing: 6.7) {
 | 
						|
                                            Text("예약 시간")
 | 
						|
                                                .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                                .foregroundColor(Color.grayee)
 | 
						|
                                            
 | 
						|
                                            Button(action: {
 | 
						|
                                                hideKeyboard()
 | 
						|
                                                self.isShowSelectTimeView = true
 | 
						|
                                            }) {
 | 
						|
                                                Text(viewModel.releaseTimeString)
 | 
						|
                                                    .font(.custom(Font.medium.rawValue, size: 14.7))
 | 
						|
                                                    .foregroundColor(Color.grayee)
 | 
						|
                                                    .frame(maxWidth: .infinity)
 | 
						|
                                                    .frame(height: 48.7)
 | 
						|
                                                    .overlay(
 | 
						|
                                                        RoundedRectangle(cornerRadius: 6.7)
 | 
						|
                                                            .stroke(Color.button, lineWidth: 1.3)
 | 
						|
                                                    )
 | 
						|
                                            }
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                    .padding(.horizontal, 13.3)
 | 
						|
                                    .padding(.vertical, 14.2)
 | 
						|
                                    .frame(maxWidth: .infinity)
 | 
						|
                                    .background(Color.gray22)
 | 
						|
                                    .padding(.top, 22.7)
 | 
						|
                                }
 | 
						|
                            }
 | 
						|
                            .padding(.top, 26.7)
 | 
						|
                            .padding(.horizontal, 13.3)
 | 
						|
                            
 | 
						|
                            VStack(spacing: 0) {
 | 
						|
                                HStack(alignment: .top, spacing: 0) {
 | 
						|
                                    Text("등록")
 | 
						|
                                        .font(.custom(Font.bold.rawValue, size: 18.3))
 | 
						|
                                        .foregroundColor(Color.white)
 | 
						|
                                        .frame(height: 50)
 | 
						|
                                        .frame(maxWidth: .infinity)
 | 
						|
                                        .background(Color.button)
 | 
						|
                                        .cornerRadius(10)
 | 
						|
                                        .padding(13.3)
 | 
						|
                                }
 | 
						|
                                .frame(maxWidth: .infinity)
 | 
						|
                                .background(Color.gray22)
 | 
						|
                                .cornerRadius(16.7, corners: [.topLeft, .topRight])
 | 
						|
                                .onTapGesture {
 | 
						|
                                    hideKeyboard()
 | 
						|
                                    viewModel.uploadAudioContent()
 | 
						|
                                }
 | 
						|
                                
 | 
						|
                                Rectangle()
 | 
						|
                                    .foregroundColor(Color.gray22)
 | 
						|
                                    .frame(height: keyboardHandler.keyboardHeight)
 | 
						|
                                    .frame(maxWidth: .infinity)
 | 
						|
                                
 | 
						|
                                if proxy.safeAreaInsets.bottom > 0 {
 | 
						|
                                    Rectangle()
 | 
						|
                                        .foregroundColor(Color.gray22)
 | 
						|
                                        .frame(height: 15.3)
 | 
						|
                                        .frame(maxWidth: .infinity)
 | 
						|
                                }
 | 
						|
                            }
 | 
						|
                            .padding(.top, 30)
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                    .fileImporter(
 | 
						|
                        isPresented: $isShowSelectAudioView,
 | 
						|
                        allowedContentTypes: [.audio],
 | 
						|
                        allowsMultipleSelection: false
 | 
						|
                    ) { result in
 | 
						|
                        switch result {
 | 
						|
                        case .success(let url):
 | 
						|
                            // Handle selected file URL
 | 
						|
                            viewModel.selectedFileUrl = url[0]
 | 
						|
                        case .failure(let error):
 | 
						|
                            // Handle error if needed
 | 
						|
                            print("File import error: \(error.localizedDescription)")
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                    
 | 
						|
                    if isShowSelectDateView {
 | 
						|
                        SelectDatePicker(selectedDate: $viewModel.releaseDate, isShowing: $isShowSelectDateView)
 | 
						|
                    }
 | 
						|
                    
 | 
						|
                    if isShowSelectTimeView {
 | 
						|
                        QuarterTimePickerView(selectedTime: $viewModel.releaseTime, isShowing: $isShowSelectTimeView)
 | 
						|
                    }
 | 
						|
                    
 | 
						|
                    if isShowPhotoPicker {
 | 
						|
                        ImagePicker(
 | 
						|
                            isShowing: $isShowPhotoPicker,
 | 
						|
                            selectedImage: $viewModel.coverImage,
 | 
						|
                            sourceType: .photoLibrary
 | 
						|
                        )
 | 
						|
                    }
 | 
						|
                    
 | 
						|
                    if viewModel.isShowCompletePopup {
 | 
						|
                        SodaDialog(
 | 
						|
                            title: "콘텐츠 업로드",
 | 
						|
                            desc: "등록한 콘텐츠가 업로드 중입니다.\n" +
 | 
						|
                            "콘텐츠 등록이 완료되면 알림을 보내드립니다.\n" +
 | 
						|
                            "이 페이지를 나가도 콘텐츠는 자동으로 등록됩니다.",
 | 
						|
                            confirmButtonTitle: "확인",
 | 
						|
                            confirmButtonAction: { AppState.shared.back() },
 | 
						|
                            cancelButtonTitle: "",
 | 
						|
                            cancelButtonAction: {}
 | 
						|
                        )
 | 
						|
                    }
 | 
						|
                    
 | 
						|
                    GeometryReader { proxy in
 | 
						|
                        VStack {
 | 
						|
                            Spacer()
 | 
						|
                            ContentCreateSelectThemeView(
 | 
						|
                                isShowing: $isShowSelectThemeView,
 | 
						|
                                selectedTheme: $viewModel.theme
 | 
						|
                            )
 | 
						|
                            .frame(width: proxy.size.width, height: proxy.size.height * 0.9)
 | 
						|
                            .offset(y: isShowSelectThemeView ? 0 : proxy.size.height * 0.9)
 | 
						|
                            .animation(.easeInOut(duration: 0.49), value: self.isShowSelectThemeView)
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                    .edgesIgnoringSafeArea(.bottom)
 | 
						|
                }
 | 
						|
                .onTapGesture { hideKeyboard() }
 | 
						|
                .edgesIgnoringSafeArea(.bottom)
 | 
						|
                .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) {
 | 
						|
                    GeometryReader { geo in
 | 
						|
                        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(.center)
 | 
						|
                                .cornerRadius(20)
 | 
						|
                                .padding(.top, 66.7)
 | 
						|
                            Spacer()
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
struct SelectButtonView: View {
 | 
						|
    
 | 
						|
    let title: String
 | 
						|
    let isChecked: Bool
 | 
						|
    let action: () -> Void
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        HStack(spacing: 6.7) {
 | 
						|
            if isChecked {
 | 
						|
                Image("ic_select_check")
 | 
						|
            }
 | 
						|
            
 | 
						|
            Text(title)
 | 
						|
                .font(.custom(Font.bold.rawValue, size: 14.7))
 | 
						|
                .foregroundColor(isChecked ? .white : Color.main)
 | 
						|
        }
 | 
						|
        .frame(height: 48.7)
 | 
						|
        .frame(maxWidth: .infinity)
 | 
						|
        .background(isChecked ? Color.button : Color.bg)
 | 
						|
        .cornerRadius(6.7)
 | 
						|
        .onTapGesture {
 | 
						|
            hideKeyboard()
 | 
						|
            action()
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
struct ContentCreateView_Previews: PreviewProvider {
 | 
						|
    static var previews: some View {
 | 
						|
        ContentCreateView()
 | 
						|
    }
 | 
						|
}
 |