From 2e2c654ec9701ee0b1ab857632d9ddee1f4d092a Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sun, 28 May 2017 15:32:50 -0400 Subject: [PATCH] Fix for fetchedResultsController getter, haslib() and ability to turn off libsodium. --- .../Source/iOS/MPSitesViewController.m | 17 ++++++++--------- platform-independent/cli-c/build | 5 +++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/platform-darwin/Source/iOS/MPSitesViewController.m b/platform-darwin/Source/iOS/MPSitesViewController.m index a36ffb60..b96ea167 100644 --- a/platform-darwin/Source/iOS/MPSitesViewController.m +++ b/platform-darwin/Source/iOS/MPSitesViewController.m @@ -206,7 +206,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) { if (controller == self.fetchedResultsController) PearlMainQueue( ^{ [self.collectionView updateDataSource:self.dataSource - toSections:[self createPasswordCollectionSections] + toSections:[self createDataSource] reloadItems:nil completion:nil]; } ); } @@ -283,7 +283,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) { }]; } -- (NSMutableArray *)createPasswordCollectionSections { +- (NSMutableArray *)createDataSource { NSString *query = self.query; BOOL needTransientItem = [query length] > 0; @@ -396,7 +396,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) { PearlMainQueue( ^{ [self.collectionView updateDataSource:self.dataSource - toSections:[self createPasswordCollectionSections] + toSections:[self createDataSource] reloadItems:@[ MPTransientPasswordItem ] completion:^(BOOL finished) { for (MPSiteCell *cell in self.collectionView.visibleCells) [cell setFuzzyGroups:self.fuzzyGroups]; @@ -420,22 +420,21 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) { - (NSFetchedResultsController *)fetchedResultsController { - if (!self.fetchedResultsController) { + if (!_fetchedResultsController) { [MPiOSAppDelegate managedObjectContextForMainThreadPerformBlockAndWait:^(NSManagedObjectContext *mainContext) { NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPSiteEntity class] )]; fetchRequest.sortDescriptors = @[ [[NSSortDescriptor alloc] initWithKey:NSStringFromSelector( @selector( lastUsed ) ) ascending:NO] ]; fetchRequest.fetchBatchSize = 10; - self.fetchedResultsController = - [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:mainContext - sectionNameKeyPath:nil cacheName:nil]; - self.fetchedResultsController.delegate = self; + (self.fetchedResultsController = [[NSFetchedResultsController alloc] + initWithFetchRequest:fetchRequest managedObjectContext:mainContext + sectionNameKeyPath:nil cacheName:nil]).delegate = self; }]; [self registerObservers]; } - return self.fetchedResultsController; + return _fetchedResultsController; } - (void)setActive:(BOOL)active { diff --git a/platform-independent/cli-c/build b/platform-independent/cli-c/build index 7469a07d..e59bc881 100755 --- a/platform-independent/cli-c/build +++ b/platform-independent/cli-c/build @@ -40,6 +40,7 @@ fi # Optional features. mpw_color=${mpw_color:-1} # Colorized Identicon, requires libncurses-dev. +mpw_sodium=${mpw_sodium:-1} # Use libsodium if available instead of cperciva's libscrypt. # Default build flags. export CFLAGS="-O3 $CFLAGS" @@ -213,7 +214,7 @@ depend() { popd } depend_scrypt() { - if haslib sodium; then + if (( mpw_sodium )) && haslib sodium; then if [[ $CFLAGS != *HAS_SODIUM=1* ]]; then CFLAGS+=" -DHAS_SODIUM=1" LDFLAGS+=" -lsodium" @@ -339,7 +340,7 @@ mpw-tests() { ### TARGETS haslib() { - return cc -l"$1" -x c -o /dev/null - <<< 'int main() { return 0; }' + cc -l"$1" -x c -o /dev/null - <<< 'int main() { return 0; }' } cc() { if hash llvm-gcc 2>/dev/null; then