diff --git a/vector/src/main/java/im/vector/app/core/ui/views/NotificationAreaView.kt b/vector/src/main/java/im/vector/app/core/ui/views/NotificationAreaView.kt index f8cc334300..0a9b0df3c4 100644 --- a/vector/src/main/java/im/vector/app/core/ui/views/NotificationAreaView.kt +++ b/vector/src/main/java/im/vector/app/core/ui/views/NotificationAreaView.kt @@ -74,7 +74,7 @@ class NotificationAreaView @JvmOverloads constructor( is State.Default -> renderDefault() is State.Hidden -> renderHidden() is State.NoPermissionToPost -> renderNoPermissionToPost() - is State.UnsupportedAlgorithm -> renderUnsupportedAlgorithm() + is State.UnsupportedAlgorithm -> renderUnsupportedAlgorithm(newState) is State.Tombstone -> renderTombstone() is State.ResourceLimitExceededError -> renderResourceLimitExceededError(newState) }.exhaustive @@ -108,12 +108,15 @@ class NotificationAreaView @JvmOverloads constructor( views.roomNotificationMessage.setTextColor(ThemeUtils.getColor(context, R.attr.vctr_content_secondary)) } - private fun renderUnsupportedAlgorithm() { + private fun renderUnsupportedAlgorithm(e2eState: State.UnsupportedAlgorithm) { visibility = View.VISIBLE views.roomNotificationIcon.setImageResource(R.drawable.ic_shield_warning_small) + val text = if (e2eState.canRestore) { + R.string.room_unsupported_e2e_algorithm_as_admin + } else R.string.room_unsupported_e2e_algorithm val message = span { italic { - +resources.getString(R.string.room_unsupported_e2e_algorithm) + +resources.getString(text) } } views.roomNotificationMessage.onClick { @@ -180,7 +183,7 @@ class NotificationAreaView @JvmOverloads constructor( // User can't post messages to room because his power level doesn't allow it. object NoPermissionToPost : State() - object UnsupportedAlgorithm : State() + data class UnsupportedAlgorithm(val canRestore: Boolean) : State() // View will be Gone object Hidden : State() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index 3f3ac1df2f..5731b36ce0 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -1461,7 +1461,7 @@ class RoomDetailFragment @Inject constructor( NotificationAreaView.State.NoPermissionToPost } is CanSendStatus.UnSupportedE2eAlgorithm -> { - NotificationAreaView.State.UnsupportedAlgorithm + NotificationAreaView.State.UnsupportedAlgorithm(mainState.isAllowedToSetupEncryption) } }.let { views.notificationAreaView.render(it)