feat(chat-room): 상단 notice 숨기기 기능 구현

This commit is contained in:
Yu Sung
2025-09-05 16:45:31 +09:00
parent 9d00869a8d
commit 3c61304b95
4 changed files with 38 additions and 58 deletions

View File

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

View File

@@ -91,28 +91,31 @@ struct ChatRoomView: View {
.padding(.vertical, 8)
.frame(width: screenSize().width, height: 60)
HStack(spacing: 8) {
Image(systemName: "info.circle.fill")
.resizable()
.frame(width: 20, height: 20)
if !viewModel.isHideNotice {
HStack(spacing: 8) {
Image(systemName: "info.circle.fill")
.resizable()
.frame(width: 20, height: 20)
Text(
viewModel.characterType == .Character
? "보이스온 AI캐릭터톡은 대화의 자유도가 높아 대화에 참여하는 당신은 누구든 될 수 있습니다.\n세계관 속 캐릭터로 대화를 하거나 새로운 인물로 캐릭터와 당신만의 스토리를 만들어보세요.\n※ AI캐릭터톡은 오픈베타 서비스 중이며, 캐릭터의 대화가 어색하거나 불완전할 수 있습니다."
: "AI Clone은 크리에이터의 정보를 기반으로 대화하지만, 모든 정보를 완벽하게 반영하거나 실제 대화와 일치하지 않을 수 있습니다."
)
.font(.custom(Font.preRegular.rawValue, size: 12))
.foregroundColor(.white)
Text(
viewModel.characterType == .Character
? "보이스온 AI캐릭터톡은 대화의 자유도가 높아 대화에 참여하는 당신은 누구든 될 수 있습니다.\n세계관 속 캐릭터로 대화를 하거나 새로운 인물로 캐릭터와 당신만의 스토리를 만들어보세요.\n※ AI캐릭터톡은 오픈베타 서비스 중이며, 캐릭터의 대화가 어색하거나 불완전할 수 있습니다."
: "AI Clone은 크리에이터의 정보를 기반으로 대화하지만, 모든 정보를 완벽하게 반영하거나 실제 대화와 일치하지 않을 수 있습니다."
)
.font(.custom(Font.preRegular.rawValue, size: 12))
.foregroundColor(.white)
Image(systemName: "chevron.up")
.resizable()
.scaledToFit()
.frame(width: 20)
Image(systemName: "chevron.up")
.resizable()
.scaledToFit()
.frame(width: 20)
.onTapGesture { viewModel.isHideNotice = true }
}
.padding(12)
.background(Color(hex: "13181B").opacity(0.7))
.cornerRadius(16)
.frame(width: screenSize().width - 48)
}
.padding(12)
.background(Color(hex: "13181B").opacity(0.7))
.cornerRadius(16)
.frame(width: screenSize().width - 48)
GeometryReader { geometry in
ScrollViewReader { proxy in

View File

@@ -22,7 +22,11 @@ final class ChatRoomViewModel: ObservableObject {
@Published private(set) var characterName: String = "Character Name"
@Published private(set) var characterType: CharacterType = .Character
@Published private(set) var chatRoomBgImageUrl: String? = nil
@Published private(set) var roomId: Int = 0
@Published private(set) var roomId: Int = 0 {
didSet {
isHideNotice = UserDefaults.standard.bool(forKey: noticeUserDefaultsKey())
}
}
@Published private(set) var countdownText: String = "00:00:00"
@Published private(set) var showQuotaNoticeView: Bool = false
@@ -47,6 +51,11 @@ final class ChatRoomViewModel: ObservableObject {
@Published var isShowingChatSettingsView = false
@Published var isShowingChangeBgView = false
@Published var isShowingChatResetConfirmDialog = false
@Published var isHideNotice = false {
didSet {
UserDefaults.standard.set(isHideNotice, forKey: noticeUserDefaultsKey())
}
}
var ownedImageUrls: [String] {
return messages
@@ -362,6 +371,10 @@ final class ChatRoomViewModel: ObservableObject {
chatRoomBgImageId = imageItem.id
}
private func noticeUserDefaultsKey() -> String {
return "chat_notice_hidden_room_\(roomId)"
}
private func resetData() {
characterProfileUrl = ""
characterName = "Character Name"

View File

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