Add setting to disable URL previews.

Using a temporary position in the settings screen whilst waiting for feedback.
This commit is contained in:
Doug
2021-09-03 10:19:26 +01:00
parent 8f8322a94c
commit ef65feb3de
11 changed files with 42 additions and 6 deletions
@@ -120,6 +120,7 @@ enum
{
USER_INTERFACE_LANGUAGE_INDEX = 0,
USER_INTERFACE_THEME_INDEX,
USER_INTERFACE_SHOW_URL_PREVIEWS_INDEX,
};
enum
@@ -461,6 +462,7 @@ TableViewSectionsDelegate>
Section *sectionUserInterface = [Section sectionWithTag:SECTION_TAG_USER_INTERFACE];
[sectionUserInterface addRowWithTag:USER_INTERFACE_LANGUAGE_INDEX];
[sectionUserInterface addRowWithTag:USER_INTERFACE_THEME_INDEX];
[sectionUserInterface addRowWithTag:USER_INTERFACE_SHOW_URL_PREVIEWS_INDEX];
sectionUserInterface.headerTitle = NSLocalizedStringFromTable(@"settings_user_interface", @"Vector", nil);
[tmpSections addObject: sectionUserInterface];
@@ -2104,6 +2106,18 @@ TableViewSectionsDelegate>
[cell vc_setAccessoryDisclosureIndicatorWithCurrentTheme];
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
}
else if (row == USER_INTERFACE_SHOW_URL_PREVIEWS_INDEX)
{
MXKTableViewCellWithLabelAndSwitch *labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_show_url_previews", @"Vector", nil);
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.roomScreenShowsURLPreviews;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableURLPreviews:) forControlEvents:UIControlEventValueChanged];
cell = labelAndSwitchCell;
}
}
else if (section == SECTION_TAG_IGNORED_USERS)
{
@@ -3038,6 +3052,11 @@ TableViewSectionsDelegate>
}
}
- (void)toggleEnableURLPreviews:(UISwitch *)sender
{
RiotSettings.shared.roomScreenShowsURLPreviews = sender.on;
}
- (void)toggleSendCrashReport:(id)sender
{
BOOL enable = RiotSettings.shared.enableCrashReport;