feat(service): Mark message if the chat is encrypted while the file isn't
This commit is contained in:
parent
ea9c634a25
commit
214d3250fe
@ -355,7 +355,10 @@ class HttpFileTransferService {
|
|||||||
_log.warning('HTTP GET of ${job.location.url} returned ${response?.statusCode}');
|
_log.warning('HTTP GET of ${job.location.url} returned ${response?.statusCode}');
|
||||||
} else {
|
} else {
|
||||||
var integrityCheckPassed = true;
|
var integrityCheckPassed = true;
|
||||||
if (job.location.key != null && job.location.iv != null) {
|
final conv = (await GetIt.I.get<ConversationService>()
|
||||||
|
.getConversationByJid(job.conversationJid))!;
|
||||||
|
final decryptionKeysAvailable = job.location.key != null && job.location.iv != null;
|
||||||
|
if (decryptionKeysAvailable) {
|
||||||
// The file was downloaded and is now being decrypted
|
// The file was downloaded and is now being decrypted
|
||||||
sendEvent(
|
sendEvent(
|
||||||
ProgressEvent(
|
ProgressEvent(
|
||||||
@ -425,6 +428,9 @@ class HttpFileTransferService {
|
|||||||
warningType: integrityCheckPassed ?
|
warningType: integrityCheckPassed ?
|
||||||
warningFileIntegrityCheckFailed :
|
warningFileIntegrityCheckFailed :
|
||||||
null,
|
null,
|
||||||
|
errorType: conv.encrypted && !decryptionKeysAvailable ?
|
||||||
|
messageChatEncryptedButFileNot :
|
||||||
|
null,
|
||||||
isDownloading: false,
|
isDownloading: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -435,7 +441,6 @@ class HttpFileTransferService {
|
|||||||
await notification.showNotification(msg, '');
|
await notification.showNotification(msg, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
final conv = (await GetIt.I.get<ConversationService>().getConversationByJid(job.conversationJid))!;
|
|
||||||
final sharedMedium = await GetIt.I.get<DatabaseService>().addSharedMediumFromData(
|
final sharedMedium = await GetIt.I.get<DatabaseService>().addSharedMediumFromData(
|
||||||
downloadedPath,
|
downloadedPath,
|
||||||
msg.timestamp,
|
msg.timestamp,
|
||||||
|
@ -11,6 +11,7 @@ const messageInvalidNumber = 6;
|
|||||||
const messageFailedToEncrypt = 7;
|
const messageFailedToEncrypt = 7;
|
||||||
const messageFailedToDecryptFile = 8;
|
const messageFailedToDecryptFile = 8;
|
||||||
const messageContactDoesNotSupportOmemo = 9;
|
const messageContactDoesNotSupportOmemo = 9;
|
||||||
|
const messageChatEncryptedButFileNot = 10;
|
||||||
|
|
||||||
int errorTypeFromException(dynamic exception) {
|
int errorTypeFromException(dynamic exception) {
|
||||||
if (exception is NoDecryptionKeyException) {
|
if (exception is NoDecryptionKeyException) {
|
||||||
|
Loading…
Reference in New Issue
Block a user