mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-29 12:46:58 +02:00
MESSENGER-5799 add settings alert save changes
This commit is contained in:
@@ -890,6 +890,10 @@ SSOAuthenticationPresenterDelegate>
|
||||
self.tableView.sectionFooterHeight = UITableViewAutomaticDimension;
|
||||
self.tableView.estimatedSectionFooterHeight = 50;
|
||||
|
||||
|
||||
// bwi: #5799 show alert if user has changed the avatar without saving it
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[BWIL10n settingsCustomBackButton] style:UIBarButtonItemStylePlain target:self action:@selector(customBackButtonAction)];
|
||||
|
||||
MXWeakify(self);
|
||||
|
||||
// Add observer to handle removed accounts
|
||||
@@ -5560,6 +5564,43 @@ SSOAuthenticationPresenterDelegate>
|
||||
}
|
||||
|
||||
|
||||
- (void) customBackButtonAction {
|
||||
// bwi: #5799 show alert if user has changed the avatar without saving it
|
||||
if ((nil != newAvatarImage || shouldRemoveAvatarImage) && !isSavingInProgress)
|
||||
{
|
||||
MXWeakify(self);
|
||||
[currentAlert dismissViewControllerAnimated:NO completion:nil];
|
||||
UIAlertController *saveChangesAlert = [UIAlertController alertControllerWithTitle:[BWIL10n settingsSaveChangesAlertTitle]
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
|
||||
[saveChangesAlert addAction:[UIAlertAction actionWithTitle:[BWIL10n settingsSaveChangesAlertDoNotSaveButton] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.navigationController popViewControllerAnimated:true];
|
||||
});
|
||||
self->currentAlert = nil;
|
||||
}]];
|
||||
|
||||
[saveChangesAlert addAction:[UIAlertAction actionWithTitle:[BWIL10n settingsSaveChangesAlertSaveButton] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self onSave:nil];
|
||||
});
|
||||
self->currentAlert = nil;
|
||||
}]];
|
||||
|
||||
[self presentViewController:saveChangesAlert animated:YES completion:nil];
|
||||
currentAlert = saveChangesAlert;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.navigationController popViewControllerAnimated:true];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - ThreadsBetaCoordinatorBridgePresenterDelegate
|
||||
|
||||
- (void)threadsBetaCoordinatorBridgePresenterDelegateDidTapEnable:(ThreadsBetaCoordinatorBridgePresenter *)coordinatorBridgePresenter
|
||||
|
||||
Reference in New Issue
Block a user