mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 15:09:31 +02:00
MESSENGER-5410 change default setting
This commit is contained in:
@@ -3013,58 +3013,52 @@ BOOL reloadToggleCell = false;
|
||||
|
||||
// Get current serverACL settings
|
||||
[mxRoom getCurrentRoomServerACLSettingsWithCompletion:^(NSString* serverACLSettings) {
|
||||
// Hide view if no previous setting exists
|
||||
BOOL initalToggleValue = false;
|
||||
if (serverACLSettings)
|
||||
{
|
||||
// Check current serverACL settings
|
||||
BOOL initalToggleValue = false;
|
||||
if ([serverACLSettings isEqual:@"*"])
|
||||
{
|
||||
initalToggleValue = true;
|
||||
}
|
||||
|
||||
bwiFederationToggleCellData = [[BWIToggleWithLabelAndSubLabelCellData alloc] initWithInitalToggleValue:initalToggleValue isToggleDisabled:isToggleDisabled toggleText:BWIL10n.createRoomTypeFederated subText:BWIL10n.createRoomTypeFederatedSubtext];
|
||||
|
||||
[cell makeViewControllerWithParent:self toggleData:bwiFederationToggleCellData onValueChanged:^(BOOL newToggleValue) {
|
||||
// Warn the user if they try to disable federation
|
||||
if (!newToggleValue)
|
||||
{
|
||||
// ensure that the user understands that the updates will be lost if
|
||||
[currentAlert dismissViewControllerAnimated:NO completion:nil];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
self->currentAlert = [UIAlertController alertControllerWithTitle:[BWIL10n bwiRoomSettingsFederationAlertTitle] message:[BWIL10n bwiRoomSettingsFederationAlertMessage] preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
[self->currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction * action) {
|
||||
bwiFederationToggleCellData.toggleValue = true;
|
||||
[self toggleFederation: true];
|
||||
}]];
|
||||
|
||||
[self->currentAlert addAction:[UIAlertAction actionWithTitle:[BWIL10n bwiRoomSettingsFederationAlertWithdrawButton]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
[self toggleFederation: newToggleValue];
|
||||
}]];
|
||||
|
||||
[self->currentAlert mxk_setAccessibilityIdentifier:@"RoomSettingsVCChangeFederationAlert"];
|
||||
[self presentViewController:self->currentAlert animated:YES completion:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update the settings View
|
||||
[self toggleFederation: newToggleValue];
|
||||
}
|
||||
}];
|
||||
// Force layout before reusing a cell (fix switch displayed outside the screen)
|
||||
[cell layoutIfNeeded];
|
||||
}
|
||||
else
|
||||
{
|
||||
[cell setHidden:true];
|
||||
initalToggleValue = true;
|
||||
}
|
||||
|
||||
bwiFederationToggleCellData = [[BWIToggleWithLabelAndSubLabelCellData alloc] initWithInitalToggleValue:initalToggleValue isToggleDisabled:isToggleDisabled toggleText:BWIL10n.createRoomTypeFederated subText:BWIL10n.createRoomTypeFederatedSubtext];
|
||||
|
||||
[cell makeViewControllerWithParent:self toggleData:bwiFederationToggleCellData onValueChanged:^(BOOL newToggleValue) {
|
||||
// Warn the user if they try to disable federation
|
||||
if (!newToggleValue)
|
||||
{
|
||||
self->currentAlert = [UIAlertController alertControllerWithTitle:[BWIL10n bwiRoomSettingsFederationAlertTitle] message:[BWIL10n bwiRoomSettingsFederationAlertMessage] preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
[self->currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction * action) {
|
||||
bwiFederationToggleCellData.toggleValue = true;
|
||||
[self toggleFederation: true];
|
||||
}]];
|
||||
|
||||
[self->currentAlert addAction:[UIAlertAction actionWithTitle:[BWIL10n bwiRoomSettingsFederationAlertWithdrawButton]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
[self toggleFederation: newToggleValue];
|
||||
}]];
|
||||
|
||||
[self->currentAlert mxk_setAccessibilityIdentifier:@"RoomSettingsVCChangeFederationAlert"];
|
||||
[self presentViewController:self->currentAlert animated:YES completion:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update the settings View
|
||||
[self toggleFederation: newToggleValue];
|
||||
}
|
||||
}];
|
||||
// Force layout before reusing a cell (fix switch displayed outside the screen)
|
||||
[cell layoutIfNeeded];
|
||||
}];
|
||||
}
|
||||
return cell;
|
||||
@@ -3090,11 +3084,6 @@ BOOL reloadToggleCell = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ensure that the user understands that the updates will be lost if
|
||||
[currentAlert dismissViewControllerAnimated:NO completion:nil];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
self->currentAlert = [UIAlertController alertControllerWithTitle:[BWIL10n roomDetailsFailedToChangeFederationForRoomErrorTitle] message:[BWIL10n roomDetailsFailedToChangeFederationForRoomErrorText] preferredStyle:UIAlertControllerStyleAlert];
|
||||
[self->currentAlert addAction:[UIAlertAction actionWithTitle:[BWIL10n roomDetailsFailedToChangeFederationAlertDismissButton]
|
||||
style:UIAlertActionStyleDefault
|
||||
|
||||
Reference in New Issue
Block a user