feat(chat): 유저 크리에이터 DM을 추가한다

This commit is contained in:
Yu Sung
2026-07-12 04:48:17 +09:00
parent ce191539f2
commit 2dfff32ac1
23 changed files with 2410 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import Kingfisher
struct CreatorChannelHeaderSection: View {
let creator: CreatorChannelCreatorResponse
let onTapTalk: () -> Void
let onTapDm: () -> Void
var body: some View {
ZStack(alignment: .bottom) {
@@ -52,7 +53,9 @@ struct CreatorChannelHeaderSection: View {
CreatorChannelTalkActionSection(
isAiChatAvailable: creator.isAiChatAvailable,
onTapTalk: onTapTalk
isDmAvailable: creator.isDmAvailable,
onTapTalk: onTapTalk,
onTapDm: onTapDm
)
}
.frame(maxWidth: .infinity)

View File

@@ -234,7 +234,11 @@ struct CreatorChannelView: View {
@ViewBuilder
private var headerSection: some View {
if let creator = viewModel.response?.creator {
CreatorChannelHeaderSection(creator: creator, onTapTalk: handleTalkTap)
CreatorChannelHeaderSection(
creator: creator,
onTapTalk: handleTalkTap,
onTapDm: handleDmTap
)
}
}
@@ -544,6 +548,18 @@ struct CreatorChannelView: View {
startChat(characterId: characterId)
}
private func handleDmTap() {
guard let creatorId = viewModel.response?.creator.creatorId, creatorId > 0 else { return }
let trimmed = token.trimmingCharacters(in: .whitespacesAndNewlines)
guard !trimmed.isEmpty else {
AppState.shared.setAppStep(step: .login)
return
}
AppState.shared.setAppStep(step: .userCreatorChatCreator(creatorId: creatorId))
}
private func startChat(characterId: Int) {
viewModel.createChatRoom(characterId: characterId) { chatRoomId in
AppState.shared.setAppStep(step: .chatRoom(id: chatRoomId))

View File

@@ -2,10 +2,12 @@ import SwiftUI
struct CreatorChannelTalkActionSection: View {
let isAiChatAvailable: Bool
let isDmAvailable: Bool
let onTapTalk: () -> Void
let onTapDm: () -> Void
var body: some View {
HStack {
HStack(spacing: SodaSpacing.s8) {
Spacer()
if isAiChatAvailable {
@@ -28,6 +30,26 @@ struct CreatorChannelTalkActionSection: View {
.buttonStyle(.plain)
}
if isDmAvailable {
Button(action: onTapDm) {
HStack(spacing: SodaSpacing.s6) {
Image("ic_new_talk")
.resizable()
.frame(width: 20, height: 20)
Text(I18n.CreatorChannelHome.dm)
.appFont(size: 16, weight: .medium)
.foregroundColor(.white)
}
.padding(SodaSpacing.s12)
.overlay(
Capsule()
.stroke(Color.white.opacity(0.3), lineWidth: 1)
)
}
.buttonStyle(.plain)
}
Spacer()
}
.frame(height: 44)