-
Notifications
You must be signed in to change notification settings - Fork 176
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?
Changes from all commits
52c57d4
e5c99e7
afd74af
d3a6ab6
eb13752
31ab669
3f1543e
b253619
a3ec133
690c6cf
e65a436
22c0d08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Copyright 2025 New Vector Ltd. | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial | ||
* Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
package io.element.android.features.messages.impl.messagecomposer | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.IntrinsicSize | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.requiredHeightIn | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import io.element.android.compound.theme.ElementTheme | ||
import io.element.android.compound.tokens.generated.CompoundIcons | ||
import io.element.android.libraries.designsystem.preview.ElementPreview | ||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight | ||
import io.element.android.libraries.designsystem.theme.components.Icon | ||
import io.element.android.libraries.designsystem.theme.components.IconButton | ||
import io.element.android.libraries.designsystem.utils.CommonDrawables | ||
import io.element.android.libraries.textcomposer.R | ||
|
||
@Composable | ||
internal fun DisabledComposerView( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 .. |
||
modifier: Modifier = Modifier, | ||
) { | ||
Row( | ||
modifier = modifier.padding(3.dp) | ||
.fillMaxWidth(), | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
IconButton( | ||
modifier = Modifier | ||
.size(48.dp), | ||
enabled = false, | ||
onClick = {}, | ||
) { | ||
Icon( | ||
modifier = Modifier.size(30.dp), | ||
resourceId = CommonDrawables.ic_plus_composer, | ||
contentDescription = stringResource(R.string.rich_text_editor_a11y_add_attachment), | ||
tint = ElementTheme.colors.iconDisabled, | ||
) | ||
} | ||
|
||
val bgColor = ElementTheme.colors.bgCanvasDisabled | ||
val borderColor = ElementTheme.colors.borderDisabled | ||
|
||
Box( | ||
modifier = Modifier | ||
.clip(RoundedCornerShape(21.dp)) | ||
.border(0.5.dp, borderColor, RoundedCornerShape(21.dp)) | ||
.background(color = bgColor) | ||
.size(42.dp) | ||
.requiredHeightIn(min = 42.dp) | ||
.weight(1f), | ||
) | ||
|
||
Spacer(modifier = Modifier.width(8.dp)) | ||
IconButton( | ||
modifier = Modifier | ||
.padding(start = 2.dp) | ||
.size(48.dp), | ||
enabled = false, | ||
onClick = {}, | ||
) { | ||
Icon( | ||
modifier = Modifier.size(30.dp), | ||
imageVector = CompoundIcons.SendSolid(), | ||
contentDescription = "", | ||
tint = ElementTheme.colors.iconQuaternary | ||
) | ||
} | ||
} | ||
} | ||
|
||
@PreviewsDayNight | ||
@Composable | ||
internal fun DisabledComposerViewPreview() = ElementPreview { | ||
Column { | ||
DisabledComposerView( | ||
modifier = Modifier.height(IntrinsicSize.Min), | ||
) | ||
} | ||
} |
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 likefirstRoomMemberIdentityStateChange
.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