Merge branch 'develop' of github.com:vector-im/element-ios into langleyd/5017_uisi_autoreporter

This commit is contained in:
David Langley
2022-03-16 21:45:33 +00:00
651 changed files with 37785 additions and 18730 deletions
+53 -41
View File
@@ -160,7 +160,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_AUTO_REPORT_DECRYPTION_ERRORS
LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS,
LABS_USE_ONLY_LATEST_USER_AVATAR_AND_NAME_INDEX
};
typedef NS_ENUM(NSUInteger, SECURITY)
@@ -289,7 +290,7 @@ TableViewSectionsDelegate>
@property (nonatomic) BOOL isPreparingIdentityService;
@property (nonatomic, strong) ServiceTermsModalCoordinatorBridgePresenter *serviceTermsModalCoordinatorBridgePresenter;
@property (nonatomic) AnalyticsScreenTimer *screenTimer;
@property (nonatomic) AnalyticsScreenTracker *screenTracker;
@end
@@ -324,7 +325,7 @@ TableViewSectionsDelegate>
isResetPwdInProgress = NO;
is3PIDBindingInProgress = NO;
self.screenTimer = [[AnalyticsScreenTimer alloc] initWithScreen:AnalyticsScreenSettings];
self.screenTracker = [[AnalyticsScreenTracker alloc] initWithScreen:AnalyticsScreenSettings];
}
- (void)updateSections
@@ -574,6 +575,7 @@ TableViewSectionsDelegate>
[sectionLabs addRowWithTag:LABS_ENABLE_THREADS_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_MESSAGE_BUBBLES_INDEX];
[sectionLabs addRowWithTag:LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS];
[sectionLabs addRowWithTag:LABS_USE_ONLY_LATEST_USER_AVATAR_AND_NAME_INDEX];
sectionLabs.headerTitle = [VectorL10n settingsLabs];
if (sectionLabs.hasAnyRows)
{
@@ -797,6 +799,8 @@ TableViewSectionsDelegate>
{
[super viewWillAppear:animated];
[self.screenTracker trackScreen];
// Refresh display
[self refreshSettings];
@@ -825,8 +829,6 @@ TableViewSectionsDelegate>
[self releasePushedViewController];
[self.settingsDiscoveryTableViewSection reload];
[self.screenTimer start];
}
- (void)viewWillDisappear:(BOOL)animated
@@ -870,12 +872,6 @@ TableViewSectionsDelegate>
}
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[self.screenTimer stop];
}
#pragma mark - Internal methods
- (void)pushViewController:(UIViewController*)viewController
@@ -1014,11 +1010,11 @@ TableViewSectionsDelegate>
{
MXWeakify(self);
[currentAlert dismissViewControllerAnimated:NO completion:nil];
UIAlertController *validationAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n accountEmailValidationTitle]
UIAlertController *validationAlert = [UIAlertController alertControllerWithTitle:[VectorL10n accountEmailValidationTitle]
message:message
preferredStyle:UIAlertControllerStyleAlert];
[validationAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
[validationAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
self->currentAlert = nil;
[self stopActivityIndicator];
@@ -1027,7 +1023,7 @@ TableViewSectionsDelegate>
self.newEmailEditingEnabled = NO;
}]];
[validationAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n continue] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
[validationAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n continue] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
[self tryFinaliseAddEmailSession:threePidAddSession withAuthenticationParameters:authenticationParameters
threePidAddManager:threePidAddManager];
@@ -1112,7 +1108,7 @@ TableViewSectionsDelegate>
MXError *mxError = [[MXError alloc] initWithNSError:error];
if (mxError && [mxError.errcode isEqualToString:kMXErrCodeStringThreePIDAuthFailed])
{
[self showValidationEmailDialogWithMessage:[MatrixKitL10n accountEmailValidationError] for3PidAddSession:threePidAddSession threePidAddManager:threePidAddManager authenticationParameters:authParams];
[self showValidationEmailDialogWithMessage:[VectorL10n accountEmailValidationError] for3PidAddSession:threePidAddSession threePidAddManager:threePidAddManager authenticationParameters:authParams];
}
else
{
@@ -1131,11 +1127,11 @@ TableViewSectionsDelegate>
MXWeakify(self);
[currentAlert dismissViewControllerAnimated:NO completion:nil];
UIAlertController *validationAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n accountMsisdnValidationTitle]
UIAlertController *validationAlert = [UIAlertController alertControllerWithTitle:[VectorL10n accountMsisdnValidationTitle]
message:message
preferredStyle:UIAlertControllerStyleAlert];
[validationAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
[validationAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
self->currentAlert = nil;
@@ -1152,7 +1148,7 @@ TableViewSectionsDelegate>
textField.keyboardType = UIKeyboardTypeDecimalPad;
}];
[validationAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n submit] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
[validationAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n submit] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
@@ -1262,7 +1258,7 @@ TableViewSectionsDelegate>
}
else
{
title = [MatrixKitL10n error];
title = [VectorL10n error];
}
}
@@ -1270,7 +1266,7 @@ TableViewSectionsDelegate>
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
MXWeakify(self);
[errorAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n ok] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
self->currentAlert = nil;
@@ -1460,9 +1456,9 @@ TableViewSectionsDelegate>
NSString *appVersionInfo = [NSString stringWithFormat:@"%@ %@ (%@)", appName, appVersion, buildVersion];
NSString *loggedUserInfo = [MatrixKitL10n settingsConfigUserId:account.mxCredentials.userId];
NSString *loggedUserInfo = [VectorL10n settingsConfigUserId:account.mxCredentials.userId];
NSString *homeserverInfo = [MatrixKitL10n settingsConfigHomeServer:account.mxCredentials.homeServer];
NSString *homeserverInfo = [VectorL10n settingsConfigHomeServer:account.mxCredentials.homeServer];
NSString *sdkVersionInfo = [NSString stringWithFormat:@"Matrix SDK %@", MatrixSDKVersion];
@@ -2482,6 +2478,17 @@ TableViewSectionsDelegate>
else if (row == LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS)
{
cell = [self buildAutoReportDecryptionErrorsCellForTableView:tableView atIndexPath:indexPath];
else if (row == LABS_USE_ONLY_LATEST_USER_AVATAR_AND_NAME_INDEX)
{
MXKTableViewCellWithLabelAndSwitch *labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = VectorL10n.settingsLabsUseOnlyLatestUserAvatarAndName;
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.roomScreenUseOnlyLatestUserAvatarAndName;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleUseOnlyLatestUserAvatarAndName:) forControlEvents:UIControlEventTouchUpInside];
cell = labelAndSwitchCell;
}
}
else if (section == SECTION_TAG_FLAIR)
@@ -2729,7 +2736,7 @@ TableViewSectionsDelegate>
UIAlertController *unignorePrompt = [UIAlertController alertControllerWithTitle:[VectorL10n settingsUnignoreUser:ignoredUserId] message:nil preferredStyle:UIAlertControllerStyleAlert];
[unignorePrompt addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes]
[unignorePrompt addAction:[UIAlertAction actionWithTitle:[VectorL10n yes]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -2760,7 +2767,7 @@ TableViewSectionsDelegate>
}]];
[unignorePrompt addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no]
[unignorePrompt addAction:[UIAlertAction actionWithTitle:[VectorL10n no]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -2962,7 +2969,7 @@ TableViewSectionsDelegate>
// Remove ?
UIAlertController *removePrompt = [UIAlertController alertControllerWithTitle:[VectorL10n settingsRemovePromptTitle] message:promptMsg preferredStyle:UIAlertControllerStyleAlert];
[removePrompt addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[removePrompt addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
@@ -3040,7 +3047,7 @@ TableViewSectionsDelegate>
UIAlertController *showSettingsPrompt = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
[showSettingsPrompt addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[showSettingsPrompt addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
@@ -3052,7 +3059,7 @@ TableViewSectionsDelegate>
}]];
UIAlertAction *settingsAction = [UIAlertAction actionWithTitle:[MatrixKitL10n settings]
UIAlertAction *settingsAction = [UIAlertAction actionWithTitle:[VectorL10n settings]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
if (weakSelf)
@@ -3265,6 +3272,11 @@ TableViewSectionsDelegate>
}
}
- (void)toggleUseOnlyLatestUserAvatarAndName:(UISwitch *)sender
{
RiotSettings.shared.roomScreenUseOnlyLatestUserAvatarAndName = sender.isOn;
}
- (void)markAllAsRead:(id)sender
{
// Feedback: disable button and run activity indicator
@@ -3463,7 +3475,7 @@ TableViewSectionsDelegate>
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
[errorAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -3486,7 +3498,7 @@ TableViewSectionsDelegate>
}]];
[errorAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n retry]
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n retry]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -3525,11 +3537,11 @@ TableViewSectionsDelegate>
[currentAlert dismissViewControllerAnimated:NO completion:nil];
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n accountErrorEmailWrongTitle]
message:[MatrixKitL10n accountErrorEmailWrongDescription]
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:[VectorL10n accountErrorEmailWrongTitle]
message:[VectorL10n accountErrorEmailWrongDescription]
preferredStyle:UIAlertControllerStyleAlert];
[errorAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok]
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n ok]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -3560,7 +3572,7 @@ TableViewSectionsDelegate>
__block MX3PidAddSession *thirdPidAddSession;
thirdPidAddSession = [session.threePidAddManager startAddEmailSessionWithEmail:self->newEmailTextField.text nextLink:nil success:^{
[self showValidationEmailDialogWithMessage:[MatrixKitL10n accountEmailValidationMessage]
[self showValidationEmailDialogWithMessage:[VectorL10n accountEmailValidationMessage]
for3PidAddSession:thirdPidAddSession
threePidAddManager:session.threePidAddManager
authenticationParameters:authParams];
@@ -3636,11 +3648,11 @@ TableViewSectionsDelegate>
[currentAlert dismissViewControllerAnimated:NO completion:nil];
__weak typeof(self) weakSelf = self;
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n accountErrorMsisdnWrongTitle]
message:[MatrixKitL10n accountErrorMsisdnWrongDescription]
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:[VectorL10n accountErrorMsisdnWrongTitle]
message:[VectorL10n accountErrorMsisdnWrongDescription]
preferredStyle:UIAlertControllerStyleAlert];
[errorAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok]
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n ok]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -3681,7 +3693,7 @@ TableViewSectionsDelegate>
__block MX3PidAddSession *new3Pid;
new3Pid = [session.threePidAddManager startAddPhoneNumberSessionWithPhoneNumber:msisdn countryCode:nil success:^{
[self showValidationMsisdnDialogWithMessage:[MatrixKitL10n accountMsisdnValidationMessage] for3PidAddSession:new3Pid threePidAddManager:session.threePidAddManager authenticationParameters:authParams];
[self showValidationMsisdnDialogWithMessage:[VectorL10n accountMsisdnValidationMessage] for3PidAddSession:new3Pid threePidAddManager:session.threePidAddManager authenticationParameters:authParams];
} failure:^(NSError *error) {
@@ -3865,7 +3877,7 @@ TableViewSectionsDelegate>
[themePicker addAction:blackAction];
// Cancel button
[themePicker addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[themePicker addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:nil]];
@@ -4030,7 +4042,7 @@ TableViewSectionsDelegate>
UIAlertController *successAlert = [UIAlertController alertControllerWithTitle:nil message:[VectorL10n settingsPasswordUpdated] preferredStyle:UIAlertControllerStyleAlert];
[successAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok]
[successAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n ok]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -4079,7 +4091,7 @@ TableViewSectionsDelegate>
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:nil message:[VectorL10n settingsFailToUpdatePassword] preferredStyle:UIAlertControllerStyleAlert];
[errorAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok]
[errorAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n ok]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -4589,7 +4601,7 @@ TableViewSectionsDelegate>
message:nil
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:MatrixKitL10n.ok
[alertController addAction:[UIAlertAction actionWithTitle:VectorL10n.ok
style:UIAlertActionStyleDefault
handler:nil]];