fix(creator): 본인 채널 DM 확인을 추가한다

This commit is contained in:
Yu Sung
2026-07-12 18:48:27 +09:00
parent caa74c607d
commit 4f271a77ee
18 changed files with 63 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ struct MainChatView: View {
let onTapSearch: () -> Void
@StateObject private var viewModel = MainChatViewModel()
@StateObject private var appState = AppState.shared
var body: some View {
VStack(spacing: 0) {
@@ -28,7 +29,14 @@ struct MainChatView: View {
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.background(Color.black.ignoresSafeArea())
.onAppear { viewModel.fetchFirstPageIfNeeded() }
.onAppear {
if applyPendingFilterIfNeeded() == false {
viewModel.fetchFirstPageIfNeeded()
}
}
.valueChanged(value: appState.pendingMainChatFilter) { _ in
_ = applyPendingFilterIfNeeded()
}
.sodaToast(
isPresented: $viewModel.isShowPopup,
message: viewModel.errorMessage,
@@ -89,6 +97,12 @@ struct MainChatView: View {
AppState.shared.setAppStep(step: .userCreatorChatRoom(roomId: roomId))
}
}
private func applyPendingFilterIfNeeded() -> Bool {
guard let filter = appState.consumePendingMainChatFilter() else { return false }
viewModel.applyFilter(filter)
return true
}
}
struct MainChatView_Previews: PreviewProvider {

View File

@@ -123,6 +123,7 @@ struct MainView: View {
.valueChanged(value: appState.pushMessageId) { handlePushMessageId($0) }
.valueChanged(value: appState.pushAudioContentId) { handlePushAudioContentId($0) }
.valueChanged(value: appState.pushSeriesId) { handlePushSeriesId($0) }
.valueChanged(value: appState.pendingMainChatFilter) { handlePendingMainChatFilter($0) }
.valueChanged(value: appState.isShowPlayer) { isShowPlayer in
guard !isShowPlayer,
let pendingExternalNavigationAction = pendingExternalNavigationAction else {
@@ -408,6 +409,11 @@ struct MainView: View {
}
}
private func handlePendingMainChatFilter(_ filter: MainChatFilter?) {
guard filter != nil else { return }
viewModel.currentTab = .chat
}
private func handlePushAudioContentId(_ value: Int) {
guard value > 0 else { return }
let contentId = value