-
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(crypto): verification violation handling and block sending #4126
base: develop
Are you sure you want to change the base?
feature(crypto): verification violation handling and block sending #4126
Conversation
27093ef
to
0566d90
Compare
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
159fd2a
to
c012fa1
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4126 +/- ##
===========================================
+ Coverage 83.35% 83.37% +0.01%
===========================================
Files 1886 1888 +2
Lines 49403 49474 +71
Branches 5804 5812 +8
===========================================
+ Hits 41180 41249 +69
- Misses 6134 6137 +3
+ Partials 2089 2088 -1 ☔ View full report in Codecov by Sentry. |
…ion_violation_banner' into feature/valere/support_verification_violation_banner
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! Just need some renaming and cleanup, let me know if I can do anything else.
@@ -32,7 +33,8 @@ fun IdentityChangeStateView( | |||
// Pick the first identity change to PinViolation | |||
val pinViolationIdentityChange = state.roomMemberIdentityStateChanges.firstOrNull { | |||
// For now only render PinViolation | |||
it.identityState == IdentityState.PinViolation | |||
it.identityState == IdentityState.PinViolation || | |||
it.identityState == IdentityState.VerificationViolation |
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 you remove the 2 comments above please? Looks like there are not true anymore :)
Also probably pinViolationIdentityChange
could be rename to something more generic like firstRoomMemberIdentityStateChange
.
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.
done
@@ -10,5 +10,6 @@ package io.element.android.features.messages.impl.crypto.identity | |||
import io.element.android.libraries.matrix.api.core.UserId | |||
|
|||
sealed interface IdentityChangeEvent { | |||
data class Submit(val userId: UserId) : IdentityChangeEvent | |||
data class PinViolation(val userId: UserId) : IdentityChangeEvent |
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.
Should be renamed to something more related to the action that will be performed. I propose PinUserIdentity
.
@@ -10,5 +10,6 @@ package io.element.android.features.messages.impl.crypto.identity | |||
import io.element.android.libraries.matrix.api.core.UserId | |||
|
|||
sealed interface IdentityChangeEvent { | |||
data class Submit(val userId: UserId) : IdentityChangeEvent | |||
data class PinViolation(val userId: UserId) : IdentityChangeEvent | |||
data class VerificationViolation(val userId: UserId) : IdentityChangeEvent |
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.
Should be renamed to something more related to the action that will be performed. I propose WithdrawVerification
.
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.
renamed
@@ -94,15 +99,22 @@ class IdentityChangeStatePresenter @Inject constructor( | |||
Timber.e(it, "Failed to pin identity for user $userId") | |||
} | |||
} | |||
|
|||
private fun CoroutineScope.withdrawVerificationRequirement(userId: UserId) = launch { |
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.
Rename to withdrawVerification
?
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.
done
@@ -66,6 +66,7 @@ interface EncryptionService { | |||
* Remember this identity, ensuring it does not result in a pin violation. | |||
*/ | |||
suspend fun pinUserIdentity(userId: UserId): Result<Unit> | |||
suspend fun withdrawVerificationRequirement(userId: UserId): Result<Unit> |
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.
Rename to withdrawVerification
?
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.
done
import io.element.android.libraries.textcomposer.R | ||
|
||
@Composable | ||
internal fun DisabledComposerView( |
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 understand the aim of this Composable, but, as @jmartinesp mentionned, we take the risk that if a change in the real composer UI is done, this component is not updated.
I have seen that you have added screenshot test in the same view than the real composer, so this may mitigate this risk, thanks.
So it's OK for me!
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.
ok. not ideal but enough for now. We need anyhow a way to have the composer disabled, and properly support transition to disabled in the middle of editing/recording ..
@@ -705,4 +723,33 @@ class MessageComposerPresenter @AssistedInject constructor( | |||
} | |||
} | |||
} | |||
|
|||
@OptIn(ExperimentalCoroutinesApi::class) | |||
private fun ProduceStateScope<PersistentList<RoomMemberIdentityStateChange>>.observeRoomMemberIdentityStateChange() { |
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.
This method already exists in IdentityChangeStatePresenter
, we should avoid copy pasting full block of code like this. Can you extract it please?
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.
Moved to a Utils class
...main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerView.kt
Show resolved
Hide resolved
@@ -78,7 +78,11 @@ fun ComposerAlertMolecule( | |||
text = content, | |||
modifier = Modifier.weight(1f), | |||
style = ElementTheme.typography.fontBodyMdRegular, | |||
color = ElementTheme.colors.textPrimary, | |||
color = if (isCritical) { | |||
ElementTheme.colors.textCriticalPrimary |
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.
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.
There is no dark version in figma. I am color blind so not sure if it's strange or not ^^
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.
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.
a bit better, but the paddings/margins are a bit strange on the composer de44045
…ion_violation_banner' into feature/valere/support_verification_violation_banner
Quality Gate passedIssues Measures |
Draft as it depends on matrix-org/matrix-rust-sdk#4478
Android part of element-hq/element-meta#2492 (still partial as there is no way to verify other users yet on EX, so you can only withdraw the verification requirement).
Content
When a previously verified user is not anymore there will now be a banner on top of the composer. The composer will be in a disabled state, as anyhow sending will fail (as per element-hq/element-meta#2488)
Motivation and context
Screenshots / GIFs
Dark:
Tests
Tested devices
Checklist