mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-25 16:24:27 +00:00
core, ui: item about no e2ee in public channels (#6886)
* core, ui: item about no e2ee in public channels * fix, refactor * all tests * update bot api types --------- Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
+6
-3
@@ -3800,8 +3800,8 @@ sealed class CIContent: ItemContent {
|
||||
is RcvBlocked -> generalGetString(MR.strings.blocked_by_admin_item_description)
|
||||
is SndDirectE2EEInfo -> directE2EEInfoStr(e2eeInfo)
|
||||
is RcvDirectE2EEInfo -> directE2EEInfoStr(e2eeInfo)
|
||||
is SndGroupE2EEInfo -> e2eeInfoNoPQStr
|
||||
is RcvGroupE2EEInfo -> e2eeInfoNoPQStr
|
||||
is SndGroupE2EEInfo -> groupE2EEInfoStr(e2eeInfo)
|
||||
is RcvGroupE2EEInfo -> groupE2EEInfoStr(e2eeInfo)
|
||||
is ChatBanner -> ""
|
||||
is InvalidJSON -> "invalid data"
|
||||
}
|
||||
@@ -3838,6 +3838,9 @@ sealed class CIContent: ItemContent {
|
||||
|
||||
private val e2eeInfoNoPQStr: String = generalGetString(MR.strings.e2ee_info_no_pq_short)
|
||||
|
||||
fun groupE2EEInfoStr(e2EEInfo: E2EEInfo): String =
|
||||
if (e2EEInfo.public == true) generalGetString(MR.strings.e2ee_info_no_e2ee) else e2eeInfoNoPQStr
|
||||
|
||||
fun featureText(feature: Feature, enabled: String, param: Int?, role: GroupMemberRole? = null): String =
|
||||
(if (feature.hasParam) {
|
||||
"${feature.text}: ${timeText(param)}"
|
||||
@@ -4364,7 +4367,7 @@ enum class CIGroupInvitationStatus {
|
||||
}
|
||||
|
||||
@Serializable
|
||||
class E2EEInfo (val pqEnabled: Boolean?) {}
|
||||
class E2EEInfo (val pqEnabled: Boolean?, val public: Boolean? = null) {}
|
||||
|
||||
object MsgContentSerializer : KSerializer<MsgContent> {
|
||||
override val descriptor: SerialDescriptor = buildSerialDescriptor("MsgContent", PolymorphicKind.SEALED) {
|
||||
|
||||
+10
-14
@@ -680,21 +680,17 @@ fun ChatItemView(
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun E2EEInfoNoPQText() {
|
||||
e2eeInfoText(MR.strings.e2ee_info_no_pq)
|
||||
fun DirectE2EEInfoText(e2EEInfo: E2EEInfo) {
|
||||
e2eeInfoText(when (e2EEInfo.pqEnabled) {
|
||||
true -> MR.strings.e2ee_info_pq
|
||||
false -> MR.strings.e2ee_info_no_pq
|
||||
null -> MR.strings.e2ee_info_e2ee
|
||||
})
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DirectE2EEInfoText(e2EEInfo: E2EEInfo) {
|
||||
if (e2EEInfo.pqEnabled != null) {
|
||||
if (e2EEInfo.pqEnabled) {
|
||||
e2eeInfoText(MR.strings.e2ee_info_pq)
|
||||
} else {
|
||||
E2EEInfoNoPQText()
|
||||
}
|
||||
} else {
|
||||
e2eeInfoText(MR.strings.e2ee_info_e2ee)
|
||||
}
|
||||
fun GroupE2EEInfoText(e2EEInfo: E2EEInfo) {
|
||||
e2eeInfoText(if (e2EEInfo.public == true) MR.strings.e2ee_info_no_e2ee else MR.strings.e2ee_info_no_pq)
|
||||
}
|
||||
|
||||
if (cItem.meta.itemDeleted != null && (!revealed.value || cItem.isDeletedContent)) {
|
||||
@@ -794,8 +790,8 @@ fun ChatItemView(
|
||||
is CIContent.RcvBlocked -> DeletedItem()
|
||||
is CIContent.SndDirectE2EEInfo -> DirectE2EEInfoText(c.e2eeInfo)
|
||||
is CIContent.RcvDirectE2EEInfo -> DirectE2EEInfoText(c.e2eeInfo)
|
||||
is CIContent.SndGroupE2EEInfo -> E2EEInfoNoPQText()
|
||||
is CIContent.RcvGroupE2EEInfo -> E2EEInfoNoPQText()
|
||||
is CIContent.SndGroupE2EEInfo -> GroupE2EEInfoText(c.e2eeInfo)
|
||||
is CIContent.RcvGroupE2EEInfo -> GroupE2EEInfoText(c.e2eeInfo)
|
||||
is CIContent.ChatBanner -> Spacer(modifier = Modifier.size(0.dp))
|
||||
is CIContent.InvalidJSON -> {
|
||||
CIInvalidJSONView(c.json)
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
<string name="e2ee_info_e2ee"><![CDATA[Messages are protected by <b>end-to-end encryption</b>.]]></string>
|
||||
<string name="e2ee_info_no_pq"><![CDATA[Messages, files and calls are protected by <b>end-to-end encryption</b> with perfect forward secrecy, repudiation and break-in recovery.]]></string>
|
||||
<string name="e2ee_info_pq"><![CDATA[Messages, files and calls are protected by <b>quantum resistant e2e encryption</b> with perfect forward secrecy, repudiation and break-in recovery.]]></string>
|
||||
<string name="e2ee_info_no_e2ee"><![CDATA[Messages in this channel are <b>not end-to-end encrypted</b>. Chat relays can see these messages.]]></string>
|
||||
<string name="e2ee_info_no_pq_short">This chat is protected by end-to-end encryption.</string>
|
||||
<string name="e2ee_info_pq_short">This chat is protected by quantum resistant end-to-end encryption.</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user