2
0

Move a few batches of UI work into the main thread.

This commit is contained in:
Maarten Billemont 2016-07-21 09:59:37 -04:00
parent fa588f8fe2
commit 1977a423a5

View File

@ -91,6 +91,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
[MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) { [MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
MPUserEntity *activeUser = [[MPiOSAppDelegate get] activeUserInContext:context]; MPUserEntity *activeUser = [[MPiOSAppDelegate get] activeUserInContext:context];
if (![MPAlgorithmDefault tryMigrateUser:activeUser inContext:context]) if (![MPAlgorithmDefault tryMigrateUser:activeUser inContext:context])
PearlMainQueue(^{
[self performSegueWithIdentifier:@"message" sender: [self performSegueWithIdentifier:@"message" sender:
[MPMessage messageWithTitle:@"You have sites that can be upgraded." text: [MPMessage messageWithTitle:@"You have sites that can be upgraded." text:
@"Upgrading a site allows it to take advantage of the latest improvements in the Master Password algorithm.\n\n" @"Upgrading a site allows it to take advantage of the latest improvements in the Master Password algorithm.\n\n"
@ -98,6 +99,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
"You can then update your site's account with the new and stronger password.\n\n" "You can then update your site's account with the new and stronger password.\n\n"
"The upgrade button can be found in the site's settings and looks like this:" "The upgrade button can be found in the site's settings and looks like this:"
info:YES]]; info:YES]];
});
[context saveToStore]; [context saveToStore];
}]; }];
} }
@ -417,6 +419,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
if (![self.fetchedResultsController performFetch:&error]) if (![self.fetchedResultsController performFetch:&error])
err( @"Couldn't fetch sites: %@", [error fullDescription] ); err( @"Couldn't fetch sites: %@", [error fullDescription] );
PearlMainQueue(^{
@try { @try {
[self.passwordCollectionView performBatchUpdates:^{ [self.passwordCollectionView performBatchUpdates:^{
[self fetchedItemsDidUpdate]; [self fetchedItemsDidUpdate];
@ -447,6 +450,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
wrn( @"While updating password cells: %@", [exception fullDescription] ); wrn( @"While updating password cells: %@", [exception fullDescription] );
[self.passwordCollectionView reloadData]; [self.passwordCollectionView reloadData];
} }
});
}]; }];
} }