fix(chat): Direct 대화방 진입을 분기한다

This commit is contained in:
Yu Sung
2026-07-12 23:40:39 +09:00
parent c9570fc735
commit dbf696978f
7 changed files with 23 additions and 17 deletions

View File

@@ -8924,7 +8924,7 @@
CODE_SIGN_ENTITLEMENTS = SodaLive/SodaLive.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_ASSET_PATHS = "\"SodaLive/Preview Content\"";
DEVELOPMENT_TEAM = 3A8QGPMRXM;
ENABLE_PREVIEWS = YES;
@@ -8965,7 +8965,7 @@
CODE_SIGN_ENTITLEMENTS = SodaLive/SodaLive.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_ASSET_PATHS = "\"SodaLive/Preview Content\"";
DEVELOPMENT_TEAM = 3A8QGPMRXM;
ENABLE_PREVIEWS = YES;

View File

@@ -3,12 +3,12 @@ import SwiftUI
struct MainHomeFollowingChatSection: View {
let recentChats: [ChatRoomListItemResponse]
let onTapTitle: () -> Void
let onTapChatRoom: (Int) -> Void
let onTapChatRoom: (Int, String) -> Void
init(
recentChats: [ChatRoomListItemResponse],
onTapTitle: @escaping () -> Void = {},
onTapChatRoom: @escaping (Int) -> Void = { _ in }
onTapChatRoom: @escaping (Int, String) -> Void = { _, _ in }
) {
self.recentChats = recentChats
self.onTapTitle = onTapTitle
@@ -24,7 +24,7 @@ struct MainHomeFollowingChatSection: View {
LazyHStack(alignment: .top, spacing: SodaSpacing.s8) {
ForEach(recentChats) { chat in
MainHomeFollowingChatItemView(chat: chat) {
onTapChatRoom(chat.roomId)
onTapChatRoom(chat.roomId, chat.chatType)
}
}
}

View File

@@ -7,7 +7,7 @@ struct MainHomeFollowingView: View {
let onTapLogin: () -> Void
let onTapFollowingAll: () -> Void
let onTapChatTab: () -> Void
let onTapChatRoom: (Int) -> Void
let onTapChatRoom: (Int, String) -> Void
let onTapSchedule: (CreatorActivityType, Int) -> Void
let onTapCommunityPost: (Int) -> Void
@@ -20,7 +20,7 @@ struct MainHomeFollowingView: View {
onTapLogin: @escaping () -> Void = {},
onTapFollowingAll: @escaping () -> Void = {},
onTapChatTab: @escaping () -> Void = {},
onTapChatRoom: @escaping (Int) -> Void = { _ in },
onTapChatRoom: @escaping (Int, String) -> Void = { _, _ in },
onTapSchedule: @escaping (CreatorActivityType, Int) -> Void = { _, _ in },
onTapCommunityPost: @escaping (Int) -> Void = { _ in }
) {

View File

@@ -15,7 +15,7 @@ struct MainHomeView: View {
let onTapFollowingLogin: () -> Void
let onTapFollowingAll: () -> Void
let onTapChatTab: () -> Void
let onTapChatRoom: (Int) -> Void
let onTapChatRoom: (Int, String) -> Void
let onTapFollowingSchedule: (CreatorActivityType, Int) -> Void
@State private var selectedTab: MainHomeTab = .recommendation
@@ -125,7 +125,7 @@ struct MainHomeView_Previews: PreviewProvider {
onTapFollowingLogin: {},
onTapFollowingAll: {},
onTapChatTab: {},
onTapChatRoom: { _ in },
onTapChatRoom: { _, _ in },
onTapFollowingSchedule: { _, _ in }
)
}

View File

@@ -519,10 +519,15 @@ struct MainView: View {
viewModel.currentTab = .chat
}
private func handleFollowingChatRoomTap(roomId: Int) {
private func handleFollowingChatRoomTap(roomId: Int, chatType: String) {
guard roomId > 0 else { return }
if chatType == "DM" {
appState.setAppStep(step: .userCreatorChatRoom(roomId: roomId))
} else {
appState.setAppStep(step: .chatRoom(id: roomId))
}
}
private func handleFollowingScheduleTap(type: CreatorActivityType, targetId: Int) {
guard targetId > 0 else { return }

View File

@@ -263,7 +263,7 @@
- 각 item은 `targetImageUrl`, `targetName`, `lastMessage`, `lastMessageAt`을 표시한다.
- `chatType == "DM"`이면 `Direct` 태그를 표시한다.
- `lastMessageAt`은 UTC 기준 문자열로 받아 상대 시간 또는 기존 Talk item과 맞는 시간 label로 표시한다.
- item 탭 시 `onTapChatRoom(roomId)`를 호출한다.
- item 탭 시 `onTapChatRoom(roomId, chatType)`를 호출한다.
- 검증 기준:
- 실행 명령: `rg "struct MainHomeFollowingChatSection|recentChatTitle|ChatRoomListItemResponse|targetImageUrl|targetName|lastMessage|lastMessageAt|chatType == \"DM\"|Direct|onTapChatRoom" SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingChatSection.swift`
- 기대 결과: 최근 대화 item 필드, `Direct` 태그 조건, 채팅방 tap callback이 확인된다.
@@ -275,12 +275,13 @@
- 확인: `SodaLive/Sources/App/AppStep.swift`
- 확인: `SodaLive/Sources/ContentView.swift`
- 작업 내용:
- `MainHomeView``onTapChatRoom: (Int) -> Void` callback을 추가한다.
- `MainHomeView``onTapChatRoom: (Int, String) -> Void` callback을 추가한다.
- `MainHomeFollowingView`까지 callback을 전달한다.
- `MainView`에서 `onTapChatRoom` `AppState.shared.setAppStep(step: .chatRoom(id: roomId))`로 구현한다.
- `MainView`에서 `chatType == "DM"`이면 `AppState.shared.setAppStep(step: .userCreatorChatRoom(roomId: roomId))`로 구현한다.
- `MainView`에서 Direct가 아니면 기존처럼 `AppState.shared.setAppStep(step: .chatRoom(id: roomId))`로 구현한다.
- 검증 기준:
- 실행 명령: `rg "onTapChatRoom|chatRoom\\(id:|ChatRoomView" SodaLive/Sources/V2/Main/Home/MainHomeView.swift SodaLive/Sources/V2/Main/MainView.swift SodaLive/Sources/App/AppStep.swift SodaLive/Sources/ContentView.swift`
- 기대 결과: 최근 대화 item tap 기존 채팅방 화면으로 연결된다.
- 기대 결과: 최근 대화 Direct item tap`UserCreatorChatRoomView`, Direct가 아닌 item tap은 기존 채팅방 화면으로 연결된다.
### Phase 7: 이달의 스케줄 섹션

View File

@@ -375,12 +375,12 @@ Figma 참조:
- `recentChats`가 비어 있으면 섹션을 숨긴다.
- 섹션 타이틀은 `최근 대화`를 사용한다.
- `ChatRoomListItemResponse.roomId`를 item id와 채팅방 진입 id로 사용한다.
- `chatType == "DM"`이면 `Direct` 태그를 표시한다.
- `chatType == "DM"`이면 `Direct` 태그를 표시하고, item 탭 시 `UserCreatorChatRoomView(roomId:)` 진입 흐름을 사용한다.
- `targetName`은 채팅방 제목으로 표시한다.
- `targetImageUrl`은 채팅방 이미지로 표시한다.
- `lastMessage`는 최근 메시지 preview로 표시한다.
- `lastMessageAt`은 UTC 기준 문자열로 받아 디바이스 timezone 기준 상대 시간 또는 시간 label로 표시한다.
- item 탭 `roomId`로 기존 채팅방 진입 흐름을 사용한다.
- Direct 태그가 없는 item 탭 `roomId`로 기존 채팅방 진입 흐름을 사용한다.
- 채팅방 진입에 로그인 guard가 필요하면 기존 메인/채팅 탭의 guard 패턴을 재사용한다.
### 7.6 이달의 스케줄 섹션