feat(chat-character): 신규 캐릭터 전체보기 화면 및 API 연동 추가
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user