Skip to content

Commit

Permalink
Add a setting to hide/display redaction placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
aringenbach committed Jun 14, 2022
1 parent 651b45a commit 5dcb80f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions Riot/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ Tap the + to start adding people.";
"settings_ui_theme_picker_title" = "Select a theme";
"settings_ui_theme_picker_message_invert_colours" = "\"Auto\" uses your device's \"Invert Colours\" settings";
"settings_ui_theme_picker_message_match_system_theme" = "\"Auto\" matches your device's system theme";
"settings_ui_show_redactions_in_room_history" = "Show a placeholder for removed messages";

"settings_show_url_previews" = "Show website preview";
"settings_show_url_previews_description" = "Previews will only be shown in unencrypted rooms.";
Expand Down
4 changes: 4 additions & 0 deletions Riot/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7123,6 +7123,10 @@ public class VectorL10n: NSObject {
public static var settingsUiLanguage: String {
return VectorL10n.tr("Vector", "settings_ui_language")
}
/// Show a placeholder for removed messages
public static var settingsUiShowRedactionsInRoomHistory: String {
return VectorL10n.tr("Vector", "settings_ui_show_redactions_in_room_history")
}
/// Theme
public static var settingsUiTheme: String {
return VectorL10n.tr("Vector", "settings_ui_theme")
Expand Down
23 changes: 22 additions & 1 deletion Riot/Modules/Settings/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ typedef NS_ENUM(NSUInteger, USER_INTERFACE)
{
USER_INTERFACE_LANGUAGE_INDEX = 0,
USER_INTERFACE_THEME_INDEX,
USER_INTERFACE_TIMELINE_STYLE_INDEX
USER_INTERFACE_TIMELINE_STYLE_INDEX,
USER_INTERFACE_SHOW_REDACTIONS_IN_ROOM_HISTORY
};

typedef NS_ENUM(NSUInteger, IDENTITY_SERVER)
Expand Down Expand Up @@ -518,6 +519,8 @@ - (void)updateSections

// [sectionUserInterface addRowWithTag:USER_INTERFACE_TIMELINE_STYLE_INDEX];
}

[sectionUserInterface addRowWithTag:USER_INTERFACE_SHOW_REDACTIONS_IN_ROOM_HISTORY];

[tmpSections addObject: sectionUserInterface];

Expand Down Expand Up @@ -2264,6 +2267,19 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
{
cell = [self buildMessageBubblesCellForTableView:tableView atIndexPath:indexPath];
}
else if (row == USER_INTERFACE_SHOW_REDACTIONS_IN_ROOM_HISTORY)
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];

labelAndSwitchCell.mxkLabel.text = VectorL10n.settingsUiShowRedactionsInRoomHistory;

labelAndSwitchCell.mxkSwitch.on = [MXKAppSettings standardAppSettings].showRedactionsInRoomHistory;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleShowRedacted:) forControlEvents:UIControlEventTouchUpInside];

cell = labelAndSwitchCell;
}
}
else if (section == SECTION_TAG_IGNORED_USERS)
{
Expand Down Expand Up @@ -3974,6 +3990,11 @@ - (void)deactivateAccountAction
self.deactivateAccountViewController = deactivateAccountViewController;
}

- (void)toggleShowRedacted:(UISwitch *)sender
{
[MXKAppSettings standardAppSettings].showRedactionsInRoomHistory = sender.isOn;
}

- (void)togglePresenceOfflineMode:(UISwitch *)sender
{
MXKAccount *account = MXKAccountManager.sharedManager.accounts.firstObject;
Expand Down

0 comments on commit 5dcb80f

Please sign in to comment.