feat(chat-room) 채팅방 골격 추가
This commit is contained in:
@@ -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
|
||||
}
|
||||
15
SodaLive/Sources/Chat/Talk/Room/ChatRoomRepository.swift
Normal file
15
SodaLive/Sources/Chat/Talk/Room/ChatRoomRepository.swift
Normal 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>()
|
||||
}
|
||||
23
SodaLive/Sources/Chat/Talk/Room/ChatRoomView.swift
Normal file
23
SodaLive/Sources/Chat/Talk/Room/ChatRoomView.swift
Normal 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()
|
||||
}
|
||||
21
SodaLive/Sources/Chat/Talk/Room/ChatRoomViewModel.swift
Normal file
21
SodaLive/Sources/Chat/Talk/Room/ChatRoomViewModel.swift
Normal 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>()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// CreateChatRoomRequest.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 9/2/25.
|
||||
//
|
||||
|
||||
struct CreateChatRoomRequest: Encodable {
|
||||
let characterId: Int64
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// CreateChatRoomResponse.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 9/2/25.
|
||||
//
|
||||
|
||||
struct CreateChatRoomResponse: Decodable {
|
||||
let chatRoomId: Int64
|
||||
}
|
||||
@@ -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?
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// SendChatMessageRequest.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 9/2/25.
|
||||
//
|
||||
|
||||
struct SendChatMessageRequest: Encodable {
|
||||
let message: String
|
||||
}
|
||||
@@ -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?
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// ChatQuotaPurchaseRequest.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 9/2/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// ChatQuotaStatusResponse.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 9/2/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// ChatRoomResetRequest.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 9/2/25.
|
||||
//
|
||||
|
||||
struct ChatRoomResetRequest: Encodable {
|
||||
let container: String = "ios"
|
||||
}
|
||||
Reference in New Issue
Block a user