From 192439abe7c4ffd0c41232df448335356d2fa60f Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 12 Feb 2018 22:22:06 -0800 Subject: [PATCH] =?UTF-8?q?Make=20Folder=20watch=20for=20children-did-chan?= =?UTF-8?q?ge=20notifications=20=E2=80=94=20when=20its=20own=20children=20?= =?UTF-8?q?change,=20update=20the=20unread=20count.=20Fix=20#322.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/Account/Folder.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Frameworks/Account/Folder.swift b/Frameworks/Account/Folder.swift index 85d411b06..33928ea0a 100644 --- a/Frameworks/Account/Folder.swift +++ b/Frameworks/Account/Folder.swift @@ -58,6 +58,7 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider, self.hashValue = folderID NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(childrenDidChange(_:)), name: .ChildrenDidChange, object: self) } // MARK: - Disk Dictionary @@ -130,7 +131,7 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider, return true } - // MARK: Notifications + // MARK: - Notifications @objc func unreadCountDidChange(_ note: Notification) { @@ -141,6 +142,11 @@ public final class Folder: DisplayNameProvider, Container, UnreadCountProvider, } } + @objc func childrenDidChange(_ note: Notification) { + + updateUnreadCount() + } + // MARK: - Equatable static public func ==(lhs: Folder, rhs: Folder) -> Bool {