Update detector to match web implementation(only track decryption attempts), add labs flag, increase rate limit spacing.

This commit is contained in:
David Langley
2022-03-16 17:47:41 +00:00
parent ae320d1efa
commit 4784084ab0
6 changed files with 84 additions and 98 deletions
+28 -1
View File
@@ -159,7 +159,8 @@ typedef NS_ENUM(NSUInteger, LABS_ENABLE)
{
LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX = 0,
LABS_ENABLE_THREADS_INDEX,
LABS_ENABLE_MESSAGE_BUBBLES_INDEX
LABS_ENABLE_MESSAGE_BUBBLES_INDEX,
LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS
};
typedef NS_ENUM(NSUInteger, SECURITY)
@@ -572,6 +573,7 @@ TableViewSectionsDelegate>
[sectionLabs addRowWithTag:LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_THREADS_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_MESSAGE_BUBBLES_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS];
sectionLabs.headerTitle = [VectorL10n settingsLabs];
if (sectionLabs.hasAnyRows)
{
@@ -1490,6 +1492,21 @@ TableViewSectionsDelegate>
return labelAndSwitchCell;
}
- (UITableViewCell *)buildAutoReportDecryptionErrorsCellForTableView:(UITableView*)tableView
atIndexPath:(NSIndexPath*)indexPath
{
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = [VectorL10n settingsLabsEnableAutoReportDecryptionErrors];
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.enableUISIAutoReporting;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableAutoReportDecryptionErrors:) forControlEvents:UIControlEventTouchUpInside];
return labelAndSwitchCell;
}
#pragma mark - 3Pid Add
- (void)showAuthenticationIfNeededForAdding:(MX3PIDMedium)medium withSession:(MXSession*)session completion:(void (^)(NSDictionary* authParams))completion
@@ -2462,6 +2479,10 @@ TableViewSectionsDelegate>
{
cell = [self buildMessageBubblesCellForTableView:tableView atIndexPath:indexPath];
}
else if (row == LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS)
{
cell = [self buildAutoReportDecryptionErrorsCellForTableView:tableView atIndexPath:indexPath];
}
}
else if (section == SECTION_TAG_FLAIR)
{
@@ -3890,6 +3911,12 @@ TableViewSectionsDelegate>
[roomDataSourceManager reset];
}
- (void)toggleEnableAutoReportDecryptionErrors:(UISwitch *)sender
{
RiotSettings.shared.enableUISIAutoReporting = sender.isOn;
}
#pragma mark - TextField listener
- (IBAction)textFieldDidChange:(id)sender