mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
When deleting account, replace previous system alert pop up with a custom confirmation dialog that includes (if the account was a linphone account) a link to susbscribe.linphone.org for permanent deletion
This commit is contained in:
parent
211714167a
commit
470ec60d99
6 changed files with 53 additions and 17 deletions
|
|
@ -18,6 +18,7 @@
|
|||
<outlet property="forwardImage" destination="1Wh-Yi-cUe" id="YQq-bt-pk1"/>
|
||||
<outlet property="groupCallImage" destination="SVn-4k-9yc" id="sAP-8V-ttn"/>
|
||||
<outlet property="securityImage" destination="bbo-g3-bGy" id="qZa-li-yrl"/>
|
||||
<outlet property="subscribeLabel" destination="Xbl-Qs-GaE" id="Qnf-pA-nL0"/>
|
||||
<outlet property="titleLabel" destination="jLz-g1-cTe" id="qaj-OB-2r1"/>
|
||||
<outlet property="view" destination="2Vb-Xy-rci" id="nNw-EJ-AY3"/>
|
||||
</connections>
|
||||
|
|
@ -105,12 +106,27 @@
|
|||
<rect key="frame" x="100" y="50" width="136" height="54"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
</imageView>
|
||||
<label hidden="YES" opaque="NO" tag="13" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="https://subscribe.linphone.org" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xbl-Qs-GaE" userLabel="subscribeLabel">
|
||||
<rect key="frame" x="-42" y="291" width="414" height="29"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.98766469960000003" green="0.27512490750000002" blue="0.029739789660000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<connections>
|
||||
<outletCollection property="gestureRecognizers" destination="tfG-O1-yfD" appends="YES" id="Jcg-KH-U5B"/>
|
||||
</connections>
|
||||
</label>
|
||||
</subviews>
|
||||
</view>
|
||||
</subviews>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<point key="canvasLocation" x="871.20000000000005" y="261.31934032983509"/>
|
||||
<point key="canvasLocation" x="548" y="34"/>
|
||||
</view>
|
||||
<tapGestureRecognizer id="tfG-O1-yfD" userLabel="onSubscribeTap">
|
||||
<connections>
|
||||
<action selector="onSubscribeTap:" destination="-1" id="Zq2-mP-ccM"/>
|
||||
</connections>
|
||||
</tapGestureRecognizer>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="checkbox_checked.png" width="27.200000762939453" height="27.200000762939453"/>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue