Skip to content

Commit e7cc703

Browse files
authored
fix: Correctly observe drop success (#1730)
2 parents 07a4676 + 5a72ce0 commit e7cc703

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Mail/Views/Thread List/DragAndDropModifier.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,8 @@ struct DraggableThreadViewModifier: ViewModifier {
9595
func body(content: Content) -> some View {
9696
if #available(macCatalyst 16.0, iOS 16.0, *) {
9797
content
98-
.onAppear {
99-
NotificationCenter.default.addObserver(forName: .dropThreadSuccess, object: nil, queue: .main) { _ in
100-
onSuccess()
101-
}
102-
}
103-
.onDisappear {
104-
NotificationCenter.default.removeObserver(self, name: .dropThreadSuccess, object: nil)
98+
.onReceive(NotificationCenter.default.publisher(for: .dropThreadSuccess)) { _ in
99+
onSuccess()
105100
}
106101
#if os(macOS) || targetEnvironment(macCatalyst)
107102
.draggable(DraggedThread(threadIds: draggedThreadId)) {

0 commit comments

Comments
 (0)