Migration from UiAlertView to UiAlertController for simple UiAlert

This commit is contained in:
REIS Benjamin 2016-10-04 11:59:55 +02:00
parent d92f5053f7
commit f6ab161960
17 changed files with 313 additions and 218 deletions

View file

@ -114,12 +114,16 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark - popup
- (void)showErrorPopup:(const char *)err {
UIAlertView *errorView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Account configuration issue", nil)
message:[AssistantView StringForXMLRPCError:err]
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil, nil];
[errorView show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Account configuration issue", nil)
message:[AssistantView StringForXMLRPCError:err]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
}
#pragma mark - cbs
@ -201,20 +205,22 @@ void assistant_activate_phone_number_link(LinphoneAccountCreator *creator, Linph
}
- (IBAction)onPhoneNumberDisclosureClick:(id)sender {
UIAlertView *errorView = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"What will my phone number be used for?", nil)
message:NSLocalizedString(@"Your friends will find your more easily if you link your account to your "
@"phone number. \n\nYou will see in your address book who is using "
@"Linphone and your friends will know that they can reach you on Linphone "
@"as well. \n\nYou can use your phone number with only one Linphone "
@"account. If you had already linked your number to an other account but "
@"you prefer to use this one, simply link it now and your number will "
@"automatically be moved to this account.",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil, nil];
[errorView show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"What will my phone number be used for?", nil)
message:NSLocalizedString(@"Your friends will find your more easily if you link your account to your "
@"phone number. \n\nYou will see in your address book who is using "
@"Linphone and your friends will know that they can reach you on Linphone "
@"as well. \n\nYou can use your phone number with only one Linphone "
@"account. If you had already linked your number to an other account but "
@"you prefer to use this one, simply link it now and your number will "
@"automatically be moved to this account.",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
}
#pragma mark - select country delegate

View file

@ -224,15 +224,18 @@ static UICompositeViewDescription *compositeDescription = nil;
LinphoneManager *lm = LinphoneManager.instance;
if (!linphone_core_is_network_reachable(LC)) {
UIAlertView *error =
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Network Error", nil)
message:NSLocalizedString(@"There is no network connection available, enable "
@"WIFI or WWAN prior to configure an account",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Network Error", nil)
message:NSLocalizedString(@"There is no network connection available, enable "
@"WIFI or WWAN prior to configure an account",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
_waitView.hidden = YES;
return;
}
@ -265,14 +268,17 @@ static UICompositeViewDescription *compositeDescription = nil;
// todo: STOP doing that!
[[LinphoneManager.instance fastAddressBook] reload];
} else {
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Assistant error", nil)
message:NSLocalizedString(
@"Could not configure your account, please check parameters or try again later", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Assistant error", nil)
message:NSLocalizedString(@"Could not configure your account, please check parameters or try again later",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
_waitView.hidden = YES;
return;
}
@ -673,12 +679,16 @@ static UICompositeViewDescription *compositeDescription = nil;
break;
case LinphoneConfiguringFailed: {
NSString *error_message = [notif.userInfo valueForKey:@"message"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Provisioning Load error", nil)
message:error_message
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Provisioning Load error", nil)
message:error_message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
break;
}
@ -741,13 +751,15 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)showErrorPopup:(const char *)err {
UIAlertView *errorView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Account configuration issue", nil)
message:[self.class StringForXMLRPCError:err]
//message:[NSString stringWithUTF8String:err]
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil, nil];
[errorView show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Account configuration issue", nil)
message:[AssistantView StringForXMLRPCError:err]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
}
- (void)isAccountUsed:(LinphoneAccountCreatorStatus)status withResp:(const char *)resp {
@ -1104,16 +1116,22 @@ void assistant_is_account_activated(LinphoneAccountCreator *creator, LinphoneAcc
}
- (IBAction)onPhoneNumberDisclosureClick:(id)sender {
UIAlertView *errorView = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"What will my phone number be used for?", nil)
message:NSLocalizedString(@"Thanks to your phone number, your friends will find you more easily. "
@"\n\nYou will see in your address book who is using Linphone and your "
@"friends will know that they can reach you on Linphone as well.",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil, nil];
[errorView show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"What will my phone number be used for?", nil)
message:NSLocalizedString(@"Your friends will find your more easily if you link your account to your "
@"phone number. \n\nYou will see in your address book who is using "
@"Linphone and your friends will know that they can reach you on Linphone "
@"as well. \n\nYou can use your phone number with only one Linphone "
@"account. If you had already linked your number to an other account but "
@"you prefer to use this one, simply link it now and your number will "
@"automatically be moved to this account.",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
}
- (IBAction)onBackClick:(id)sender {

View file

@ -541,15 +541,18 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
if (state == LinphoneCallStreamsRunning && callAppData->videoRequested &&
linphone_call_params_low_bandwidth_enabled(param)) {
// too bad video was not enabled because low bandwidth
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Low bandwidth", nil)
message:NSLocalizedString(@"Video cannot be activated because of low bandwidth "
@"condition, only audio is available",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
otherButtonTitles:nil];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Low bandwidth", nil)
message:NSLocalizedString(@"Video cannot be activated because of low bandwidth "
@"condition, only audio is available",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Continue"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
callAppData->videoRequested = FALSE; /*reset field*/
}
}

View file

@ -83,12 +83,17 @@
LC, ((NSString *)[_contacts.allKeys objectAtIndex:indexPath.row]).UTF8String);
if (!room) {
[PhoneMainView.instance popCurrentView];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid address", nil)
message:@"Please specify the entire SIP address for the chat"
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Invalid address", nil)
message:NSLocalizedString(@"Please specify the entire SIP address for the chat",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
} else {
ChatConversationView *view = VIEW(ChatConversationView);
[view setChatRoom:room];

View file

@ -194,15 +194,18 @@ static UICompositeViewDescription *compositeDescription = nil;
const LinphoneAddress *addr = linphone_chat_room_get_peer_address(_chatRoom);
if (addr == NULL) {
[PhoneMainView.instance popCurrentView];
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to send a "
@"message or use a valid SIP address (I.E sip:john@example.net)",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to send a "
@"message or use a valid SIP address (I.E sip:john@example.net)",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Continue"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
return;
}
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
@ -245,14 +248,18 @@ static UICompositeViewDescription *compositeDescription = nil;
completionBlock:^(NSURL *assetURL, NSError *error) {
if (error) {
LOGE(@"Cannot save image data downloaded [%@]", [error localizedDescription]);
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Transfer error", nil)
message:NSLocalizedString(@"Cannot write image to photo library", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Ok", nil)
otherButtonTitles:nil, nil];
[errorAlert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Transfer error", nil)
message:NSLocalizedString(@"Cannot write image to photo library",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
} else {
LOGI(@"Image saved to [%@]", [assetURL absoluteString]);
[self startImageUpload:image url:assetURL];

View file

@ -126,15 +126,18 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (![FastAddressBook isAuthorized]) {
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Address book", nil)
message:NSLocalizedString(@"You must authorize the application to have access to address book.\n"
"Toggle the application in Settings > Privacy > Contacts",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Address book", nil)
message:NSLocalizedString(@"You must authorize the application to have access to address book.\n"
"Toggle the application in Settings > Privacy > Contacts",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Continue"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
[PhoneMainView.instance popCurrentView];
}
}

View file

@ -234,13 +234,17 @@ static UICompositeViewDescription *compositeDescription = nil;
}
} else {
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle:subject
message:NSLocalizedString(@"Error: no mail account configured", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:subject
message:NSLocalizedString(@"Error: no mail account configured",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
}
}

View file

@ -245,15 +245,18 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)onLoginClick:(id)sender {
if (!linphone_core_is_network_reachable(LC)) {
UIAlertView *error =
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Network Error", nil)
message:NSLocalizedString(@"There is no network connection available, enable "
@"WIFI or WWAN prior to configure an account",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Network Error", nil)
message:NSLocalizedString(@"There is no network connection available, enable "
@"WIFI or WWAN prior to configure an account",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
return;
}

View file

@ -25,8 +25,7 @@
#import <UserNotifications/UserNotifications.h>
#import <UserNotificationsUI/UserNotificationsUI.h>
//@interface LinphoneAppDelegate : NSObject <UIApplicationDelegate,UIAlertViewDelegate> {
@interface LinphoneAppDelegate : NSObject <UIApplicationDelegate,UIAlertViewDelegate, PKPushRegistryDelegate, UNUserNotificationCenterDelegate> {
@interface LinphoneAppDelegate : NSObject <UIApplicationDelegate, PKPushRegistryDelegate, UNUserNotificationCenterDelegate> {
@private
UIBackgroundTaskIdentifier bgStartId;
BOOL startedInBackground;

View file

@ -681,26 +681,32 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
if (state == LinphoneConfiguringSuccessful) {
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[_waitingIndicator dismissWithClickedButtonIndex:0 animated:true];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Success", nil)
message:NSLocalizedString(@"Remote configuration successfully fetched and applied.", nil)
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];
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Success", nil)
message:NSLocalizedString(@"Remote configuration successfully fetched and applied.", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[error show];
[PhoneMainView.instance startUp];
}
if (state == LinphoneConfiguringFailed) {
[NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[_waitingIndicator dismissWithClickedButtonIndex:0 animated:true];
UIAlertView *error =
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Failure", nil)
message:NSLocalizedString(@"Failed configuring from the specified URL.", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Failure", nil)
message:NSLocalizedString(@"Failed configuring from the specified URL.", nil)
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];
}
}

View file

@ -19,6 +19,7 @@
#import "LinphoneCoreSettingsStore.h"
#import "Utils.h"
#import "PhoneMainView.h"
#include "linphone/lpconfig.h"
#include "linphone/linphone_tunnel.h"
@ -395,12 +396,16 @@
}
- (void)alertAccountError:(NSString *)error {
UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil)
message:error
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alertview show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"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];
}
- (void)synchronizeAccounts {
@ -570,12 +575,16 @@
// in case of error, show an alert to the user
if (error != nil) {
linphone_proxy_config_done(proxyCfg);
[[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil)
message:error
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil] show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"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];
}
}
// reload address book to prepend proxy config domain to contacts' phone number

View file

@ -1688,14 +1688,16 @@ static BOOL libStarted = FALSE;
LOGE(@"audioSession setActive failed: %@", [err description]);
}
if (!bAudioInputAvailable) {
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"No microphone", nil)
message:NSLocalizedString(
@"You need to plug a microphone to your device to use this application.", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Ok", nil)
otherButtonTitles:nil, nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"No microphone", nil)
message:NSLocalizedString(@"You need to plug a microphone to your device to use the application.", nil)
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];
}
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
@ -2271,16 +2273,16 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
- (BOOL)call:(const LinphoneAddress *)iaddr {
// First verify that network is available, abort otherwise.
if (!linphone_core_is_network_reachable(theLinphoneCore)) {
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Network Error", nil)
message:
NSLocalizedString(
@"There is no network connection available, enable WIFI or WWAN prior to place a call",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Network Error", nil)
message:NSLocalizedString(@"There is no network connection available, enable WIFI or WWAN prior to place a call", nil)
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];
return FALSE;
}
@ -2288,27 +2290,32 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
CTCallCenter *callCenter = [[CTCallCenter alloc] init];
if ([callCenter currentCalls] != nil) {
LOGE(@"GSM call in progress, cancelling outgoing SIP call request");
UIAlertView *error =
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Cannot make call", nil)
message:NSLocalizedString(@"Please terminate GSM call first.", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Cannot make call", nil)
message:NSLocalizedString(@"Please terminate GSM call first.", nil)
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];
return FALSE;
}
// Then check that the supplied address is valid
if (!iaddr) {
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a "
@"call or use a valid SIP address (I.E sip:john@example.net)",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a "
@"call or use a valid SIP address (I.E sip:john@example.net)", nil)
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];
return FALSE;
}
LinphoneAddress *addr = linphone_address_clone(iaddr);

View file

@ -20,6 +20,7 @@
#import "UIShopTableCell.h"
#import "Utils.h"
#import "UILabel+Boldify.h"
#import "PhoneMainView.h"
@implementation UIShopTableCell
@ -55,12 +56,16 @@ UIImageView *infoImage;
- (IBAction)onDetails:(id)event {
NSString *msg = [NSString stringWithFormat:@"Product - %@", self.nameLabel.text];
UIAlertView *descriptionAlertView = [[UIAlertView alloc] initWithTitle:msg
message:self.descriptionLabel.text
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[descriptionAlertView show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:msg
message:self.descriptionLabel.text
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];
}
- (void)touchUp:(id)sender {

View file

@ -287,12 +287,16 @@ static RootViewManager *rootViewManagerInstance = nil;
LinphoneRegistrationState state = [[notif.userInfo objectForKey:@"state"] intValue];
if (state == LinphoneRegistrationFailed && ![currentView equal:AssistantView.compositeViewDescription] &&
[UIApplication sharedApplication].applicationState != UIApplicationStateBackground) {
UIAlertView *error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Registration failure", nil)
message:[notif.userInfo objectForKey:@"message"]
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
otherButtonTitles:nil, nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Registration failure", nil)
message:[notif.userInfo objectForKey:@"message"]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Continue", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
}
}
@ -633,12 +637,16 @@ static RootViewManager *rootViewManagerInstance = nil;
}
lTitle = NSLocalizedString(@"Call failed", nil);
UIAlertView *error = [[UIAlertView alloc] initWithTitle:lTitle
message:lMessage
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:lTitle
message:lMessage
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
}
- (void)addInhibitedEvent:(id)event {

View file

@ -808,12 +808,16 @@ static UICompositeViewDescription *compositeDescription = nil;
#endif
if (error != nil) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Cannot send email", nil)
message:error
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
otherButtonTitles:nil];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Cannot send email", nil)
message:error
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Continue", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
} else {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

View file

@ -8,6 +8,7 @@
#import "FileTransferDelegate.h"
#import "Utils.h"
#import "PhoneMainView.h"
@interface FileTransferDelegate ()
@property(strong) NSMutableData *data;
@ -60,13 +61,17 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
if (error) {
LOGE(@"Cannot save image data downloaded [%@]", [error localizedDescription]);
[LinphoneManager setValueInMessageAppData:nil forKey:@"localimage" inMessage:message];
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Transfer error", nil)
message:NSLocalizedString(@"Cannot write image to photo library", nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Ok", nil)
otherButtonTitles:nil, nil];
[errorAlert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Transfer error", nil)
message:NSLocalizedString(@"Cannot write image to photo library",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
} else {
LOGI(@"Image saved to [%@]", [assetURL absoluteString]);
[LinphoneManager setValueInMessageAppData:[assetURL absoluteString]

View file

@ -800,13 +800,16 @@ CGRect IASKCGRectSwap(CGRect rect);
mailViewController.mailComposeDelegate = vc;
[vc presentModalViewController:mailViewController animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Mail not configured", @"InAppSettingsKit")
message:NSLocalizedString(@"This device is not configured for sending Email. Please configure the Mail settings in the Settings app.", @"InAppSettingsKit")
delegate: nil
cancelButtonTitle:NSLocalizedString(@"OK", @"InAppSettingsKit")
otherButtonTitles:nil];
[alert show];
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Mail not configured", @"InAppSettingKit")
message:NSLocalizedString(@"This device is not configured for sending Email. Please configure the Mail settings in the Settings app.", @"InAppSettingsKit")
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"InAppSettingsKit")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[self presentViewController:errView animated:YES completion:nil];
}
} else if ([[specifier type] isEqualToString:kIASKCustomViewSpecifier] && [self.delegate respondsToSelector:@selector(settingsViewController:tableView:didSelectCustomViewSpecifier:)]) {
@ -907,4 +910,4 @@ CGRect IASKCGRectSwap(CGRect rect) {
}
@end
#pragma deploymate pop
#pragma deploymate pop