End of migration from UiAlertView to UiAlertController

This commit is contained in:
REIS Benjamin 2016-10-04 15:19:24 +02:00
parent a4bcdd595f
commit 72ed48d013
9 changed files with 246 additions and 187 deletions

View file

@ -634,16 +634,23 @@ static UICompositeViewDescription *compositeDescription = nil;
}
case LinphoneRegistrationFailed: {
_waitView.hidden = true;
DTAlertView *alert = [[DTAlertView alloc] initWithTitle:NSLocalizedString(@"Registration failure", nil)
message:message
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alert addButtonWithTitle:@"Continue"
block:^(void) {
[PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Registration failure", nil)
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Continue", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}];
[errView addAction:defaultAction];
[errView addAction:continueAction];
[self presentViewController:errView animated:YES completion:nil];
break;
}
case LinphoneRegistrationProgress: {
@ -851,19 +858,24 @@ void assistant_is_account_activated(LinphoneAccountCreator *creator, LinphoneAcc
if (status == LinphoneAccountCreatorAccountActivated) {
[thiz configureProxyConfig];
} else if (status == LinphoneAccountCreatorAccountNotActivated) {
DTAlertView *alert = [[DTAlertView alloc]
initWithTitle:NSLocalizedString(@"Account validation failed", nil)
message:
NSLocalizedString(
@"Your account could not be checked yet. You can skip this validation or try again later.",
nil)];
[alert addCancelButtonWithTitle:NSLocalizedString(@"Back", nil) block:nil];
[alert addButtonWithTitle:NSLocalizedString(@"Skip verification", nil)
block:^{
[thiz configureProxyConfig];
[PhoneMainView.instance popToView:thiz.outgoingView];
}];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Account validation failed", nil)
message:NSLocalizedString(@"Your account could not be checked yet. You can skip this validation or try again later.", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Back", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Skip verification", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[thiz configureProxyConfig];
[PhoneMainView.instance popToView:thiz.outgoingView];
}];
[errView addAction:defaultAction];
[errView addAction:continueAction];
[thiz presentViewController:errView animated:YES completion:nil];
} else {
[thiz showErrorPopup:resp];
}

View file

@ -252,61 +252,69 @@ static UICompositeViewDescription *compositeDescription = nil;
LinphoneManager *mgr = LinphoneManager.instance;
NSString *debugAddress = [mgr lpConfigStringForKey:@"debug_popup_magic" withDefault:@""];
if (![debugAddress isEqualToString:@""] && [address isEqualToString:debugAddress]) {
DTAlertView *alertView = [[DTAlertView alloc] initWithTitle:NSLocalizedString(@"Debug", nil)
message:NSLocalizedString(@"Choose an action", nil)];
[alertView addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Debug", nil)
message:NSLocalizedString(@"Choose an action", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
int debugLevel = [LinphoneManager.instance lpConfigIntForKey:@"debugenable_preference"];
BOOL debugEnabled = (debugLevel >= ORTP_DEBUG && debugLevel < ORTP_ERROR);
if (debugEnabled) {
[alertView
addButtonWithTitle:NSLocalizedString(@"Send logs", nil)
block:^{
NSString *appName =
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
NSString *logsAddress = [mgr lpConfigStringForKey:@"debug_popup_email" withDefault:@""];
[self presentMailViewWithTitle:appName forRecipients:@[ logsAddress ] attachLogs:true];
}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Send logs", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
NSString *appName =
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
NSString *logsAddress = [mgr lpConfigStringForKey:@"debug_popup_email" withDefault:@""];
[self presentMailViewWithTitle:appName forRecipients:@[ logsAddress ] attachLogs:true];
}];
[errView addAction:continueAction];
}
NSString *actionLog =
(debugEnabled ? NSLocalizedString(@"Disable logs", nil) : NSLocalizedString(@"Enable logs", nil));
[alertView
addButtonWithTitle:actionLog
block:^{
int newDebugLevel = debugEnabled ? 0 : ORTP_DEBUG;
[LinphoneManager.instance lpConfigSetInt:newDebugLevel forKey:@"debugenable_preference"];
[Log enableLogs:newDebugLevel];
}];
[alertView
addButtonWithTitle:NSLocalizedString(@"Remove account(s) and self destruct", nil)
block:^{
linphone_core_clear_proxy_config([LinphoneManager getLc]);
linphone_core_clear_all_auth_info([LinphoneManager getLc]);
@try {
[LinphoneManager.instance destroyLinphoneCore];
} @catch (NSException *e) {
LOGW(@"Exception while destroying linphone core: %@", e);
} @finally {
if ([NSFileManager.defaultManager
isDeletableFileAtPath:[LinphoneManager documentFile:@"linphonerc"]] == YES) {
[NSFileManager.defaultManager
removeItemAtPath:[LinphoneManager documentFile:@"linphonerc"]
error:nil];
}
UIAlertAction* logAction = [UIAlertAction actionWithTitle:actionLog
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
int newDebugLevel = debugEnabled ? 0 : ORTP_DEBUG;
[LinphoneManager.instance lpConfigSetInt:newDebugLevel forKey:@"debugenable_preference"];
[Log enableLogs:newDebugLevel];
}];
[errView addAction:logAction];
UIAlertAction* remAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Remove account(s) and self destruct", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
linphone_core_clear_proxy_config([LinphoneManager getLc]);
linphone_core_clear_all_auth_info([LinphoneManager getLc]);
@try {
[LinphoneManager.instance destroyLinphoneCore];
} @catch (NSException *e) {
LOGW(@"Exception while destroying linphone core: %@", e);
} @finally {
if ([NSFileManager.defaultManager
isDeletableFileAtPath:[LinphoneManager documentFile:@"linphonerc"]] == YES) {
[NSFileManager.defaultManager
removeItemAtPath:[LinphoneManager documentFile:@"linphonerc"]
error:nil];
}
#ifdef DEBUG
[LinphoneManager instanceRelease];
[LinphoneManager instanceRelease];
#endif
}
[UIApplication sharedApplication].keyWindow.rootViewController = nil;
// make the application crash to be sure that user restart it properly
LOGF(@"Self-destructing in 3..2..1..0!");
}];
[alertView show];
}
[UIApplication sharedApplication].keyWindow.rootViewController = nil;
// make the application crash to be sure that user restart it properly
LOGF(@"Self-destructing in 3..2..1..0!");
}];
[errView addAction:remAction];
[self presentViewController:errView animated:YES completion:nil];
return true;
}
return false;

View file

@ -181,16 +181,16 @@ static UICompositeViewDescription *compositeDescription = nil;
switch (state) {
case LinphoneConfiguringFailed: {
[_waitView setHidden:true];
DTAlertView *alertView = [[DTAlertView alloc]
initWithTitle:NSLocalizedString(@"Configuration failed", nil)
message:
NSLocalizedString(
@"Cannot retrieve your configuration. Please check credentials or try again later",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alertView show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Configuration failed", nil)
message:NSLocalizedString(@"Cannot retrieve your configuration. Please check credentiels or try again later", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
linphone_core_set_provisioning_uri([LinphoneManager getLc], NULL);
break;
}

View file

@ -34,7 +34,7 @@
- (void)processRemoteNotification:(NSDictionary*)userInfo;
- (void)registerForNotifications:(UIApplication *)app;
@property (nonatomic, retain) UIAlertView *waitingIndicator;
@property (nonatomic, retain) UIAlertController *waitingIndicator;
@property (nonatomic, retain) NSString *configURL;
@property (nonatomic, strong) UIWindow* window;
@property PKPushRegistry* voipRegistry;

View file

@ -311,14 +311,25 @@
NSString *encodedURL =
[[url absoluteString] stringByReplacingOccurrencesOfString:@"linphone-config://" withString:@""];
self.configURL = [encodedURL stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
UIAlertView *confirmation = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Remote configuration", nil)
message:NSLocalizedString(@"This operation will load a remote configuration. Continue ?", nil)
delegate:self
cancelButtonTitle:NSLocalizedString(@"No", nil)
otherButtonTitles:NSLocalizedString(@"Yes", nil), nil];
confirmation.tag = 1;
[confirmation show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Remote configuration", nil)
message:NSLocalizedString(@"This operation will load a remote configuration. Continue ?", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"No", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
UIAlertAction* yesAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Yes", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self showWaitingIndicator];
[self attemptRemoteConfiguration];
}];
[errView addAction:defaultAction];
[errView addAction:yesAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
} else {
if ([[url scheme] isEqualToString:@"sip"]) {
// remove "sip://" from the URI, and do it correctly by taking resourceSpecifier and removing leading and
@ -680,7 +691,7 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
LinphoneConfiguringState state = [[notif.userInfo objectForKey:@"state"] intValue];
if (state == LinphoneConfiguringSuccessful) {
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[_waitingIndicator dismissWithClickedButtonIndex:0 animated:true];
[_waitingIndicator dismissViewControllerAnimated:YES completion:nil];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Success", nil)
message:NSLocalizedString(@"Remote configuration successfully fetched and applied.", nil)
preferredStyle:UIAlertControllerStyleAlert];
@ -696,7 +707,7 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
}
if (state == LinphoneConfiguringFailed) {
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[_waitingIndicator dismissWithClickedButtonIndex:0 animated:true];
[_waitingIndicator dismissViewControllerAnimated:YES completion:nil];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Failure", nil)
message:NSLocalizedString(@"Failed configuring from the specified URL.", nil)
preferredStyle:UIAlertControllerStyleAlert];
@ -711,28 +722,18 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
}
- (void)showWaitingIndicator {
_waitingIndicator = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Fetching remote configuration...", nil)
message:@""
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil];
_waitingIndicator = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Fetching remote configuration...", nil)
message:@""
preferredStyle:UIAlertControllerStyleAlert];
UIActivityIndicatorView *progress = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 60, 30, 30)];
progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
[_waitingIndicator setValue:progress forKey:@"accessoryView"];
[progress setColor:[UIColor blackColor]];
} else {
[_waitingIndicator addSubview:progress];
}
[_waitingIndicator setValue:progress forKey:@"accessoryView"];
[progress setColor:[UIColor blackColor]];
[progress startAnimating];
[_waitingIndicator show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if ((alertView.tag == 1) && (buttonIndex == 1)) {
[self showWaitingIndicator];
[self attemptRemoteConfiguration];
}
[PhoneMainView.instance presentViewController:_waitingIndicator animated:YES completion:nil];
}
- (void)attemptRemoteConfiguration {

View file

@ -42,7 +42,6 @@
#import <AVFoundation/AVAudioPlayer.h>
#import "Utils.h"
#import "Utils/DTFoundation/DTAlertView.h"
#import "PhoneMainView.h"
#import <UserNotifications/UserNotifications.h>
@ -1047,11 +1046,11 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
const char *domainC) {
// let the wizard handle its own errors
if ([PhoneMainView.instance currentView] != AssistantView.compositeViewDescription) {
static DTAlertView *alertView = nil;
static UIAlertController *alertView = nil;
// avoid having multiple popups
if ([alertView isVisible]) {
[alertView dismissWithClickedButtonIndex:0 animated:NO];
if ([alertView isBeingPresented]) {
[alertView dismissViewControllerAnimated:YES completion:nil];
}
// dont pop up if we are in background, in any case we will refresh registers when entering
@ -1063,34 +1062,45 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
NSString *realm = [NSString stringWithUTF8String:realmC];
NSString *username = [NSString stringWithUTF8String:usernameC];
NSString *domain = [NSString stringWithUTF8String:domainC];
alertView = [[DTAlertView alloc]
initWithTitle:NSLocalizedString(@"Authentication needed.", nil)
message:[NSString
stringWithFormat:NSLocalizedString(@"Registration failed because authentication is "
@"missing or invalid for %@@%@.\nYou can "
@"provide password again, or check your "
@"account configuration in the settings.",
nil),
username, realm]
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
[alertView addButtonWithTitle:NSLocalizedString(@"Confirm password", nil)
block:^{
NSString *password = [alertView textFieldAtIndex:0].text;
LinphoneAuthInfo *info =
linphone_auth_info_new(username.UTF8String, NULL, password.UTF8String, NULL,
realm.UTF8String, domain.UTF8String);
linphone_core_add_auth_info(LC, info);
[LinphoneManager.instance refreshRegisters];
}];
[alertView addButtonWithTitle:NSLocalizedString(@"Go to settings", nil)
block:^{
[PhoneMainView.instance changeCurrentView:SettingsView.compositeViewDescription];
}];
[alertView show];
alertView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Authentification needed", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"Registration failed because authentication is "
@"missing or invalid for %@@%@.\nYou can "
@"provide password again, or check your "
@"account configuration in the settings.", nil), username, realm]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"Password";
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.secureTextEntry = YES;
}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Confirm password", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
NSString *password = alertView.textFields[0].text;
LinphoneAuthInfo *info =
linphone_auth_info_new(username.UTF8String, NULL, password.UTF8String, NULL,
realm.UTF8String, domain.UTF8String);
linphone_core_add_auth_info(LC, info);
[LinphoneManager.instance refreshRegisters];
}];
UIAlertAction* settingsAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Go to settings", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[PhoneMainView.instance changeCurrentView:SettingsView.compositeViewDescription];
}];
[alertView addAction:defaultAction];
[alertView addAction:continueAction];
[alertView addAction:settingsAction];
[PhoneMainView.instance presentViewController:alertView animated:YES completion:nil];
}
}
@ -1712,22 +1722,24 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
} else {
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
if (cfg) {
DTAlertView *alert = [[DTAlertView alloc]
initWithTitle:NSLocalizedString(@"Link your account", nil)
message:[NSString
stringWithFormat:NSLocalizedString(
@"Link your Linphone.org account %s to your phone number.",
nil),
linphone_address_get_username(
linphone_proxy_config_get_identity_address(cfg))]
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:NSLocalizedString(@"Maybe later", nil), nil];
[alert addButtonWithTitle:NSLocalizedString(@"Let's go", nil)
block:^(void) {
[PhoneMainView.instance changeCurrentView:AssistantLinkView.compositeViewDescription];
}];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Link your account", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"Link your Linphone.org account %s to your phone number.", nil),
linphone_address_get_username(linphone_proxy_config_get_identity_address(cfg))]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Maybe later", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Let's go", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[PhoneMainView.instance changeCurrentView:AssistantLinkView.compositeViewDescription];
}];
[errView addAction:defaultAction];
[errView addAction:continueAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
[LinphoneManager.instance
lpConfigSetInt:[[NSDate date] dateByAddingTimeInterval:[LinphoneManager.instance

View file

@ -37,7 +37,6 @@
#import "ContactsListView.h"
#import "CountryListView.h"
#import "DTActionSheet.h"
#import "DTAlertView.h"
#import "DialerView.h"
#import "FirstLoginView.h"
#import "HistoryDetailsView.h"

View file

@ -703,18 +703,25 @@ static UICompositeViewDescription *compositeDescription = nil;
[PhoneMainView.instance changeCurrentView:AssistantView.compositeViewDescription];
return;
} else if ([key isEqual:@"account_mandatory_remove_button"]) {
DTAlertView *alert = [[DTAlertView alloc]
initWithTitle:NSLocalizedString(@"Warning", nil)
message:NSLocalizedString(@"Are you sure to want to remove your proxy setup?", nil)];
[alert addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil];
[alert addButtonWithTitle:NSLocalizedString(@"Yes", nil)
block:^{
[settingsStore removeAccount];
[self recomputeAccountLabelsAndSync];
[_settingsController.navigationController popViewControllerAnimated:NO];
}];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Warning", nil)
message:NSLocalizedString(@"Are you sure to want to remove your proxy setup?", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Yes", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[settingsStore removeAccount];
[self recomputeAccountLabelsAndSync];
[_settingsController.navigationController popViewControllerAnimated:NO];
}];
[errView addAction:defaultAction];
[errView addAction:continueAction];
[self presentViewController:errView animated:YES completion:nil];
} else if ([key isEqual:@"reset_logs_button"]) {
linphone_core_reset_log_collection();
} else if ([key isEqual:@"send_logs_button"]) {
@ -735,15 +742,23 @@ static UICompositeViewDescription *compositeDescription = nil;
@"important to diagnostize your issue.",
nil);
}
DTAlertView *alert =
[[DTAlertView alloc] initWithTitle:NSLocalizedString(@"Sending logs", nil) message:message];
[alert addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil];
[alert addButtonWithTitle:NSLocalizedString(@"I got it, continue", nil)
block:^{
[self sendEmailWithDebugAttachments];
}];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Sending logs", nil)
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"I got it, continue", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self sendEmailWithDebugAttachments];
}];
[errView addAction:defaultAction];
[errView addAction:continueAction];
[self presentViewController:errView animated:YES completion:nil];
}
}
@ -785,11 +800,16 @@ static UICompositeViewDescription *compositeDescription = nil;
}
if (attachments.count == 0) {
DTAlertView *alert = [[DTAlertView alloc]
initWithTitle:NSLocalizedString(@"Cannot send logs", nil)
message:NSLocalizedString(@"Nothing could be collected from your application, aborting now.", nil)];
[alert addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Cannot send logs", nil)
message:NSLocalizedString(@"Nothing could be collected from your application, aborting now.", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
return;
}

View file

@ -9,9 +9,9 @@
#import <Foundation/Foundation.h>
#import "LinphoneManager.h"
#import "DTAlertView.h"
#import "XMLRPCHelper.h"
#import "Utils.h"
#import "PhoneMainView.h"
@implementation XMLRPCHelper
@ -103,9 +103,16 @@ static void linphone_xmlrpc_call_back_received(LinphoneXmlRpcRequest *request) {
#pragma mark - Error alerts
- (void)displayErrorPopup:(NSString *)error {
DTAlertView *av = [[DTAlertView alloc] initWithTitle:NSLocalizedString(@"Server request error", nil) message:error];
[av addCancelButtonWithTitle:NSLocalizedString(@"OK", nil) block:nil];
[av show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Server request error", nil)
message:error
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
}
@end