2
0

Fixed some minor crash cases.

[FIXED]     Crash when changing iCloud store.
[FIXED]     Use main thread when holding down on a user.
This commit is contained in:
Maarten Billemont 2013-08-11 15:30:01 -04:00
parent d583bdfd3c
commit 17bb5706f8
5 changed files with 57 additions and 47 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit fa4f22d4386d6ffec169b620c722cc7c89aa1715 Subproject commit ed17f53324c5537d70cb08e25b07eb4def2eb9c5

@ -1 +1 @@
Subproject commit 59a0c1e8452ba1094fafdd1d8804a1edfe93347c Subproject commit 4d23a792070c0895c7b2ab0e7ab6a74d4c3a2078

View File

@ -22,6 +22,7 @@
@interface MPLogsViewController : UIViewController @interface MPLogsViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextView *logView; @property (weak, nonatomic) IBOutlet UITextView *logView;
@property (weak, nonatomic) IBOutlet UISegmentedControl *levelControl; @property (weak, nonatomic) IBOutlet UISegmentedControl *levelControl;
@property(nonatomic, strong) PearlAlert *switchCloudStoreProgress;
- (IBAction)action:(id)sender; - (IBAction)action:(id)sender;
- (IBAction)toggleLevelControl:(UISegmentedControl *)sender; - (IBAction)toggleLevelControl:(UISegmentedControl *)sender;
- (IBAction)refresh:(UIBarButtonItem *)sender; - (IBAction)refresh:(UIBarButtonItem *)sender;

View File

@ -21,7 +21,11 @@
#import "MPAppDelegate_Store.h" #import "MPAppDelegate_Store.h"
#import "MPAppDelegate_Key.h" #import "MPAppDelegate_Key.h"
@implementation MPLogsViewController @implementation MPLogsViewController {
PearlAlert *switchCloudStoreProgress;
}
@synthesize switchCloudStoreProgress;
- (void)viewDidLoad { - (void)viewDidLoad {
@ -58,7 +62,10 @@
if (buttonIndex_ == alert.cancelButtonIndex) if (buttonIndex_ == alert.cancelButtonIndex)
return; return;
switchCloudStoreProgress = [PearlAlert showActivityWithTitle:@"Enumerating Stores"];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
[self switchCloudStore]; [self switchCloudStore];
});
} cancelTitle:[PearlStrings get].commonButtonCancel otherTitles:[PearlStrings get].commonButtonContinue, nil]; } cancelTitle:[PearlStrings get].commonButtonCancel otherTitles:[PearlStrings get].commonButtonContinue, nil];
} }
} cancelTitle:[PearlStrings get].commonButtonCancel } cancelTitle:[PearlStrings get].commonButtonCancel
@ -80,7 +87,11 @@
if ([[NSFileManager defaultManager] fileExistsAtPath:content.path isDirectory:&directory] && directory) if ([[NSFileManager defaultManager] fileExistsAtPath:content.path isDirectory:&directory] && directory)
[contentNames addObject:[content lastPathComponent]]; [contentNames addObject:[content lastPathComponent]];
[PearlSheet showSheetWithTitle:[[MPiOSAppDelegate get].storeManager valueForKey:@"storeUUID_ThreadSafe"] NSString *storeUUID = [[MPiOSAppDelegate get].storeManager valueForKey:@"storeUUID_ThreadSafe"];
dispatch_async(dispatch_get_main_queue(), ^{
[switchCloudStoreProgress cancelAlertAnimated:YES];
[PearlSheet showSheetWithTitle:storeUUID
viewStyle:UIActionSheetStyleAutomatic viewStyle:UIActionSheetStyleAutomatic
initSheet:^(UIActionSheet *sheet) { initSheet:^(UIActionSheet *sheet) {
for (NSString *contentName in contentNames) { for (NSString *contentName in contentNames) {
@ -96,6 +107,7 @@
[[MPiOSAppDelegate get] signOutAnimated:YES]; [[MPiOSAppDelegate get] signOutAnimated:YES];
} }
cancelTitle:[PearlStrings get].commonButtonCancel destructiveTitle:nil otherTitles:nil]; cancelTitle:[PearlStrings get].commonButtonCancel destructiveTitle:nil otherTitles:nil];
});
} }
- (IBAction)toggleLevelControl:(UISegmentedControl *)sender { - (IBAction)toggleLevelControl:(UISegmentedControl *)sender {

View File

@ -1006,7 +1006,7 @@
if ([self selectedUserForThread]) if ([self selectedUserForThread])
return; return;
[MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) { NSManagedObjectContext *context = [MPiOSAppDelegate managedObjectContextForMainThreadIfReady];
MPUserEntity *targetedUser = [self userForAvatar:[self findTargetedAvatar] inContext:context]; MPUserEntity *targetedUser = [self userForAvatar:[self findTargetedAvatar] inContext:context];
if (!targetedUser) if (!targetedUser)
return; return;
@ -1018,14 +1018,12 @@
return; return;
if (buttonIndex == [sheet destructiveButtonIndex]) { if (buttonIndex == [sheet destructiveButtonIndex]) {
[context performBlock:^{
[context deleteObject:targetedUser]; [context deleteObject:targetedUser];
[context saveToStore]; [context saveToStore];
dispatch_async( dispatch_get_main_queue(), ^{ dispatch_async( dispatch_get_main_queue(), ^{
[self updateUsers]; [self updateUsers];
} ); } );
}];
return; return;
} }
@ -1037,7 +1035,6 @@
}]; }];
} cancelTitle:[PearlStrings get].commonButtonCancel } cancelTitle:[PearlStrings get].commonButtonCancel
destructiveTitle:@"Delete User" otherTitles:@"Reset Password", nil]; destructiveTitle:@"Delete User" otherTitles:@"Reset Password", nil];
}];
} }
- (IBAction)facebook:(UIButton *)sender { - (IBAction)facebook:(UIButton *)sender {