Skip to content

Commit

Permalink
Skip sync if we have error
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Jun 14, 2019
1 parent 1311595 commit 31a0708
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Settings/Network/BKiCloudSyncHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,24 @@ - (void)syncFromiCloud
CKDatabase *database = [[CKContainer containerWithIdentifier:BKiCloudContainerIdentifier] privateCloudDatabase];
CKQuery *hostQuery = [[CKQuery alloc] initWithRecordType:@"BKHost" predicate:[NSPredicate predicateWithValue:YES]];
[database performQuery:hostQuery
inZoneWithID:nil
inZoneWithID:nil
completionHandler:^(NSArray<CKRecord *> *_Nullable results, NSError *_Nullable error) {
[self mergeHosts:results];
if (error) {
NSLog(@"Error fetching hosts from icloud: %@", error);
return;
}
[self mergeHosts:results];
}];

if ([BKUserConfigurationManager userSettingsValueForKey:BKUserConfigiCloudKeys]) {
CKQuery *pubKeyQuery = [[CKQuery alloc] initWithRecordType:@"BKPubKey" predicate:[NSPredicate predicateWithValue:YES]];
[database performQuery:pubKeyQuery
inZoneWithID:nil
completionHandler:^(NSArray<CKRecord *> *_Nullable results, NSError *_Nullable error) {
inZoneWithID:nil
completionHandler:^(NSArray<CKRecord *> *_Nullable results, NSError *_Nullable error) {
if (error) {
NSLog(@"Error fetching pubkeys from icloud: %@", error);
return;
}
[self mergeKeys:results];
}];
}
Expand Down

0 comments on commit 31a0708

Please sign in to comment.