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

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