Run UI code in authenticator completions on main queue

This commit is contained in:
Lukas Spieß
2015-10-01 15:00:37 +02:00
parent c5205e8b18
commit 5e1b3a3ef9
2 changed files with 86 additions and 77 deletions

View File

@@ -93,7 +93,7 @@
[self updateBarButtons];
[self updateWebLoginButton];
}
}
}
}
- (void) updateWebLoginButton {
@@ -279,7 +279,7 @@
[self saveAction:nil];
}
}
return NO;
return NO;
}
#pragma mark - Actions
@@ -294,24 +294,26 @@
if(succeeded) {
//controller should dismiss us shortly..
} else {
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
// requires iOS 8
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
if (uialertcontrollerClass) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
message:error.localizedDescription
preferredStyle:UIAlertControllerStyleAlert];
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {}];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
} else {
*/
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
// requires iOS 8
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
if (uialertcontrollerClass) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
message:error.localizedDescription
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {}];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
} else {
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
@@ -321,9 +323,10 @@
otherButtonTitles:nil];
[alertView show];
#pragma clang diagnostic pop
/*}*/
typeof(self) strongSelf = weakSelf;
[strongSelf setLoginUIEnabled:YES];
/*}*/
typeof(self) strongSelf = weakSelf;
[strongSelf setLoginUIEnabled:YES];
});
}
}];
}