feat(chat-character): 신규 캐릭터 전체보기 화면 및 API 연동 추가

This commit is contained in:
Yu Sung
2025-09-12 22:28:53 +09:00
parent 49e014878d
commit ed3f3f796a
11 changed files with 365 additions and 25 deletions

View File

@@ -29,7 +29,7 @@ struct ChatTabView: View {
@State private var selectedTab: InnerTab = .character
@State private var isShowAuthView: Bool = false
@State private var isShowAuthConfirmView: Bool = false
@State private var pendingCharacterId: Int? = nil
@State private var pendingAction: (() -> Void)? = nil
@State private var payload = Payload()
// CharacterView
@@ -40,14 +40,33 @@ struct ChatTabView: View {
return
}
if auth == false {
//
pendingCharacterId = characterId
pendingAction = {
AppState.shared
.setAppStep(step: .characterDetail(characterId: characterId))
}
isShowAuthConfirmView = true
return
}
AppState.shared.setAppStep(step: .characterDetail(characterId: characterId))
}
private func handleCharacterSelection() {
let trimmed = token.trimmingCharacters(in: .whitespacesAndNewlines)
guard !trimmed.isEmpty else {
AppState.shared.setAppStep(step: .login)
return
}
if auth == false {
pendingAction = {
AppState.shared
.setAppStep(step: .newCharacterAll)
}
isShowAuthConfirmView = true
return
}
AppState.shared.setAppStep(step: .newCharacterAll)
}
var body: some View {
ZStack {
VStack(alignment: .leading, spacing: 0) {
@@ -126,9 +145,9 @@ struct ChatTabView: View {
.onDone { _ in
auth = true
isShowAuthView = false
if let chId = pendingCharacterId {
pendingCharacterId = nil
AppState.shared.setAppStep(step: .characterDetail(characterId: chId))
if let action = pendingAction {
pendingAction = nil
action()
}
}
.onClose {
@@ -149,7 +168,7 @@ struct ChatTabView: View {
cancelButtonTitle: "취소",
cancelButtonAction: {
isShowAuthConfirmView = false
pendingCharacterId = nil
pendingAction = nil
},
textAlignment: .center
)