diff --git a/External/Pearl b/External/Pearl index fa4f22d4..ed17f533 160000 --- a/External/Pearl +++ b/External/Pearl @@ -1 +1 @@ -Subproject commit fa4f22d4386d6ffec169b620c722cc7c89aa1715 +Subproject commit ed17f53324c5537d70cb08e25b07eb4def2eb9c5 diff --git a/External/UbiquityStoreManager b/External/UbiquityStoreManager index 59a0c1e8..4d23a792 160000 --- a/External/UbiquityStoreManager +++ b/External/UbiquityStoreManager @@ -1 +1 @@ -Subproject commit 59a0c1e8452ba1094fafdd1d8804a1edfe93347c +Subproject commit 4d23a792070c0895c7b2ab0e7ab6a74d4c3a2078 diff --git a/MasterPassword/ObjC/iOS/MPLogsViewController.h b/MasterPassword/ObjC/iOS/MPLogsViewController.h index 9755df73..025ed9e6 100644 --- a/MasterPassword/ObjC/iOS/MPLogsViewController.h +++ b/MasterPassword/ObjC/iOS/MPLogsViewController.h @@ -22,6 +22,7 @@ @interface MPLogsViewController : UIViewController @property (weak, nonatomic) IBOutlet UITextView *logView; @property (weak, nonatomic) IBOutlet UISegmentedControl *levelControl; +@property(nonatomic, strong) PearlAlert *switchCloudStoreProgress; - (IBAction)action:(id)sender; - (IBAction)toggleLevelControl:(UISegmentedControl *)sender; - (IBAction)refresh:(UIBarButtonItem *)sender; diff --git a/MasterPassword/ObjC/iOS/MPLogsViewController.m b/MasterPassword/ObjC/iOS/MPLogsViewController.m index 2e145661..a0504405 100644 --- a/MasterPassword/ObjC/iOS/MPLogsViewController.m +++ b/MasterPassword/ObjC/iOS/MPLogsViewController.m @@ -21,7 +21,11 @@ #import "MPAppDelegate_Store.h" #import "MPAppDelegate_Key.h" -@implementation MPLogsViewController +@implementation MPLogsViewController { + PearlAlert *switchCloudStoreProgress; +} + +@synthesize switchCloudStoreProgress; - (void)viewDidLoad { @@ -58,7 +62,10 @@ if (buttonIndex_ == alert.cancelButtonIndex) return; - [self switchCloudStore]; + switchCloudStoreProgress = [PearlAlert showActivityWithTitle:@"Enumerating Stores"]; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ + [self switchCloudStore]; + }); } cancelTitle:[PearlStrings get].commonButtonCancel otherTitles:[PearlStrings get].commonButtonContinue, nil]; } } cancelTitle:[PearlStrings get].commonButtonCancel @@ -80,22 +87,27 @@ if ([[NSFileManager defaultManager] fileExistsAtPath:content.path isDirectory:&directory] && directory) [contentNames addObject:[content lastPathComponent]]; - [PearlSheet showSheetWithTitle:[[MPiOSAppDelegate get].storeManager valueForKey:@"storeUUID_ThreadSafe"] - viewStyle:UIActionSheetStyleAutomatic - initSheet:^(UIActionSheet *sheet) { - for (NSString *contentName in contentNames) { - [sheet addButtonWithTitle:contentName]; - } - } - tappedButtonBlock:^(UIActionSheet *sheet, NSInteger buttonIndex) { - if (buttonIndex == sheet.cancelButtonIndex) - return; + NSString *storeUUID = [[MPiOSAppDelegate get].storeManager valueForKey:@"storeUUID_ThreadSafe"]; + dispatch_async(dispatch_get_main_queue(), ^{ + [switchCloudStoreProgress cancelAlertAnimated:YES]; - [[MPiOSAppDelegate get].storeManager setValue:[contentNames objectAtIndex:(unsigned)buttonIndex] forKey:@"storeUUID"]; - [[MPiOSAppDelegate get].storeManager reloadStore]; - [[MPiOSAppDelegate get] signOutAnimated:YES]; - } - cancelTitle:[PearlStrings get].commonButtonCancel destructiveTitle:nil otherTitles:nil]; + [PearlSheet showSheetWithTitle:storeUUID + viewStyle:UIActionSheetStyleAutomatic + initSheet:^(UIActionSheet *sheet) { + for (NSString *contentName in contentNames) { + [sheet addButtonWithTitle:contentName]; + } + } + tappedButtonBlock:^(UIActionSheet *sheet, NSInteger buttonIndex) { + if (buttonIndex == sheet.cancelButtonIndex) + return; + + [[MPiOSAppDelegate get].storeManager setValue:[contentNames objectAtIndex:(unsigned)buttonIndex] forKey:@"storeUUID"]; + [[MPiOSAppDelegate get].storeManager reloadStore]; + [[MPiOSAppDelegate get] signOutAnimated:YES]; + } + cancelTitle:[PearlStrings get].commonButtonCancel destructiveTitle:nil otherTitles:nil]; + }); } - (IBAction)toggleLevelControl:(UISegmentedControl *)sender { diff --git a/MasterPassword/ObjC/iOS/MPUnlockViewController.m b/MasterPassword/ObjC/iOS/MPUnlockViewController.m index 098b7995..9d4f924b 100644 --- a/MasterPassword/ObjC/iOS/MPUnlockViewController.m +++ b/MasterPassword/ObjC/iOS/MPUnlockViewController.m @@ -1006,38 +1006,35 @@ if ([self selectedUserForThread]) return; - [MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) { - MPUserEntity *targetedUser = [self userForAvatar:[self findTargetedAvatar] inContext:context]; - if (!targetedUser) + NSManagedObjectContext *context = [MPiOSAppDelegate managedObjectContextForMainThreadIfReady]; + MPUserEntity *targetedUser = [self userForAvatar:[self findTargetedAvatar] inContext:context]; + if (!targetedUser) + return; + + [PearlSheet showSheetWithTitle:targetedUser.name + viewStyle:UIActionSheetStyleBlackTranslucent + initSheet:nil tappedButtonBlock:^(UIActionSheet *sheet, NSInteger buttonIndex) { + if (buttonIndex == [sheet cancelButtonIndex]) return; - [PearlSheet showSheetWithTitle:targetedUser.name - viewStyle:UIActionSheetStyleBlackTranslucent - initSheet:nil tappedButtonBlock:^(UIActionSheet *sheet, NSInteger buttonIndex) { - if (buttonIndex == [sheet cancelButtonIndex]) - return; + if (buttonIndex == [sheet destructiveButtonIndex]) { + [context deleteObject:targetedUser]; + [context saveToStore]; - if (buttonIndex == [sheet destructiveButtonIndex]) { - [context performBlock:^{ - [context deleteObject:targetedUser]; - [context saveToStore]; + dispatch_async( dispatch_get_main_queue(), ^{ + [self updateUsers]; + } ); + return; + } - dispatch_async( dispatch_get_main_queue(), ^{ - [self updateUsers]; - } ); - }]; - return; - } - - if (buttonIndex == [sheet firstOtherButtonIndex]) - [[MPiOSAppDelegate get] changeMasterPasswordFor:targetedUser saveInContext:context didResetBlock:^{ - dispatch_async( dispatch_get_main_queue(), ^{ - [[self avatarForUser:targetedUser] setSelected:YES]; - } ); - }]; - } cancelTitle:[PearlStrings get].commonButtonCancel - destructiveTitle:@"Delete User" otherTitles:@"Reset Password", nil]; - }]; + if (buttonIndex == [sheet firstOtherButtonIndex]) + [[MPiOSAppDelegate get] changeMasterPasswordFor:targetedUser saveInContext:context didResetBlock:^{ + dispatch_async( dispatch_get_main_queue(), ^{ + [[self avatarForUser:targetedUser] setSelected:YES]; + } ); + }]; + } cancelTitle:[PearlStrings get].commonButtonCancel + destructiveTitle:@"Delete User" otherTitles:@"Reset Password", nil]; } - (IBAction)facebook:(UIButton *)sender {