Skip to content

Commit

Permalink
Merge pull request #2670 from vector-im/riot_2662
Browse files Browse the repository at this point in the history
Make clear that device names are publicly readable
  • Loading branch information
manuroe authored Aug 28, 2019
2 parents b5818cd + 293b278 commit dc7f175
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 22 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ Changes in 0.9.3 (2019-08-)
===============================================

Improvements:
* Prompt to accept integration manager policies on use (#2600).
* Upgrade MatrixKit version ([v0.11.0](https://github.com/matrix-org/matrix-ios-kit/releases/tag/v0.11.0)).
* Privacy: Prompt to accept integration manager policies on use (#2600).
* Privacy: Make clear that device names are publicly readable (#2662).
* Widgets: Whitelist [MSC1961](https://github.com/matrix-org/matrix-doc/pull/1961) widget urls

Changes in 0.9.2 (2019-08-08)
Expand Down
6 changes: 4 additions & 2 deletions Riot/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@
"settings_fail_to_update_password" = "Fail to update password";
"settings_password_updated" = "Your password has been updated";

"settings_crypto_device_name" = "Device name: ";
"settings_crypto_device_name" = "Device Public Name: ";
"settings_crypto_device_id" = "\nDevice ID: ";
"settings_crypto_device_key" = "\nDevice key: ";
"settings_crypto_device_key" = "\nDevice key:\n";
"settings_crypto_export" = "Export keys";
"settings_crypto_blacklist_unverified_devices" = "Encrypt to verified devices only";

Expand Down Expand Up @@ -479,6 +479,8 @@
"settings_key_backup_delete_confirmation_prompt_title" = "Delete Backup";
"settings_key_backup_delete_confirmation_prompt_msg" = "Are you sure? You will lose your encrypted messages if your keys are not backed up properly.";

"settings_devices_description" = "A device's public name is visible to people you communicate with";

// Room Details
"room_details_title" = "Room Details";
"room_details_people" = "Members";
Expand Down
14 changes: 9 additions & 5 deletions Riot/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ internal enum VectorL10n {
internal static var authForgotPassword: String {
return VectorL10n.tr("Vector", "auth_forgot_password")
}
/// No Identity Server is configured: add one to reset your password.
/// No identity server is configured: add one to reset your password.
internal static var authForgotPasswordErrorNoConfiguredIdentityServer: String {
return VectorL10n.tr("Vector", "auth_forgot_password_error_no_configured_identity_server")
}
Expand Down Expand Up @@ -1502,7 +1502,7 @@ internal enum VectorL10n {
internal static var roomCreationAppearancePicture: String {
return VectorL10n.tr("Vector", "room_creation_appearance_picture")
}
/// No Identity Server is configured so you cannot add a participant with an email.
/// No identity server is configured so you cannot add a participant with an email.
internal static var roomCreationErrorInviteUserByEmailWithoutIdentityServer: String {
return VectorL10n.tr("Vector", "room_creation_error_invite_user_by_email_without_identity_server")
}
Expand Down Expand Up @@ -2126,7 +2126,7 @@ internal enum VectorL10n {
internal static var roomParticipantsRemoveThirdPartyInviteMsg: String {
return VectorL10n.tr("Vector", "room_participants_remove_third_party_invite_msg")
}
/// No Identity Server is configured so you cannot start a chat with a contact using an email.
/// No identity server is configured so you cannot start a chat with a contact using an email.
internal static var roomParticipantsStartNewChatErrorUsingUserEmailWithoutIdentityServer: String {
return VectorL10n.tr("Vector", "room_participants_start_new_chat_error_using_user_email_without_identity_server")
}
Expand Down Expand Up @@ -2450,11 +2450,11 @@ internal enum VectorL10n {
internal static var settingsCryptoDeviceId: String {
return VectorL10n.tr("Vector", "settings_crypto_device_id")
}
/// \nDevice key:
/// \nDevice key:\n
internal static var settingsCryptoDeviceKey: String {
return VectorL10n.tr("Vector", "settings_crypto_device_key")
}
/// Device name:
/// Device Public Name:
internal static var settingsCryptoDeviceName: String {
return VectorL10n.tr("Vector", "settings_crypto_device_name")
}
Expand All @@ -2478,6 +2478,10 @@ internal enum VectorL10n {
internal static var settingsDevices: String {
return VectorL10n.tr("Vector", "settings_devices")
}
/// A device's public name is visible to people you communicate with
internal static var settingsDevicesDescription: String {
return VectorL10n.tr("Vector", "settings_devices_description")
}
/// Display Name
internal static var settingsDisplayName: String {
return VectorL10n.tr("Vector", "settings_display_name")
Expand Down
64 changes: 50 additions & 14 deletions Riot/Modules/Settings/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@
CRYPTOGRAPHY_COUNT
};

enum
{
DEVICES_DESCRIPTION_INDEX = 0
};

#define SECTION_TITLE_PADDING_WHEN_HIDDEN 0.01f

typedef void (^blockSettingsViewController_onReadyToDestroy)(void);
Expand Down Expand Up @@ -1008,6 +1013,10 @@ - (NSAttributedString*)cryptographyInformation
attributes:@{NSForegroundColorAttributeName : ThemeService.shared.theme.textPrimaryColor,
NSFontAttributeName: [UIFont systemFontOfSize:17]}]];
NSString *fingerprint = account.mxSession.crypto.deviceEd25519Key;
if (fingerprint)
{
fingerprint = [MXTools addWhiteSpacesToString:fingerprint every:4];
}
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
initWithString:fingerprint ? fingerprint : @""
attributes:@{NSForegroundColorAttributeName : ThemeService.shared.theme.textPrimaryColor,
Expand Down Expand Up @@ -1316,6 +1325,11 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
else if (section == SETTINGS_SECTION_DEVICES_INDEX)
{
count = devicesArray.count;
if (count)
{
// For some description (DEVICES_DESCRIPTION_INDEX)
count++;
}
}
else if (section == SETTINGS_SECTION_CRYPTOGRAPHY_INDEX)
{
Expand Down Expand Up @@ -1402,6 +1416,7 @@ - (MXKTableViewCell*)getDefaultTableViewCell:(UITableView*)tableView
cell.textLabel.accessibilityIdentifier = nil;
cell.textLabel.font = [UIFont systemFontOfSize:17];
cell.textLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
cell.contentView.backgroundColor = UIColor.clearColor;

return cell;
}
Expand Down Expand Up @@ -2194,22 +2209,39 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
else if (section == SETTINGS_SECTION_DEVICES_INDEX)
{
MXKTableViewCell *deviceCell = [self getDefaultTableViewCell:tableView];

if (row < devicesArray.count)
if (row == DEVICES_DESCRIPTION_INDEX)
{
NSString *name = devicesArray[row].displayName;
NSString *deviceId = devicesArray[row].deviceId;
deviceCell.textLabel.text = (name.length ? [NSString stringWithFormat:@"%@ (%@)", name, deviceId] : [NSString stringWithFormat:@"(%@)", deviceId]);
deviceCell.textLabel.numberOfLines = 0;

if ([deviceId isEqualToString:self.mainSession.matrixRestClient.credentials.deviceId])
MXKTableViewCell *descriptionCell = [self getDefaultTableViewCell:tableView];
descriptionCell.textLabel.text = NSLocalizedStringFromTable(@"settings_devices_description", @"Vector", nil);
descriptionCell.textLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
descriptionCell.textLabel.font = [UIFont systemFontOfSize:15];
descriptionCell.textLabel.numberOfLines = 0;
descriptionCell.contentView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
descriptionCell.selectionStyle = UITableViewCellSelectionStyleNone;

cell = descriptionCell;
}
else
{
NSUInteger deviceIndex = row - 1;

MXKTableViewCell *deviceCell = [self getDefaultTableViewCell:tableView];
if (deviceIndex < devicesArray.count)
{
deviceCell.textLabel.font = [UIFont boldSystemFontOfSize:17];
NSString *name = devicesArray[deviceIndex].displayName;
NSString *deviceId = devicesArray[deviceIndex].deviceId;
deviceCell.textLabel.text = (name.length ? [NSString stringWithFormat:@"%@ (%@)", name, deviceId] : [NSString stringWithFormat:@"(%@)", deviceId]);
deviceCell.textLabel.numberOfLines = 0;

if ([deviceId isEqualToString:self.mainSession.matrixRestClient.credentials.deviceId])
{
deviceCell.textLabel.font = [UIFont boldSystemFontOfSize:17];
}
}

cell = deviceCell;
}

cell = deviceCell;

}
else if (section == SETTINGS_SECTION_CRYPTOGRAPHY_INDEX)
{
Expand Down Expand Up @@ -2696,9 +2728,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}
else if (section == SETTINGS_SECTION_DEVICES_INDEX)
{
if (row < devicesArray.count)
if (row > DEVICES_DESCRIPTION_INDEX)
{
[self showDeviceDetails:devicesArray[row]];
NSUInteger deviceIndex = row - 1;
if (deviceIndex < devicesArray.count)
{
[self showDeviceDetails:devicesArray[deviceIndex]];
}
}
}
else if (section == SETTINGS_SECTION_CONTACTS_INDEX)
Expand Down

0 comments on commit dc7f175

Please sign in to comment.