2
0

Fix for fetchedResultsController getter, haslib() and ability to turn off libsodium.

This commit is contained in:
Maarten Billemont 2017-05-28 15:32:50 -04:00
parent d361ae2381
commit 2e2c654ec9
2 changed files with 11 additions and 11 deletions

View File

@ -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<NSMutableArray *> *)createPasswordCollectionSections {
- (NSMutableArray<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 {

View File

@ -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