Skip to content

Commit

Permalink
Changed TIUbiquityMonitor back to doing a full scan of all cloud file…
Browse files Browse the repository at this point in the history
…s, because when using the more specialized predicate, it sometimes would not fire notifications (particularly if all URLs were up to date so there were 0 results).
  • Loading branch information
drewmccormack committed Feb 15, 2013
1 parent 4872c75 commit 30c6ab5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TICoreDataSync/06 External Sources/TIUbiquityMonitor.m
Expand Up @@ -49,7 +49,7 @@ - (id)initWithPredicate:(NSPredicate *)newPredicate


- (id)init - (id)init
{ {
NSPredicate *newPredicate = [NSPredicate predicateWithFormat:@"%K = FALSE OR %K = FALSE", NSMetadataUbiquitousItemIsDownloadedKey, NSMetadataUbiquitousItemIsUploadedKey]; NSPredicate *newPredicate = [NSPredicate predicateWithFormat:@"%K like '*'", NSMetadataItemFSNameKey];
return [self initWithPredicate:newPredicate]; return [self initWithPredicate:newPredicate];
} }


Expand Down Expand Up @@ -114,7 +114,7 @@ - (void)update:(NSNotification *)notif
NSNumber *uploaded = [metadataQuery valueOfAttribute:NSMetadataUbiquitousItemIsUploadedKey forResultAtIndex:i]; NSNumber *uploaded = [metadataQuery valueOfAttribute:NSMetadataUbiquitousItemIsUploadedKey forResultAtIndex:i];
NSNumber *fileSizeNumber = [metadataQuery valueOfAttribute:NSMetadataItemFSSizeKey forResultAtIndex:i]; NSNumber *fileSizeNumber = [metadataQuery valueOfAttribute:NSMetadataItemFSSizeKey forResultAtIndex:i];


unsigned long long fileSize = fileSizeNumber.unsignedLongLongValue; unsigned long long fileSize = fileSizeNumber ? fileSizeNumber.unsignedLongLongValue : 0;
if ( downloaded && !downloaded.boolValue ) { if ( downloaded && !downloaded.boolValue ) {
double percentage = percentDownloaded ? percentDownloaded.doubleValue : 0.0; double percentage = percentDownloaded ? percentDownloaded.doubleValue : 0.0;
long long fileDownloadSize = (1.0 - percentage / 100.0) * fileSize; long long fileDownloadSize = (1.0 - percentage / 100.0) * fileSize;
Expand Down

0 comments on commit 30c6ab5

Please sign in to comment.