mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Use UIAlertController when available
This commit is contained in:
@@ -291,12 +291,33 @@
|
||||
if(succeeded) {
|
||||
//controller should dismiss us shortly..
|
||||
} else {
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil
|
||||
message:error.localizedDescription
|
||||
delegate:nil
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"OK")
|
||||
otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
|
||||
// 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
|
||||
message:error.localizedDescription
|
||||
delegate:nil
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"OK")
|
||||
otherButtonTitles:nil];
|
||||
[alertView show];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
typeof(self) strongSelf = weakSelf;
|
||||
[strongSelf setLoginUIEnabled:YES];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user