Update room badge when e2e misconfigured
This commit is contained in:
parent
74dfddeeea
commit
b10bc7000a
@ -27,5 +27,8 @@ enum class RoomEncryptionTrustLevel {
|
|||||||
Warning,
|
Warning,
|
||||||
|
|
||||||
// All devices in the room are verified -> the app should display a green shield
|
// 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
|
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.RoomEncryptionAlgorithm
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomJoinRules
|
import org.matrix.android.sdk.api.session.room.model.RoomJoinRules
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
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,
|
isEncrypted = roomSummaryEntity.isEncrypted,
|
||||||
encryptionEventTs = roomSummaryEntity.encryptionEventTs,
|
encryptionEventTs = roomSummaryEntity.encryptionEventTs,
|
||||||
breadcrumbsIndex = roomSummaryEntity.breadcrumbsIndex,
|
breadcrumbsIndex = roomSummaryEntity.breadcrumbsIndex,
|
||||||
roomEncryptionTrustLevel = roomSummaryEntity.roomEncryptionTrustLevel,
|
roomEncryptionTrustLevel = if (roomSummaryEntity.isEncrypted && roomSummaryEntity.e2eAlgorithm != MXCRYPTO_ALGORITHM_MEGOLM) {
|
||||||
|
RoomEncryptionTrustLevel.E2EWithUnsupportedAlgorithm
|
||||||
|
} else roomSummaryEntity.roomEncryptionTrustLevel,
|
||||||
inviterId = roomSummaryEntity.inviterId,
|
inviterId = roomSummaryEntity.inviterId,
|
||||||
hasFailedSending = roomSummaryEntity.hasFailedSending,
|
hasFailedSending = roomSummaryEntity.hasFailedSending,
|
||||||
roomType = roomSummaryEntity.roomType,
|
roomType = roomSummaryEntity.roomType,
|
||||||
|
@ -110,7 +110,7 @@ class NotificationAreaView @JvmOverloads constructor(
|
|||||||
|
|
||||||
private fun renderUnsupportedAlgorithm(e2eState: State.UnsupportedAlgorithm) {
|
private fun renderUnsupportedAlgorithm(e2eState: State.UnsupportedAlgorithm) {
|
||||||
visibility = View.VISIBLE
|
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) {
|
val text = if (e2eState.canRestore) {
|
||||||
R.string.room_unsupported_e2e_algorithm_as_admin
|
R.string.room_unsupported_e2e_algorithm_as_admin
|
||||||
} else R.string.room_unsupported_e2e_algorithm
|
} else R.string.room_unsupported_e2e_algorithm
|
||||||
|
@ -61,6 +61,10 @@ class ShieldImageView @JvmOverloads constructor(
|
|||||||
else R.drawable.ic_shield_trusted
|
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.Default -> R.drawable.ic_shield_black
|
||||||
RoomEncryptionTrustLevel.Warning -> R.drawable.ic_shield_warning
|
RoomEncryptionTrustLevel.Warning -> R.drawable.ic_shield_warning
|
||||||
RoomEncryptionTrustLevel.Trusted -> R.drawable.ic_shield_trusted
|
RoomEncryptionTrustLevel.Trusted -> R.drawable.ic_shield_trusted
|
||||||
|
RoomEncryptionTrustLevel.E2EWithUnsupportedAlgorithm -> R.drawable.ic_warning_badge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class EncryptionItemFactory @Inject constructor(
|
|||||||
} else {
|
} else {
|
||||||
title = stringProvider.getString(R.string.encryption_misconfigured)
|
title = stringProvider.getString(R.string.encryption_misconfigured)
|
||||||
description = stringProvider.getString(R.string.encryption_unknown_algorithm_tile_description)
|
description = stringProvider.getString(R.string.encryption_unknown_algorithm_tile_description)
|
||||||
shield = StatusTileTimelineItem.ShieldUIState.RED
|
shield = StatusTileTimelineItem.ShieldUIState.ERROR
|
||||||
}
|
}
|
||||||
return StatusTileTimelineItem_()
|
return StatusTileTimelineItem_()
|
||||||
.attributes(
|
.attributes(
|
||||||
|
@ -57,6 +57,7 @@ abstract class StatusTileTimelineItem : AbsBaseMessageItem<StatusTileTimelineIte
|
|||||||
ShieldUIState.GREEN -> R.drawable.ic_shield_trusted
|
ShieldUIState.GREEN -> R.drawable.ic_shield_trusted
|
||||||
ShieldUIState.BLACK -> R.drawable.ic_shield_black
|
ShieldUIState.BLACK -> R.drawable.ic_shield_black
|
||||||
ShieldUIState.RED -> R.drawable.ic_shield_warning
|
ShieldUIState.RED -> R.drawable.ic_shield_warning
|
||||||
|
ShieldUIState.ERROR -> R.drawable.ic_warning_badge
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.titleView.setCompoundDrawablesWithIntrinsicBounds(
|
holder.titleView.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
@ -98,6 +99,7 @@ abstract class StatusTileTimelineItem : AbsBaseMessageItem<StatusTileTimelineIte
|
|||||||
enum class ShieldUIState {
|
enum class ShieldUIState {
|
||||||
BLACK,
|
BLACK,
|
||||||
RED,
|
RED,
|
||||||
GREEN
|
GREEN,
|
||||||
|
ERROR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3426,6 +3426,7 @@
|
|||||||
<string name="a11y_trust_level_default">Default trust level</string>
|
<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_warning">Warning trust level</string>
|
||||||
<string name="a11y_trust_level_trusted">Trusted 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_open_emoji_picker">Open Emoji picker</string>
|
||||||
<string name="a11y_close_emoji_picker">Close Emoji picker</string>
|
<string name="a11y_close_emoji_picker">Close Emoji picker</string>
|
||||||
<string name="a11y_checked">Checked</string>
|
<string name="a11y_checked">Checked</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user