diff --git a/Classes/LinphoneUI/Base.lproj/UIConfirmationDialog.xib b/Classes/LinphoneUI/Base.lproj/UIConfirmationDialog.xib index e6a555139..19b1b5271 100644 --- a/Classes/LinphoneUI/Base.lproj/UIConfirmationDialog.xib +++ b/Classes/LinphoneUI/Base.lproj/UIConfirmationDialog.xib @@ -18,6 +18,7 @@ + @@ -105,12 +106,27 @@ + - + + + + + + diff --git a/Classes/LinphoneUI/UIConfirmationDialog.h b/Classes/LinphoneUI/UIConfirmationDialog.h index d026bdfe5..08dadf985 100644 --- a/Classes/LinphoneUI/UIConfirmationDialog.h +++ b/Classes/LinphoneUI/UIConfirmationDialog.h @@ -56,11 +56,14 @@ typedef void (^UIConfirmationBlock)(void); @property(weak, nonatomic) IBOutlet UILabel *titleLabel; @property(weak, nonatomic) IBOutlet UIView *firstView; @property (weak, nonatomic) IBOutlet UIButton *authButton; +@property(weak, nonatomic) IBOutlet UILabel *subscribeLabel; + - (void)setSpecialColor; -(void) setWhiteCancel; - (IBAction)onCancelClick:(id)sender; - (IBAction)onConfirmationClick:(id)sender; - (IBAction)onAuthClick:(id)sender; +- (IBAction)onSubscribeTap:(id)sender; - (void)dismiss; @end diff --git a/Classes/LinphoneUI/UIConfirmationDialog.m b/Classes/LinphoneUI/UIConfirmationDialog.m index 327bb3f04..0abd0ecc4 100644 --- a/Classes/LinphoneUI/UIConfirmationDialog.m +++ b/Classes/LinphoneUI/UIConfirmationDialog.m @@ -145,4 +145,12 @@ - (void)dismiss { [self onCancelClick:nil]; } + +- (IBAction)onSubscribeTap:(id)sender { + UIGestureRecognizer *gest = sender; + NSString *url = ((UILabel *)gest.view).text; + if (![UIApplication.sharedApplication openURL:[NSURL URLWithString:url]]) { + LOGE(@"Failed to open %@, invalid URL", url); + } +} @end diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index dccfa4b6c..f92f93988 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -885,25 +885,34 @@ void update_hash_cbs(LinphoneAccountCreator *creator, LinphoneAccountCreatorStat [PhoneMainView.instance changeCurrentView:AssistantView.compositeViewDescription]; return; } else if ([key isEqual:@"account_mandatory_remove_button"]) { - UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Warning", nil) - message:NSLocalizedString(@"Are you sure to want to remove your proxy setup?", nil) - preferredStyle:UIAlertControllerStyleAlert]; + NSString *popUpText; + NSString *appDomain = [LinphoneManager.instance lpConfigStringForKey:@"domain_name" + inSection:@"app" + withDefault:@"sip.linphone.org"]; - UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) {}]; + MSList *accountList = [LinphoneManager.instance createAccountsNotHiddenList]; + LinphoneAccount *account = bctbx_list_nth_data(accountList, + [settingsStore integerForKey:@"current_proxy_config_preference"]); - UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Yes", nil) - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { - [settingsStore removeAccount]; - [self recomputeAccountLabelsAndSync]; - [_settingsController.navigationController popViewControllerAnimated:NO]; - }]; + bool isLinphoneAccount = strcmp(appDomain.UTF8String, linphone_account_params_get_domain(linphone_account_get_params(account))) == 0; + if (isLinphoneAccount) { + popUpText = NSLocalizedString(@"Your account will only be deleted locally.\nTo delete it permanently, go to our account management platform:", nil); + } else { + popUpText = NSLocalizedString(@"Your account will only be deleted locally.\nTo delete it permanently, go on your SIP provider website.", nil); + } + bctbx_free(accountList); - [errView addAction:defaultAction]; - [errView addAction:continueAction]; - [self presentViewController:errView animated:YES completion:nil]; + UIConfirmationDialog *dialog = [UIConfirmationDialog ShowWithMessage:popUpText + cancelMessage:nil + confirmMessage:nil + onCancelClick:nil + onConfirmationClick:^() { + [settingsStore removeAccount]; + [self recomputeAccountLabelsAndSync]; + [_settingsController.navigationController popViewControllerAnimated:NO]; + }]; + dialog.subscribeLabel.hidden = !isLinphoneAccount; // Only display link to https://subscribe.linphone.org for linphone accounts + } else if ([key isEqual:@"account_mandatory_change_password"]) { UIAlertController *alertView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Change your password", nil) message:NSLocalizedString(@"Please enter and confirm your new password", nil) diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index bd19a5cae..488bda1dd 100644 Binary files a/Resources/en.lproj/Localizable.strings and b/Resources/en.lproj/Localizable.strings differ diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings index da2f63ca4..791066e50 100644 Binary files a/Resources/fr.lproj/Localizable.strings and b/Resources/fr.lproj/Localizable.strings differ