mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-16 20:10:04 +03:00
Update room badge when e2e misconfigured
This commit is contained in:
parent
74dfddeeea
commit
b10bc7000a
7 changed files with 19 additions and 5 deletions
|
@ -27,5 +27,8 @@ enum class RoomEncryptionTrustLevel {
|
|||
Warning,
|
||||
|
||||
// All devices in the room are verified -> the app should display a green shield
|
||||
Trusted
|
||||
Trusted,
|
||||
|
||||
// e2e is active but with an unsupported algorithm
|
||||
E2EWithUnsupportedAlgorithm
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.matrix.android.sdk.internal.database.mapper
|
||||
|
||||
import org.matrix.android.sdk.api.crypto.RoomEncryptionTrustLevel
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomEncryptionAlgorithm
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomJoinRules
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
|
@ -70,7 +71,9 @@ internal class RoomSummaryMapper @Inject constructor(private val timelineEventMa
|
|||
isEncrypted = roomSummaryEntity.isEncrypted,
|
||||
encryptionEventTs = roomSummaryEntity.encryptionEventTs,
|
||||
breadcrumbsIndex = roomSummaryEntity.breadcrumbsIndex,
|
||||
roomEncryptionTrustLevel = roomSummaryEntity.roomEncryptionTrustLevel,
|
||||
roomEncryptionTrustLevel = if (roomSummaryEntity.isEncrypted && roomSummaryEntity.e2eAlgorithm != MXCRYPTO_ALGORITHM_MEGOLM) {
|
||||
RoomEncryptionTrustLevel.E2EWithUnsupportedAlgorithm
|
||||
} else roomSummaryEntity.roomEncryptionTrustLevel,
|
||||
inviterId = roomSummaryEntity.inviterId,
|
||||
hasFailedSending = roomSummaryEntity.hasFailedSending,
|
||||
roomType = roomSummaryEntity.roomType,
|
||||
|
|
|
@ -110,7 +110,7 @@ class NotificationAreaView @JvmOverloads constructor(
|
|||
|
||||
private fun renderUnsupportedAlgorithm(e2eState: State.UnsupportedAlgorithm) {
|
||||
visibility = View.VISIBLE
|
||||
views.roomNotificationIcon.setImageResource(R.drawable.ic_shield_warning_small)
|
||||
views.roomNotificationIcon.setImageResource(R.drawable.ic_warning_badge)
|
||||
val text = if (e2eState.canRestore) {
|
||||
R.string.room_unsupported_e2e_algorithm_as_admin
|
||||
} else R.string.room_unsupported_e2e_algorithm
|
||||
|
|
|
@ -61,6 +61,10 @@ class ShieldImageView @JvmOverloads constructor(
|
|||
else R.drawable.ic_shield_trusted
|
||||
)
|
||||
}
|
||||
RoomEncryptionTrustLevel.E2EWithUnsupportedAlgorithm -> {
|
||||
contentDescription = context.getString(R.string.a11y_trust_level_trusted)
|
||||
setImageResource(R.drawable.ic_warning_badge)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,5 +75,6 @@ fun RoomEncryptionTrustLevel.toDrawableRes(): Int {
|
|||
RoomEncryptionTrustLevel.Default -> R.drawable.ic_shield_black
|
||||
RoomEncryptionTrustLevel.Warning -> R.drawable.ic_shield_warning
|
||||
RoomEncryptionTrustLevel.Trusted -> R.drawable.ic_shield_trusted
|
||||
RoomEncryptionTrustLevel.E2EWithUnsupportedAlgorithm -> R.drawable.ic_warning_badge
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class EncryptionItemFactory @Inject constructor(
|
|||
} else {
|
||||
title = stringProvider.getString(R.string.encryption_misconfigured)
|
||||
description = stringProvider.getString(R.string.encryption_unknown_algorithm_tile_description)
|
||||
shield = StatusTileTimelineItem.ShieldUIState.RED
|
||||
shield = StatusTileTimelineItem.ShieldUIState.ERROR
|
||||
}
|
||||
return StatusTileTimelineItem_()
|
||||
.attributes(
|
||||
|
|
|
@ -57,6 +57,7 @@ abstract class StatusTileTimelineItem : AbsBaseMessageItem<StatusTileTimelineIte
|
|||
ShieldUIState.GREEN -> R.drawable.ic_shield_trusted
|
||||
ShieldUIState.BLACK -> R.drawable.ic_shield_black
|
||||
ShieldUIState.RED -> R.drawable.ic_shield_warning
|
||||
ShieldUIState.ERROR -> R.drawable.ic_warning_badge
|
||||
}
|
||||
|
||||
holder.titleView.setCompoundDrawablesWithIntrinsicBounds(
|
||||
|
@ -98,6 +99,7 @@ abstract class StatusTileTimelineItem : AbsBaseMessageItem<StatusTileTimelineIte
|
|||
enum class ShieldUIState {
|
||||
BLACK,
|
||||
RED,
|
||||
GREEN
|
||||
GREEN,
|
||||
ERROR
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3426,6 +3426,7 @@
|
|||
<string name="a11y_trust_level_default">Default trust level</string>
|
||||
<string name="a11y_trust_level_warning">Warning trust level</string>
|
||||
<string name="a11y_trust_level_trusted">Trusted trust level</string>
|
||||
<string name="a11y_trust_level_misconfigured">Misconfigured trust level</string>
|
||||
<string name="a11y_open_emoji_picker">Open Emoji picker</string>
|
||||
<string name="a11y_close_emoji_picker">Close Emoji picker</string>
|
||||
<string name="a11y_checked">Checked</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue