mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 00:24:43 +02:00
RoomMemberDetailsViewController: Update security section and use localization strings.
This commit is contained in:
@@ -130,6 +130,7 @@
|
||||
self.rageShakeManager = [RageShakeManager sharedManager];
|
||||
self.encryptionTrustLevel = UserEncryptionTrustLevelUnknown;
|
||||
|
||||
securityActionsArray = [[NSMutableArray alloc] init];
|
||||
adminActionsArray = [[NSMutableArray alloc] init];
|
||||
otherActionsArray = [[NSMutableArray alloc] init];
|
||||
directChatsArray = [[NSMutableArray alloc] init];
|
||||
@@ -606,6 +607,7 @@
|
||||
NSInteger memberPowerLevel = [powerLevels powerLevelOfUserWithUserID:self.mxRoomMember.userId];
|
||||
NSInteger oneSelfPowerLevel = [powerLevels powerLevelOfUserWithUserID:self.mainSession.myUser.userId];
|
||||
|
||||
[securityActionsArray removeAllObjects];
|
||||
[adminActionsArray removeAllObjects];
|
||||
[otherActionsArray removeAllObjects];
|
||||
|
||||
@@ -744,9 +746,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (RiotSettings.shared.enableCrossSigning)
|
||||
{
|
||||
switch (self.encryptionTrustLevel) {
|
||||
case UserEncryptionTrustLevelUnknown:
|
||||
[securityActionsArray addObject:@(MXKRoomMemberDetailsActionSecurityInformation)];
|
||||
break;
|
||||
case UserEncryptionTrustLevelNone:
|
||||
case UserEncryptionTrustLevelNormal:
|
||||
case UserEncryptionTrustLevelTrusted:
|
||||
case UserEncryptionTrustLevelWarning:
|
||||
[securityActionsArray addObjectsFromArray:@[@(MXKRoomMemberDetailsActionSecurity),
|
||||
@(MXKRoomMemberDetailsActionSecurityInformation)
|
||||
]];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
securityIndex = adminToolsIndex = otherActionsIndex = directChatsIndex = devicesIndex = -1;
|
||||
|
||||
if (RiotSettings.shared.enableCrossSigning)
|
||||
|
||||
if (securityActionsArray.count)
|
||||
{
|
||||
securityIndex = sectionCount++;
|
||||
}
|
||||
@@ -777,19 +799,7 @@
|
||||
{
|
||||
if (section == securityIndex)
|
||||
{
|
||||
NSInteger numberOfRows;
|
||||
|
||||
switch (self.encryptionTrustLevel) {
|
||||
case UserEncryptionTrustLevelUnknown:
|
||||
case UserEncryptionTrustLevelNone:
|
||||
numberOfRows = 1;
|
||||
break;
|
||||
default:
|
||||
numberOfRows = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return numberOfRows;
|
||||
return securityActionsArray.count;
|
||||
}
|
||||
else if (section == adminToolsIndex)
|
||||
{
|
||||
@@ -815,7 +825,7 @@
|
||||
{
|
||||
if (section == securityIndex)
|
||||
{
|
||||
return @"SECURITY";
|
||||
return NSLocalizedStringFromTable(@"room_participants_action_section_security", @"Vector", nil);
|
||||
}
|
||||
else if (section == adminToolsIndex)
|
||||
{
|
||||
@@ -823,7 +833,7 @@
|
||||
}
|
||||
else if (RiotSettings.shared.enableCrossSigning && section == otherActionsIndex)
|
||||
{
|
||||
return @"OPTIONS";
|
||||
return NSLocalizedStringFromTable(@"room_participants_action_section_other", @"Vector", nil);
|
||||
}
|
||||
else if (section == directChatsIndex)
|
||||
{
|
||||
@@ -896,42 +906,11 @@
|
||||
{
|
||||
UITableViewCell *cell;
|
||||
|
||||
if (indexPath.section == securityIndex)
|
||||
if (indexPath.section == securityIndex && indexPath.row < securityActionsArray.count)
|
||||
{
|
||||
if (indexPath.row == [self tableView:self.tableView numberOfRowsInSection:indexPath.section] - 1)
|
||||
{
|
||||
MXKTableViewCell *encryptionInfoCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCell defaultReuseIdentifier] forIndexPath:indexPath];
|
||||
|
||||
NSMutableString *encryptionInformation = [NSMutableString new];
|
||||
|
||||
switch (self.encryptionTrustLevel) {
|
||||
case UserEncryptionTrustLevelUnknown:
|
||||
[encryptionInformation appendString:@"Loading"];
|
||||
break;
|
||||
case UserEncryptionTrustLevelNone:
|
||||
[encryptionInformation appendString:@"Messages in this room are not end-to-end encrypted."];
|
||||
break;
|
||||
default:
|
||||
[encryptionInformation appendString:@"Messages in this room are end-to-end encrypted.\n\nYour messages are secured with locks and only you and the recipient have the unique keys to unlock them."];
|
||||
break;
|
||||
}
|
||||
|
||||
[encryptionInformation appendString:@"\n"];
|
||||
|
||||
encryptionInfoCell.textLabel.backgroundColor = [UIColor clearColor];
|
||||
encryptionInfoCell.textLabel.numberOfLines = 0;
|
||||
encryptionInfoCell.textLabel.text = encryptionInformation;
|
||||
encryptionInfoCell.textLabel.font = [UIFont systemFontOfSize:14.0];
|
||||
encryptionInfoCell.textLabel.textColor = ThemeService.shared.theme.headerTextPrimaryColor;
|
||||
|
||||
encryptionInfoCell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
encryptionInfoCell.accessoryType = UITableViewCellAccessoryNone;
|
||||
encryptionInfoCell.contentView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
|
||||
encryptionInfoCell.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
|
||||
|
||||
cell = encryptionInfoCell;
|
||||
}
|
||||
else
|
||||
NSNumber *actionNumber = securityActionsArray[indexPath.row];
|
||||
|
||||
if (actionNumber.unsignedIntegerValue == MXKRoomMemberDetailsActionSecurity)
|
||||
{
|
||||
MXKTableViewCell *securityStatusCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCell defaultReuseIdentifier] forIndexPath:indexPath];
|
||||
|
||||
@@ -939,16 +918,16 @@
|
||||
|
||||
switch (self.encryptionTrustLevel) {
|
||||
case UserEncryptionTrustLevelTrusted:
|
||||
statusText = @"Verified";
|
||||
statusText = NSLocalizedStringFromTable(@"room_participants_action_security_status_verified", @"Vector", nil);
|
||||
break;
|
||||
case UserEncryptionTrustLevelNormal:
|
||||
statusText = @"Verify";
|
||||
statusText = NSLocalizedStringFromTable(@"room_participants_action_security_status_verify", @"Vector", nil);
|
||||
break;
|
||||
case UserEncryptionTrustLevelWarning:
|
||||
statusText = @"Warning";
|
||||
statusText = NSLocalizedStringFromTable(@"room_participants_action_security_status_warning", @"Vector", nil);
|
||||
break;
|
||||
default:
|
||||
statusText = @"Loading";
|
||||
statusText = NSLocalizedStringFromTable(@"room_participants_action_security_status_loading", @"Vector", nil);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -966,6 +945,46 @@
|
||||
|
||||
cell = securityStatusCell;
|
||||
}
|
||||
else if (actionNumber.unsignedIntegerValue == MXKRoomMemberDetailsActionSecurityInformation)
|
||||
{
|
||||
MXKTableViewCell *encryptionInfoCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCell defaultReuseIdentifier] forIndexPath:indexPath];
|
||||
|
||||
NSMutableString *encryptionInformation = [NSMutableString new];
|
||||
|
||||
switch (self.encryptionTrustLevel) {
|
||||
case UserEncryptionTrustLevelWarning:
|
||||
case UserEncryptionTrustLevelNormal:
|
||||
case UserEncryptionTrustLevelTrusted:
|
||||
[encryptionInformation appendString:NSLocalizedStringFromTable(@"room_participants_security_information_room_encrypted", @"Vector", nil)];
|
||||
break;
|
||||
case UserEncryptionTrustLevelNone:
|
||||
[encryptionInformation appendString:NSLocalizedStringFromTable(@"room_participants_security_information_room_not_encrypted", @"Vector", nil)];
|
||||
break;
|
||||
case UserEncryptionTrustLevelUnknown:
|
||||
[encryptionInformation appendString:NSLocalizedStringFromTable(@"room_participants_security_information_loading", @"Vector", nil)];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (encryptionInformation.length)
|
||||
{
|
||||
[encryptionInformation appendString:@"\n"];
|
||||
}
|
||||
|
||||
encryptionInfoCell.textLabel.backgroundColor = [UIColor clearColor];
|
||||
encryptionInfoCell.textLabel.numberOfLines = 0;
|
||||
encryptionInfoCell.textLabel.text = encryptionInformation;
|
||||
encryptionInfoCell.textLabel.font = [UIFont systemFontOfSize:14.0];
|
||||
encryptionInfoCell.textLabel.textColor = ThemeService.shared.theme.headerTextPrimaryColor;
|
||||
|
||||
encryptionInfoCell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
encryptionInfoCell.accessoryType = UITableViewCellAccessoryNone;
|
||||
encryptionInfoCell.contentView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
|
||||
encryptionInfoCell.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
|
||||
|
||||
cell = encryptionInfoCell;
|
||||
}
|
||||
}
|
||||
else if (indexPath.section == adminToolsIndex || indexPath.section == otherActionsIndex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user