-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature : room settings - security and privacy #4212
Conversation
…rename alias to canonicalAlias
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, although I have some worries about the error(...)
being used while mapping some SDK data.
There are a few nits that I pointed out, but it's mostly naming and asking for more docs/comments, so you can ignore them if you don't agree.
Note I haven't tested the new features yet.
trailingContent = ListItemContent.RadioButton(selected = selected == SecurityAndPrivacyRoomAccess.Anyone), | ||
onClick = { onSelected(SecurityAndPrivacyRoomAccess.Anyone) }, | ||
) | ||
if (selected == SecurityAndPrivacyRoomAccess.SpaceMember) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add some comments on why this is needed?
title = stringResource(CommonStrings.screen_security_and_privacy_room_history_section_header), | ||
modifier = modifier, | ||
) { | ||
Spacer(Modifier.height(16.dp)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this spacer needed? Also, it seems larger than spacers in other sections, at least it seems larger in the screenshots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
supportingContent = { Text(text = stringResource(CommonStrings.screen_security_and_privacy_encryption_section_footer)) }, | ||
trailingContent = ListItemContent.Switch( | ||
checked = isEncryptionEnabled, | ||
enabled = !isEncryptionEnabled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could add a comment here to to explain encryption can't be disabled once enabled.
* [Public](`RoomVisibility::Public`) rooms are listed in the room | ||
* directory and can be found using it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦀 spotted!
is JoinRule.Custom, | ||
JoinRule.Invite, | ||
JoinRule.Private, | ||
null -> SecurityAndPrivacyRoomAccess.InviteOnly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe explain why all these are mapped to InviteOnly
?
SecurityAndPrivacyRoomAccess.Anyone -> JoinRule.Public | ||
SecurityAndPrivacyRoomAccess.AskToJoin -> JoinRule.Knock | ||
SecurityAndPrivacyRoomAccess.InviteOnly -> JoinRule.Private | ||
SecurityAndPrivacyRoomAccess.SpaceMember -> error("Unsupported") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is used in a safe context at the moment (a runCatching
wrapped block), but maybe we should be more careful about it? If we add some other usage in the future we might be crashing the app.
Also, documenting why this is not supported would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to nullable
if (this.alias?.matchesServer(serverName) == true) { | ||
return this.alias | ||
} | ||
return this.alternativeAliases.firstOrNull { it.value.contains(serverName) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this use matchesServer
too?
val newAlternativeAliases = room.alternativeAliases.filter { it != savedAliasFromHomeserver } | ||
room.updateCanonicalAlias(newRoomAlias, newAlternativeAliases).getOrThrow() | ||
} | ||
// Otherwise, update the alternative aliases and keep the current canonical alias | ||
// Otherwise, only update the alternative aliases and keep the current canonical alias | ||
else -> { | ||
val newAlternativeAliases = listOf(newRoomAlias) + room.alternativeAliases | ||
val newAlternativeAliases = buildList { | ||
add(newRoomAlias) | ||
for (alias in room.alternativeAliases) { | ||
if (alias != savedAliasFromHomeserver) { | ||
add(alias) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These seem super difficult to follow for me, could we document the different cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have simplified and added comment
@@ -71,6 +71,9 @@ class SecurityAndPrivacyPresenter @AssistedInject constructor( | |||
var currentIsEncrypted by remember(savedSettings.isEncrypted) { | |||
mutableStateOf(savedSettings.isEncrypted) | |||
} | |||
|
|||
var showEncryptionConfirmation by remember { mutableStateOf(false) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
showEnableEncryptionConfirmation
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this huge PR.
I have a concerned about enabling encryption UX which could be improved, maybe discussed with product? I have attached a video of the problem.
val securityAndPrivacyPermissions = room.securityAndPrivacyPermissionsAsState(syncUpdateFlow.value) | ||
val canShowSecurityAndPrivacy by remember { | ||
derivedStateOf { | ||
isKnockRequestsEnabled && roomType is RoomDetailsType.Room && securityAndPrivacyPermissions.value.hasAny |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange to see this new screen behind isKnockRequestsEnabled
since it also allow to for instance enable encryption IIUC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this has been discussed, and for now this is what we want...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encryption will not be enabled until user press the "Save" button. So maybe show this popup when the user press the Save button?
This is really a problem because the user will strongly think that the encryption is enabled after this popup is closed, and this is enforced by the fact that there is no confirmation when leaving the screen without saving the change.
See the video below:
EnableEncryptionMisleading.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's a bit misleading, but this is what product/design want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mxandreas can you see my video ^? And confirm that this is fine. The risk is that user may think they have enabled encryption and this will actually no be the case until the save button has been pressed. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe adding a confirmation dialog when user leaves without saving pending changes can mitigate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it can be misleading and mainly due to the popup.
Maybe adding a confirmation dialog when user leaves without saving pending changes can mitigate this.
This is the only consistent/scalable option, I see but not sure how easy it is to be done. Since @gaelledel has been the one driving such details about interaction, I think she needs to make call about this to make sure the bigger picture remains consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we can proceed of releasing this "as is" and apply an update/fix sooner/later, though.
val securityAndPrivacyPermissions = room.securityAndPrivacyPermissionsAsState(syncUpdateFlow.value) | ||
val canShowSecurityAndPrivacy by remember { | ||
derivedStateOf { | ||
isKnockRequestsEnabled && roomType is RoomDetailsType.Room && securityAndPrivacyPermissions.value.hasAny |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small neat, securityAndPrivacyPermissions.value.hasAny
seems not to be live, I was on the room details screen when I became admin of the room and the item "Security & Privacy" did not appear. I had to go back to the previous screen and come back to see it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's not live, because powerlevels are not live
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the answers to my comments.
I hope we will implement a "Leaving without saving" alert that would be good for the UX and is not hard to do technically speaking.
Quality Gate passedIssues Measures |
Content
This PR introduce the new screens of security and privacy, it includes the following change :
It includes also the necessary changes from the sdk allowing to update and listen those settings.
Motivation and context
Figma : https://www.figma.com/design/7TqjqdMBaPpm3IavKsMYu6/Ask-to-join-(Knocking)?node-id=5147-58412&m=dev
Meta issue : element-hq/element-meta#2631
Screenshots / GIFs
Tests
Tested devices
Checklist