> On Jan 21, 2016, at 2:23 PM, Brendan Duddridge <
bren...@gmail.com> wrote:
>
> But I've got a question about statuses. When I make a change and the push replicator gets called, I'm also noticing that the pull replicator is also getting called and the status is coming into the notification with a value of kCBLReplicationIdle.
What exactly do you mean by “getting called” here?
There’s always a bit of feedback when doing a push — when the server adds the pushed documents, its changes feed will wake up and send the client a notification of those documents. The client just sees that it already has those docs/revisions, so it doesn’t download them. But that may cause the puller to change its status from Idle to Busy for an instant.
> The reason this is a problem for me right now is because when I receive a pull from the replicator, I refresh the screen to display the new data.
Generally you shouldn’t use replication notifications to drive refresh of the UI. Instead, use database/document change notifications.
For example, if you’re displaying data from a document on the current screen, register a CBLDocumentChangeNotification on that document while it’s visible, and update your display when notified. This is a general “reactive” programming practice that ensures your UI is up to date with the data, no matter how the data got changed.
—Jens