크리에이터 채널 페이지 추가

This commit is contained in:
Yu Sung
2023-08-11 18:33:48 +09:00
parent a167840162
commit a8338e6fea
69 changed files with 4087 additions and 10 deletions

View File

@@ -14,6 +14,9 @@ enum LiveApi {
case getReservations(isActive: Bool)
case getReservation(reservationId: Int)
case cancelReservation(request: CancelLiveReservationRequest)
case getRoomDetail(roomId: Int)
case makeReservation(request: MakeLiveReservationRequest)
case enterRoom(request: EnterOrQuitLiveRoomRequest)
}
extension LiveApi: TargetType {
@@ -37,14 +40,26 @@ extension LiveApi: TargetType {
case .cancelReservation:
return "/live/reservation/cancel"
case .getRoomDetail(let roomId):
return "/live/room/detail/\(roomId)"
case .makeReservation:
return "/live/reservation"
case .enterRoom:
return "/live/room/enter"
}
}
var method: Moya.Method {
switch self {
case .roomList, .recentVisitRoomUsers, .getReservations, .getReservation:
case .roomList, .recentVisitRoomUsers, .getReservations, .getReservation, .getRoomDetail:
return .get
case .makeReservation, .enterRoom:
return .post
case .cancelReservation:
return .put
}
@@ -92,6 +107,16 @@ extension LiveApi: TargetType {
case .cancelReservation(let request):
return .requestJSONEncodable(request)
case .getRoomDetail:
let parameters = ["timezone": TimeZone.current.identifier] as [String: Any]
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
case .makeReservation(let request):
return .requestJSONEncodable(request)
case .enterRoom(let request):
return .requestJSONEncodable(request)
}
}

View File

@@ -32,4 +32,16 @@ final class LiveRepository {
func cancelReservation(reservationId: Int, reason: String) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.cancelReservation(request: CancelLiveReservationRequest(reservationId: reservationId, reason: reason)))
}
func getRoomDetail(roomId: Int) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getRoomDetail(roomId: roomId))
}
func makeReservation(request: MakeLiveReservationRequest) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.makeReservation(request: request))
}
func enterRoom(request: EnterOrQuitLiveRoomRequest) -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.enterRoom(request: request))
}
}

View File

@@ -0,0 +1,203 @@
//
// LiveReservationCompleteView.swift
// SodaLive
//
// Created by klaus on 2023/08/11.
//
import SwiftUI
struct LiveReservationCompleteView: View {
let reservationCompleteData: MakeLiveReservationResponse
var body: some View {
BaseView {
VStack(spacing: 0) {
DetailNavigationBar(title: "라이브 예약 완료") {
AppState.shared.setAppStep(step: .main)
}
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 0) {
Text("예약이 완료되었습니다.")
.font(.custom(Font.bold.rawValue, size: 20))
.foregroundColor(Color(hex: "a285eb"))
.frame(width: screenSize().width - 26.7, alignment: .leading)
.padding(.top, 20)
Image("img_compleate_book")
.resizable()
.scaledToFit()
.frame(width: 233.25)
.padding(.top, 16.7)
.padding(.bottom, 26.7)
Text("라이브 예약정보")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
.frame(width: screenSize().width - 53.4, alignment: .leading)
VStack(spacing: 6.7) {
HStack(spacing: 26.7) {
Text("채널")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "777777"))
Text(reservationCompleteData.nickname)
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 26.7) {
Text("구매내역")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "777777"))
Text(reservationCompleteData.title)
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 26.7) {
Text("예약일자")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "777777"))
Text(reservationCompleteData.beginDateString)
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 26.7) {
Text("라이브 비용")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "777777"))
Text(reservationCompleteData.price)
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
}
.padding(.top, 16.7)
Rectangle()
.frame(width: screenSize().width, height: 6.7)
.foregroundColor(Color(hex: "232323"))
.padding(.vertical, 20)
Text("결제정보")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
.frame(width: screenSize().width - 53.4, alignment: .leading)
VStack(spacing: 13.3) {
HStack(spacing: 0) {
Text("보유코인")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "777777"))
Spacer()
Text("\(reservationCompleteData.haveCan)")
.font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color(hex: "eeeeee"))
Text(" 코인")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 0) {
Text("결제코인")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "777777"))
Spacer()
Text("\(reservationCompleteData.useCan)")
.font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color(hex: "eeeeee"))
Text(" 코인")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
HStack(spacing: 0) {
Text("잔여코인")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "777777"))
Spacer()
Text("\(reservationCompleteData.remainingCan)")
.font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color(hex: "eeeeee"))
Text(" 코인")
.font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee"))
}
.frame(width: screenSize().width - 53.4, alignment: .leading)
}
.padding(.top, 20)
HStack(spacing: 13.3) {
Text("홈으로 이동")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "9970ff"))
.padding(.vertical, 16)
.frame(width: (screenSize().width - 40) / 2)
.background(Color(hex: "9970ff").opacity(0.2))
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(lineWidth: 1)
.foregroundColor(Color(hex: "9970ff"))
)
.onTapGesture {
AppState.shared.setAppStep(step: .main)
}
Text("예약 내역 이동")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(.white)
.padding(.vertical, 16)
.frame(width: (screenSize().width - 40) / 2)
.background(Color(hex: "9970ff"))
.cornerRadius(10)
.onTapGesture {
AppState.shared.setAppStep(step: .liveReservation)
}
}
.padding(.vertical, 26.7)
}
}
}
}
}
}
struct LiveReservationCompleteView_Previews: PreviewProvider {
static var previews: some View {
LiveReservationCompleteView(
reservationCompleteData: MakeLiveReservationResponse(
reservationId: 10,
nickname: "김상담",
title: "여자들이 좋아하는 남자 스타일은?",
beginDateString: "2021년 7월 9일 (금), 오후 02:00",
price: "무료",
haveCan: 100,
useCan: 0,
remainingCan: 100
)
)
}
}

View File

@@ -0,0 +1,15 @@
//
// MakeLiveReservationRequest.swift
// SodaLive
//
// Created by klaus on 2023/08/11.
//
import Foundation
struct MakeLiveReservationRequest: Encodable {
let roomId: Int
let password: Int?
let container: String = "ios"
let timezone: String = TimeZone.current.identifier
}

View File

@@ -0,0 +1,19 @@
//
// MakeLiveReservationResponse.swift
// SodaLive
//
// Created by klaus on 2023/08/11.
//
import Foundation
struct MakeLiveReservationResponse: Decodable {
let reservationId: Int
let nickname: String
let title: String
let beginDateString: String
let price: String
let haveCan: Int
let useCan: Int
let remainingCan: Int
}

View File

@@ -7,6 +7,37 @@
import Foundation
struct GetRoomDetailResponse: Decodable {
let roomId: Int
let price: Int
let title: String
let content: String
let isPaid: Bool
let isPrivateRoom: Bool
let isSecretRoom: Bool
let password: Int?
let tags: [String]
let channelName: String?
let beginDateTime: String
let isNotification: Bool
let numberOfParticipants: Int
let numberOfParticipantsTotal: Int
let manager: GetRoomDetailManager
let participatingUsers: [GetRoomDetailUser]
}
struct GetRoomDetailManager: Decodable {
let id: Int
let nickname: String
let introduce: String
let youtubeUrl: String?
let instagramUrl: String?
let websiteUrl: String?
let blogUrl: String?
let profileImageUrl: String
let isCounselor: Bool
}
struct GetRoomDetailUser: Decodable, Hashable {
let id: Int
let nickname: String

View File

@@ -0,0 +1,14 @@
//
// EnterOrQuitLiveRoomRequest.swift
// SodaLive
//
// Created by klaus on 2023/08/11.
//
import Foundation
struct EnterOrQuitLiveRoomRequest: Encodable {
let roomId: Int
let container: String = "ios"
var password: Int? = nil
}