core, ui: make msgVerified optional (#7247)

This commit is contained in:
spaced4ndy authored and GitHub committed 2026-07-13 21:20:36 +00:00
1 parent d7af648d2a
commit e53508ecca
18 files changed
+50 -68

No files matched your search

@@ -2433,7 +2433,6 @@ enum class MsgSigStatus {
sealed class MsgVerified {
@Serializable @SerialName("signed") data class Signed(val sigStatus: MsgSigStatus): MsgVerified()
@Serializable @SerialName("sigMissing") object SigMissing: MsgVerified()
@Serializable @SerialName("unsigned") object Unsigned: MsgVerified()
val verified: Boolean get() = this is Signed && sigStatus == MsgSigStatus.Verified
@@ -3577,7 +3576,7 @@ data class CIMeta (
val deletable: Boolean,
val editable: Boolean,
val showGroupAsSender: Boolean,
val msgVerified: MsgVerified = MsgVerified.Unsigned
val msgVerified: MsgVerified? = null
) {
val timestampText: String get() = getTimestampText(itemTs, true)
@@ -272,7 +272,7 @@ fun ChatItemInfoView(chatRh: Long?, ci: ChatItem, ciInfo: ChatItemInfo, devTools
if (deleteAt != null) {
InfoRow(stringResource(MR.strings.info_row_disappears_at), localTimestamp(deleteAt))
}
if (ci.meta.msgVerified.verified) {
if (ci.meta.msgVerified?.verified == true) {
val signedRes = if (sent) MR.strings.info_row_signed else MR.strings.info_row_signed_verified
InfoRow(stringResource(signedRes), "", icon = painterResource(MR.images.ic_verified))
} else if (ci.meta.msgVerified is MsgVerified.SigMissing) {
@@ -568,7 +568,7 @@ fun itemInfoShareText(chatModel: ChatModel, ci: ChatItem, chatItemInfo: ChatItem
if (deleteAt != null) {
shareText.add(String.format(generalGetString(MR.strings.share_text_disappears_at), localTimestamp(deleteAt)))
}
if (ci.meta.msgVerified.verified) {
if (ci.meta.msgVerified?.verified == true) {
shareText.add(generalGetString(if (sent) MR.strings.info_row_signed else MR.strings.info_row_signed_verified))
} else if (ci.meta.msgVerified is MsgVerified.SigMissing) {
shareText.add(generalGetString(MR.strings.signature_missing_alert_title))
@@ -112,7 +112,7 @@ private fun CIMetaText(
Spacer(Modifier.width(4.dp))
StatusIconText(painterResource(if (encrypted) MR.images.ic_lock else MR.images.ic_lock_open_right), color)
}
if (showSignature && meta.msgVerified.verified && signedFileVerified != false) {
if (showSignature && meta.msgVerified?.verified == true && signedFileVerified != false) {
Spacer(Modifier.width(4.dp))
StatusIconText(painterResource(MR.images.ic_verified), color)
} else if (meta.msgVerified is MsgVerified.SigMissing) {
@@ -182,7 +182,7 @@ fun reserveSpaceForMeta(
res += iconSpace
space = whiteSpace
}
if ((showSignature && meta.msgVerified.verified && signedFileVerified != false) || meta.msgVerified is MsgVerified.SigMissing) {
if ((showSignature && meta.msgVerified?.verified == true && signedFileVerified != false) || meta.msgVerified is MsgVerified.SigMissing) {
appendSpace()
res += iconSpace
space = whiteSpace
@@ -127,7 +127,7 @@ fun ChatItemView(
modifier = (if (fillMaxWidth) Modifier.fillMaxWidth() else Modifier),
contentAlignment = alignment,
) {
val info = cItem.meta.itemStatus.statusInto ?: cItem.meta.msgVerified.sigMissingInfo
val info = cItem.meta.itemStatus.statusInto ?: cItem.meta.msgVerified?.sigMissingInfo
val onClick = if (info != null) {
{
AlertManager.shared.showAlertMsg(