Upload
craig-marvelley
View
26
Download
2
Embed Size (px)
Citation preview
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
NoteDataSynchroniser : NSObject
@property NSOperationQueue *operationQueue
Queued Operations
PullNoteContextsOperation
PushNewNotesOperation
PushModifiedNotesOperation
PushDeletedNotesOperation
PullUnsyncedNotesOperation
PullDeletedEntitiesOperation
CompletionOperation
/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 :)