fix(creator): 본인 채널 DM 확인을 추가한다
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user