feat(chat-room) 채팅방 골격 추가

This commit is contained in:
Yu Sung
2025-09-02 21:49:22 +09:00
parent 833fd0f1b0
commit 6b445fff7c
19 changed files with 246 additions and 21 deletions

View File

@@ -0,0 +1,13 @@
//
// CharacterInfo.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
struct CharacterInfo: Decodable {
let characterId: Int64
let name: String
let profileImageUrl: String
let characterType: CharacterType
}

View File

@@ -0,0 +1,15 @@
//
// ChatRoomRepository.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import Foundation
import CombineMoya
import Combine
import Moya
class ChatRoomRepository {
private let talkApi = MoyaProvider<TalkApi>()
}

View File

@@ -0,0 +1,23 @@
//
// ChatRoomView.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import SwiftUI
struct ChatRoomView: View {
@StateObject var viewModel = ChatRoomViewModel()
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
}
}
}
#Preview {
ChatRoomView()
}

View File

@@ -0,0 +1,21 @@
//
// ChatRoomViewModel.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import Foundation
import Combine
import Moya
final class ChatRoomViewModel: ObservableObject {
// MARK: - Published State
@Published var isLoading: Bool = false
@Published var errorMessage: String = ""
@Published var isShowPopup = false
// MARK: - Private
private let repository = ChatRoomRepository()
private var subscription = Set<AnyCancellable>()
}

View File

@@ -0,0 +1,10 @@
//
// CreateChatRoomRequest.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
struct CreateChatRoomRequest: Encodable {
let characterId: Int64
}

View File

@@ -0,0 +1,10 @@
//
// CreateChatRoomResponse.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
struct CreateChatRoomResponse: Decodable {
let chatRoomId: Int64
}

View File

@@ -0,0 +1,16 @@
//
// ChatRoomEnterResponse.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
struct ChatRoomEnterResponse: Decodable {
let roomId: Int64
let character: CharacterInfo
let messages: [ServerChatMessage]
let hasMoreMessages: Bool
let totalRemaining: Int
let nextRechargeAtEpoch: Int64?
let bgImageUrl: String?
}

View File

@@ -0,0 +1,18 @@
//
// AiMessageItemView.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import SwiftUI
struct AiMessageItemView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
#Preview {
AiMessageItemView()
}

View File

@@ -0,0 +1,10 @@
//
// SendChatMessageRequest.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
struct SendChatMessageRequest: Encodable {
let message: String
}

View File

@@ -0,0 +1,12 @@
//
// SendChatMessageResponse.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
struct SendChatMessageResponse: Decodable {
let messages: [ServerChatMessage]
let totalRemaining: Int
let nextRechargeAtEpoch: Int64?
}

View File

@@ -0,0 +1,18 @@
//
// ServerChatMessage.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
struct ServerChatMessage: Decodable {
let messageId: Int64
let message: String
let profileImageUrl: String
let mine: Bool
let createdAt: Int64
let messageType: String
let imageUrl: String?
let price: Int?
let hasAccess: Bool
}

View File

@@ -0,0 +1,18 @@
//
// TypingIndicatorItemView.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import SwiftUI
struct TypingIndicatorItemView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
#Preview {
TypingIndicatorItemView()
}

View File

@@ -0,0 +1,18 @@
//
// UserMessageItemView.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import SwiftUI
struct UserMessageItemView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
#Preview {
UserMessageItemView()
}

View File

@@ -0,0 +1,18 @@
//
// ChatQuotaNoticeItemView.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import SwiftUI
struct ChatQuotaNoticeItemView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
#Preview {
ChatQuotaNoticeItemView()
}

View File

@@ -0,0 +1,8 @@
//
// ChatQuotaPurchaseRequest.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import Foundation

View File

@@ -0,0 +1,8 @@
//
// ChatQuotaStatusResponse.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
import Foundation

View File

@@ -0,0 +1,10 @@
//
// ChatRoomResetRequest.swift
// SodaLive
//
// Created by klaus on 9/2/25.
//
struct ChatRoomResetRequest: Encodable {
let container: String = "ios"
}