Skip to content

Conversation

@bummytime
Copy link
Contributor

Another NotificationStore & NotificationAction PR that wraps the Notifications "update read status" logic in Yosemite (including unit tests).

Note that leaving the derived MOC hanging around in the static NotificationStore var was causing unit tests to randomly fail (and it makes me wonder if would also cause unforeseen issues within the app itself). So to remedy this, I added a NotificationStore.resetSharedDerivedStorage() func that will nil it out in-between tests as well as in the final closure on NotificationStore.synchronizeNotifications().

Partially address #19

Testing

Make sure the logic is sound and the unit tests all pass!

@jleandroperez would you mind checking out this?

@bummytime bummytime added the feature: notifications Related to notifications or notifs. label Nov 5, 2018
@bummytime bummytime added this to the 0.11 milestone Nov 5, 2018
@bummytime bummytime self-assigned this Nov 5, 2018
@astralbodies astralbodies mentioned this pull request Nov 5, 2018
39 tasks
onCompletion(nil)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nipticky: I forgot to mention something!!! (about that!!!)

In WPiOS we do a bit of a special treatment here. The scenario that prompted this was (afaik somehow) like this:

  1. Slow connection
  2. Notifications list gets onscreen
  3. User pushes the Details for "Notification A"
  4. Back to the Notes List
  5. [Time Elapsed]
  6. "Mark as Read" result comes back

At that point you'd see, out of the blue, the notification getting marked as read. What we do, to attempt to improve the UX, is to optimistically update the Stored Notification.

That way, when you hit (4), the note is "marked as read" locally.

If the remote call fails, we simply invalidate the cache (just set an invalid Note.hash value). This way, next time we sync, the "Optimistic OP" would be reverted.

Sample code here

No need to patch this here, right now, we can get back to it down the road, if needed.
Just wanted to mention it, because it's one of those... tiny annoyances i've dealt with 😄

Copy link
Contributor Author

@bummytime bummytime Nov 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jleandroperez I created #406 to capture that ☝️

… issue/19-notifications-read

* 'develop' of github.com:woocommerce/woocommerce-ios:
  Updates Project
  Adding DataModel Mark 6
@bummytime bummytime merged commit a77de55 into develop Nov 6, 2018
@bummytime bummytime deleted the issue/19-notifications-read branch November 6, 2018 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: notifications Related to notifications or notifs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants