File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
WooCommerce/Classes/ViewRelated/Notifications Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ class NotificationsViewController: UIViewController {
5353 ///
5454 private let formatter = StringFormatter ( )
5555
56+ private var nextStatus = false
57+
5658 /// UI Active State
5759 ///
5860 private var state : State = . results {
@@ -171,11 +173,7 @@ private extension NotificationsViewController {
171173 }
172174
173175 @IBAction func markAllAsRead( ) {
174- let unread = resultsController. fetchedObjects. filter { $0. read == false }
175- if unread. isEmpty {
176- DDLogVerbose ( " # Every single notification is already marked as Read! " )
177- return
178- }
176+ let unread = resultsController. fetchedObjects
179177
180178 markAsRead ( notes: unread)
181179 hapticGenerator. notificationOccurred ( . success)
@@ -191,13 +189,14 @@ private extension NotificationsViewController {
191189 ///
192190 func markAsRead( notes: [ Note ] ) {
193191 let identifiers = notes. map { $0. noteId }
194- let action = NotificationAction . updateMultipleReadStatus ( noteIds: identifiers, read: true ) { error in
192+ let action = NotificationAction . updateMultipleReadStatus ( noteIds: identifiers, read: nextStatus ) { error in
195193 if let error = error {
196194 DDLogError ( " ⛔️ Error marking notifications as read: \( error) " )
197195 }
198196 }
199197
200198 StoresManager . shared. dispatch ( action)
199+ nextStatus = !nextStatus
201200 }
202201
203202 /// Synchronizes the Notifications associated to the active WordPress.com account.
You can’t perform that action at this time.
0 commit comments