@@ -55,6 +55,7 @@ import io.element.android.features.messages.impl.actionlist.ActionListView
5555import io.element.android.features.messages.impl.actionlist.model.TimelineItemAction
5656import io.element.android.features.messages.impl.crypto.identity.IdentityChangeStateView
5757import io.element.android.features.messages.impl.messagecomposer.AttachmentsBottomSheet
58+ import io.element.android.features.messages.impl.messagecomposer.DisabledComposerView
5859import io.element.android.features.messages.impl.messagecomposer.MessageComposerEvents
5960import io.element.android.features.messages.impl.messagecomposer.MessageComposerView
6061import io.element.android.features.messages.impl.messagecomposer.suggestions.SuggestionsPickerView
@@ -97,6 +98,7 @@ import io.element.android.libraries.designsystem.utils.snackbar.SnackbarHost
9798import io.element.android.libraries.designsystem.utils.snackbar.rememberSnackbarHostState
9899import io.element.android.libraries.matrix.api.core.EventId
99100import io.element.android.libraries.matrix.api.core.UserId
101+ import io.element.android.libraries.matrix.api.encryption.identity.IdentityState
100102import io.element.android.libraries.textcomposer.model.TextEditorState
101103import io.element.android.libraries.ui.strings.CommonStrings
102104import kotlinx.collections.immutable.ImmutableList
@@ -196,8 +198,8 @@ fun MessagesView(
196198 MessagesViewContent (
197199 state = state,
198200 modifier = Modifier
199- .padding(padding)
200- .consumeWindowInsets(padding),
201+ .padding(padding)
202+ .consumeWindowInsets(padding),
201203 onContentClick = ::onContentClick,
202204 onMessageLongClick = ::onMessageLongClick,
203205 onUserDataClick = { hidingKeyboard { onUserDataClick(it) } },
@@ -290,9 +292,9 @@ private fun MessagesViewContent(
290292) {
291293 Box (
292294 modifier = modifier
293- .fillMaxSize()
294- .navigationBarsPadding()
295- .imePadding(),
295+ .fillMaxSize()
296+ .navigationBarsPadding()
297+ .imePadding(),
296298 ) {
297299 AttachmentsBottomSheet (
298300 state = state.composerState,
@@ -402,13 +404,13 @@ private fun MessagesViewComposerBottomSheetContents(
402404 Column (modifier = Modifier .fillMaxWidth()) {
403405 SuggestionsPickerView (
404406 modifier = Modifier
405- .heightIn(max = 230 .dp)
406- // Consume all scrolling, preventing the bottom sheet from being dragged when interacting with the list of suggestions
407- .nestedScroll(object : NestedScrollConnection {
408- override fun onPostScroll (consumed : Offset , available : Offset , source : NestedScrollSource ): Offset {
409- return available
410- }
411- }),
407+ .heightIn(max = 230 .dp)
408+ // Consume all scrolling, preventing the bottom sheet from being dragged when interacting with the list of suggestions
409+ .nestedScroll(object : NestedScrollConnection {
410+ override fun onPostScroll (consumed : Offset , available : Offset , source : NestedScrollSource ): Offset {
411+ return available
412+ }
413+ }),
412414 roomId = state.roomId,
413415 roomName = state.roomName.dataOrNull(),
414416 roomAvatarData = state.roomAvatar.dataOrNull(),
@@ -425,13 +427,20 @@ private fun MessagesViewComposerBottomSheetContents(
425427 onLinkClick = onLinkClick,
426428 )
427429 }
428- MessageComposerView (
429- state = state.composerState,
430- voiceMessageState = state.voiceMessageComposerState,
431- subcomposing = subcomposing,
432- enableVoiceMessages = state.enableVoiceMessages,
433- modifier = Modifier .fillMaxWidth(),
434- )
430+ val verificationViolation = state.composerState.roomMemberIdentityStateChanges.firstOrNull {
431+ it.identityState == IdentityState .VerificationViolation
432+ }
433+ if (verificationViolation != null ) {
434+ DisabledComposerView (modifier = Modifier .fillMaxWidth())
435+ } else {
436+ MessageComposerView (
437+ state = state.composerState,
438+ voiceMessageState = state.voiceMessageComposerState,
439+ subcomposing = subcomposing,
440+ enableVoiceMessages = state.enableVoiceMessages,
441+ modifier = Modifier .fillMaxWidth(),
442+ )
443+ }
435444 }
436445 } else {
437446 CantSendMessageBanner ()
@@ -456,8 +465,8 @@ private fun MessagesViewTopBar(
456465 title = {
457466 val roundedCornerShape = RoundedCornerShape (8 .dp)
458467 val titleModifier = Modifier
459- .clip(roundedCornerShape)
460- .clickable { onRoomDetailsClick() }
468+ .clip(roundedCornerShape)
469+ .clickable { onRoomDetailsClick() }
461470 if (roomName != null && roomAvatar != null ) {
462471 RoomAvatarAndNameRow (
463472 roomName = roomName,
@@ -512,9 +521,9 @@ private fun RoomAvatarAndNameRow(
512521private fun CantSendMessageBanner () {
513522 Row (
514523 modifier = Modifier
515- .fillMaxWidth()
516- .background(MaterialTheme .colorScheme.secondary)
517- .padding(16 .dp),
524+ .fillMaxWidth()
525+ .background(MaterialTheme .colorScheme.secondary)
526+ .padding(16 .dp),
518527 verticalAlignment = Alignment .CenterVertically ,
519528 horizontalArrangement = Arrangement .Center
520529 ) {
0 commit comments