mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
Settings: Add show NSFW public rooms toggle.
This commit is contained in:
@@ -132,6 +132,7 @@ enum
|
||||
OTHER_TERM_CONDITIONS_INDEX,
|
||||
OTHER_PRIVACY_INDEX,
|
||||
OTHER_THIRD_PARTY_INDEX,
|
||||
OTHER_SHOW_NSFW_ROOMS_INDEX,
|
||||
OTHER_CRASH_REPORT_INDEX,
|
||||
OTHER_ENABLE_RAGESHAKE_INDEX,
|
||||
OTHER_MARK_ALL_AS_READ_INDEX,
|
||||
@@ -435,6 +436,8 @@ TableViewSectionsDelegate>
|
||||
[sectionOther addRowWithTag:OTHER_TERM_CONDITIONS_INDEX];
|
||||
[sectionOther addRowWithTag:OTHER_PRIVACY_INDEX];
|
||||
[sectionOther addRowWithTag:OTHER_THIRD_PARTY_INDEX];
|
||||
[sectionOther addRowWithTag:OTHER_SHOW_NSFW_ROOMS_INDEX];
|
||||
|
||||
if (BuildSettings.settingsScreenAllowChangingCrashUsageDataSettings)
|
||||
{
|
||||
[sectionOther addRowWithTag:OTHER_CRASH_REPORT_INDEX];
|
||||
@@ -2104,6 +2107,19 @@ TableViewSectionsDelegate>
|
||||
|
||||
cell = thirdPartyCell;
|
||||
}
|
||||
else if (row == OTHER_SHOW_NSFW_ROOMS_INDEX)
|
||||
{
|
||||
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
|
||||
|
||||
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_show_NSFW_public_rooms", @"Vector", nil);
|
||||
|
||||
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.showNSFWPublicRooms;
|
||||
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
|
||||
labelAndSwitchCell.mxkSwitch.enabled = YES;
|
||||
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleNSFWPublicRoomsFiltering:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
cell = labelAndSwitchCell;
|
||||
}
|
||||
else if (row == OTHER_CRASH_REPORT_INDEX)
|
||||
{
|
||||
MXKTableViewCellWithLabelAndSwitch* sendCrashReportCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
|
||||
@@ -3599,6 +3615,18 @@ TableViewSectionsDelegate>
|
||||
animated:YES];
|
||||
}
|
||||
|
||||
- (void)toggleNSFWPublicRoomsFiltering:(id)sender
|
||||
{
|
||||
if (sender && [sender isKindOfClass:UISwitch.class])
|
||||
{
|
||||
UISwitch *switchButton = (UISwitch*)sender;
|
||||
|
||||
RiotSettings.shared.showNSFWPublicRooms = switchButton.isOn;
|
||||
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - TextField listener
|
||||
|
||||
- (IBAction)textFieldDidChange:(id)sender
|
||||
|
||||
Reference in New Issue
Block a user