No event decoration if no decryption result

This commit is contained in:
Andy Uhnak
2023-04-03 17:30:05 +01:00
parent 17a017eeb3
commit d55ad2dbea
3 changed files with 17 additions and 8 deletions
@@ -204,14 +204,21 @@
// The encryption is in a good state.
// Only show a warning badge if there are decryption trust issues.
switch (event.decryptionDecoration.color)
if (event.decryptionDecoration)
{
case MXEventDecryptionDecorationColorRed:
return EventEncryptionDecorationRed;
case MXEventDecryptionDecorationColorGrey:
return EventEncryptionDecorationGrey;
case MXEventDecryptionDecorationColorNone:
return EventEncryptionDecorationNone;
switch (event.decryptionDecoration.color)
{
case MXEventDecryptionDecorationColorNone:
return EventEncryptionDecorationNone;
case MXEventDecryptionDecorationColorGrey:
return EventEncryptionDecorationGrey;
case MXEventDecryptionDecorationColorRed:
return EventEncryptionDecorationRed;
}
}
else
{
return EventEncryptionDecorationNone;
}
}
@@ -196,7 +196,8 @@ static NSAttributedString *verticalWhitespace = nil;
if (!safetyMessage)
{
// Use default copy if none is provided by the decryption decoration
safetyMessage = _mxEvent.decryptionDecoration.color != MXEventDecryptionDecorationColorNone ? [VectorL10n roomEventEncryptionInfoKeyAuthenticityNotGuaranteed] : [VectorL10n userVerificationSessionsListSessionTrusted];
BOOL isUntrusted = _mxEvent.decryptionDecoration && _mxEvent.decryptionDecoration.color != MXEventDecryptionDecorationColorNone;
safetyMessage = isUntrusted ? [VectorL10n roomEventEncryptionInfoKeyAuthenticityNotGuaranteed] : [VectorL10n userVerificationSessionsListSessionTrusted];
}
NSString *decryptionError;