Skip to content

Commit

Permalink
Fixed issue with change broadcasting
Browse files Browse the repository at this point in the history
  • Loading branch information
mzarra committed Dec 31, 2009
1 parent f972613 commit dce1457
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
8 changes: 1 addition & 7 deletions DeviceCode/ZSyncTouchHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,10 @@
- (void)zSyncStarted:(ZSyncTouchHandler*)handler;

/* This is an information message to indicate that a sync has finished.
* No action should be needed here as Core Data should auto update
* The application should at this point refresh all displays from the NSManagedObjectContext
*/
- (void)zSyncFinished:(ZSyncTouchHandler*)handler;

/* ZSync has started the transfer of data to the server to be synced. This is
* an information message only so that the app can update the user on the
* status of the sync.
*/
- (void)zSyncFileUploaded:(ZSyncTouchHandler*)handler;

/* Notification that the server has accepted the device and is awaiting
* a pairing code to be sent back. The pairing code will be displayed
* on the server.
Expand Down
7 changes: 2 additions & 5 deletions SampleTouch/Classes/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,8 @@ - (void)zSyncFinished:(ZSyncTouchHandler*)handler;
{
DLog(@"%s entered", __PRETTY_FUNCTION__);
[self hideHoverView];
}

- (void)zSyncFileUploaded:(ZSyncTouchHandler*)handler;
{
DLog(@"%s entered", __PRETTY_FUNCTION__);

[[NSNotificationCenter defaultCenter] postNotificationName:kRefreshMOC object:self];
}

- (void)zSyncPairingRequestAccepted:(ZSyncTouchHandler*)handler;
Expand Down
9 changes: 9 additions & 0 deletions SampleTouch/Classes/RootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ @implementation RootViewController

@synthesize fetchedResultsController, managedObjectContext;

- (void)refresh:(id)sender
{
NSError *error = nil;
[[self fetchedResultsController] performFetch:&error];
ZAssert(error == nil, @"Error fetching: %@", [error localizedDescription]);
}

#pragma mark -
#pragma mark View lifecycle

Expand All @@ -54,6 +61,8 @@ - (void)viewDidLoad

NSError *error = nil;
ZAssert([[self fetchedResultsController] performFetch:&error],@"Error fetching: %@", [error localizedDescription]);

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refresh:) name:kRefreshMOC object:nil];
}

- (void)sync
Expand Down
5 changes: 3 additions & 2 deletions SampleTouch/Prefix.pch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef DEBUG
#define DLog(...) NSLog(__VA_ARGS__)
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#define ALog(...) {NSLog(__VA_ARGS__);[[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__];}
#else
#define DLog(...) do { } while (0)
#define NS_BLOCK_ASSERTIONS
Expand All @@ -22,4 +22,5 @@
#import <QuartzCore/QuartzCore.h>
#endif

#define kCellIdentifier @"kCellIdentifier"
#define kCellIdentifier @"kCellIdentifier"
#define kRefreshMOC @"kRefreshMOC"

0 comments on commit dce1457

Please sign in to comment.