Fix for fetchedResultsController getter, haslib() and ability to turn off libsodium.
This commit is contained in:
parent
d361ae2381
commit
2e2c654ec9
@ -206,7 +206,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
|
|||||||
if (controller == self.fetchedResultsController)
|
if (controller == self.fetchedResultsController)
|
||||||
PearlMainQueue( ^{
|
PearlMainQueue( ^{
|
||||||
[self.collectionView updateDataSource:self.dataSource
|
[self.collectionView updateDataSource:self.dataSource
|
||||||
toSections:[self createPasswordCollectionSections]
|
toSections:[self createDataSource]
|
||||||
reloadItems:nil completion:nil];
|
reloadItems:nil completion:nil];
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
@ -283,7 +283,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMutableArray<NSMutableArray *> *)createPasswordCollectionSections {
|
- (NSMutableArray<NSMutableArray *> *)createDataSource {
|
||||||
|
|
||||||
NSString *query = self.query;
|
NSString *query = self.query;
|
||||||
BOOL needTransientItem = [query length] > 0;
|
BOOL needTransientItem = [query length] > 0;
|
||||||
@ -396,7 +396,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
|
|||||||
|
|
||||||
PearlMainQueue( ^{
|
PearlMainQueue( ^{
|
||||||
[self.collectionView updateDataSource:self.dataSource
|
[self.collectionView updateDataSource:self.dataSource
|
||||||
toSections:[self createPasswordCollectionSections]
|
toSections:[self createDataSource]
|
||||||
reloadItems:@[ MPTransientPasswordItem ] completion:^(BOOL finished) {
|
reloadItems:@[ MPTransientPasswordItem ] completion:^(BOOL finished) {
|
||||||
for (MPSiteCell *cell in self.collectionView.visibleCells)
|
for (MPSiteCell *cell in self.collectionView.visibleCells)
|
||||||
[cell setFuzzyGroups:self.fuzzyGroups];
|
[cell setFuzzyGroups:self.fuzzyGroups];
|
||||||
@ -420,22 +420,21 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
|
|||||||
|
|
||||||
- (NSFetchedResultsController *)fetchedResultsController {
|
- (NSFetchedResultsController *)fetchedResultsController {
|
||||||
|
|
||||||
if (!self.fetchedResultsController) {
|
if (!_fetchedResultsController) {
|
||||||
[MPiOSAppDelegate managedObjectContextForMainThreadPerformBlockAndWait:^(NSManagedObjectContext *mainContext) {
|
[MPiOSAppDelegate managedObjectContextForMainThreadPerformBlockAndWait:^(NSManagedObjectContext *mainContext) {
|
||||||
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPSiteEntity class] )];
|
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPSiteEntity class] )];
|
||||||
fetchRequest.sortDescriptors = @[
|
fetchRequest.sortDescriptors = @[
|
||||||
[[NSSortDescriptor alloc] initWithKey:NSStringFromSelector( @selector( lastUsed ) ) ascending:NO]
|
[[NSSortDescriptor alloc] initWithKey:NSStringFromSelector( @selector( lastUsed ) ) ascending:NO]
|
||||||
];
|
];
|
||||||
fetchRequest.fetchBatchSize = 10;
|
fetchRequest.fetchBatchSize = 10;
|
||||||
self.fetchedResultsController =
|
(self.fetchedResultsController = [[NSFetchedResultsController alloc]
|
||||||
[[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:mainContext
|
initWithFetchRequest:fetchRequest managedObjectContext:mainContext
|
||||||
sectionNameKeyPath:nil cacheName:nil];
|
sectionNameKeyPath:nil cacheName:nil]).delegate = self;
|
||||||
self.fetchedResultsController.delegate = self;
|
|
||||||
}];
|
}];
|
||||||
[self registerObservers];
|
[self registerObservers];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.fetchedResultsController;
|
return _fetchedResultsController;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setActive:(BOOL)active {
|
- (void)setActive:(BOOL)active {
|
||||||
|
@ -40,6 +40,7 @@ fi
|
|||||||
|
|
||||||
# Optional features.
|
# Optional features.
|
||||||
mpw_color=${mpw_color:-1} # Colorized Identicon, requires libncurses-dev.
|
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.
|
# Default build flags.
|
||||||
export CFLAGS="-O3 $CFLAGS"
|
export CFLAGS="-O3 $CFLAGS"
|
||||||
@ -213,7 +214,7 @@ depend() {
|
|||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
depend_scrypt() {
|
depend_scrypt() {
|
||||||
if haslib sodium; then
|
if (( mpw_sodium )) && haslib sodium; then
|
||||||
if [[ $CFLAGS != *HAS_SODIUM=1* ]]; then
|
if [[ $CFLAGS != *HAS_SODIUM=1* ]]; then
|
||||||
CFLAGS+=" -DHAS_SODIUM=1"
|
CFLAGS+=" -DHAS_SODIUM=1"
|
||||||
LDFLAGS+=" -lsodium"
|
LDFLAGS+=" -lsodium"
|
||||||
@ -339,7 +340,7 @@ mpw-tests() {
|
|||||||
### TARGETS
|
### TARGETS
|
||||||
|
|
||||||
haslib() {
|
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() {
|
cc() {
|
||||||
if hash llvm-gcc 2>/dev/null; then
|
if hash llvm-gcc 2>/dev/null; then
|
||||||
|
Loading…
Reference in New Issue
Block a user