17
My Heart Began To Sync A story about progress bars www.bipsync.com

My Heart Began To Sync: A Story About Progress Bars

Embed Size (px)

Citation preview

My Heart Began To SyncA story about progress bars

www.bipsync.com

MongoDB

Data API

Mobile API Web API

HTTPS

What do we need to sync?

Contexts Notes Tombstones

CategoriesContacts

FieldsProjects

PropertiesImages

NotesCategories

ContactsProjects

Device API

Note contexts

New notes

Updated notes

Deleted notes

New notes

Updated notes

Deleted notes

NSOperationQueue

NSOperation

AFHTTPRequestOperation

NoteDataSynchroniser : NSObject

@property NSOperationQueue *operationQueue

Queued Operations

PullNoteContextsOperation

PushNewNotesOperation

PushModifiedNotesOperation

PushDeletedNotesOperation

PullUnsyncedNotesOperation

PullDeletedEntitiesOperation

CompletionOperation

Background Context

Main Context

SQL StoreCore Data

Synchroniser

/v1/notes/1 /v1/search/tags

/v2/notes/1 /v2/search/tags

/v3/notes/1 /v3/search/tags

v1 v2 v3

Shared code

1.0.0 1.1.0 1.2.0 1.2.1 1.3.0 1.3.1

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {

if (![keyPath isEqualToString:@"isFinished"]) { return; }

NSOperation *operation = (NSOperation *)object;

float progressShare = [self progressShareForOperation:operation]; self.progress += progressShare; [self.delegate synchroniser:self didMakeProgress:self.progress];

}

Updating the UI

- (void)synchroniser:(NoteDataSynchroniser *)synchroniser didMakeProgress:(float)progress { NavigationController *navigationController = (NavigationController *)self.navigationController;

UIProgressView *progressView = navigationController.progressView; [progressView setProgress:progress animated:YES]; [self.tableView reloadData]; }

Updating the UI

@craigmarvelley

https://www.bipsync.com/blog/

http://www.neveroutofbeta.com

Thanks for listening :)