Monitoring Syncing Between Couchbase Lite & Couchbase Server

55 views
Skip to first unread message

Steve

unread,
Oct 17, 2014, 8:13:17 PM10/17/14
to mobile-c...@googlegroups.com
What's best practise for properly monitoring the syncing between an app's Couchbase Lite database and a remote Couchbase Server?

In each of my app's views (i.e. in each view controller) I plan to add an observer to NSNotificationCenter. Each observer would monitor sync progress, check for sync errors and alert the user if need be (without bombarding them with error messages). Is this a reasonable approach?

Is there a way to avoid having to do this for each view controller?

Jens Alfke

unread,
Oct 18, 2014, 1:30:45 AM10/18/14
to mobile-c...@googlegroups.com

On Oct 17, 2014, at 5:13 PM, Steve <s.ande...@gmail.com> wrote:

In each of my app's views (i.e. in each view controller) I plan to add an observer to NSNotificationCenter. Each observer would monitor sync progress, check for sync errors and alert the user if need be (without bombarding them with error messages). Is this a reasonable approach?

This is more of an app-design question … you might take a look at the way ToDoLite does it. There's a SyncManager that monitors sync state, and a nav-bar button item that indicates status. (Actually the status indication might not be implemented yet. But it wouldn't be hard to do.)

But putting a separate observer in every view seems like the wrong way to go about it (violating the DRY principle.) Instead put the code someplace that's global to the entire app.

—Jens
Reply all
Reply to author
Forward
0 new messages