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 {