make HUDs block the UI

This commit is contained in:
Sami Samhuri 2015-05-25 21:59:47 -07:00
parent 04a763cd6e
commit 781903775b
2 changed files with 4 additions and 3 deletions

View file

@ -393,7 +393,8 @@ static NSString *const StateRestorationModifiedPostKey = @"modifiedPost";
}
- (IBAction)publishOrUnpublish:(id)sender {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
hud.dimBackground = YES;
BOOL isPublish = self.modifiedPost.draft;
hud.labelText = isPublish ? @"Publishing" : @"Unpublishing";
__weak typeof(self) welf = self;

View file

@ -305,10 +305,10 @@ static const NSUInteger SectionPublished = 1;
}
- (IBAction)publish:(id)sender {
// TODO: activity indicator
__weak typeof(self) welf = self;
void (^publish)(NSString *, PMKPromise *) = ^(NSString *message, PMKPromise *promise) {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
hud.dimBackground = YES;
hud.labelText = message;
typeof(self) self = welf;
promise.then(^{