check if encrypted pgp file get deleted
This commit is contained in:
parent
8ab4ca7138
commit
7cabb2c377
|
@ -209,10 +209,10 @@ public class PgpDecryptionService {
|
||||||
URL url = message.getFileParams().url;
|
URL url = message.getFileParams().url;
|
||||||
mXmppConnectionService.getFileBackend().updateFileParams(message, url);
|
mXmppConnectionService.getFileBackend().updateFileParams(message, url);
|
||||||
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
|
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
|
||||||
|
mXmppConnectionService.updateMessage(message);
|
||||||
if (!inputFile.delete()) {
|
if (!inputFile.delete()) {
|
||||||
Log.w(Config.LOGTAG,"unable to delete pgp encrypted source file "+inputFile.getAbsolutePath());
|
Log.w(Config.LOGTAG,"unable to delete pgp encrypted source file "+inputFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
mXmppConnectionService.updateMessage(message);
|
|
||||||
skipNotificationPush = true;
|
skipNotificationPush = true;
|
||||||
mXmppConnectionService.getFileBackend().updateMediaScanner(outputFile, () -> notifyIfPending(message));
|
mXmppConnectionService.getFileBackend().updateMediaScanner(outputFile, () -> notifyIfPending(message));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -179,20 +179,6 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void findMessagesWithFiles(final OnMessageFound onMessageFound) {
|
|
||||||
final ArrayList<Message> results = new ArrayList<>();
|
|
||||||
synchronized (this.messages) {
|
|
||||||
for (final Message m : this.messages) {
|
|
||||||
if (m.isFileOrImage() && m.getEncryption() != Message.ENCRYPTION_PGP) {
|
|
||||||
results.add(m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(Message result : results) {
|
|
||||||
onMessageFound.onMessageFound(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Message findMessageWithFileAndUuid(final String uuid) {
|
public Message findMessageWithFileAndUuid(final String uuid) {
|
||||||
synchronized (this.messages) {
|
synchronized (this.messages) {
|
||||||
for (final Message message : this.messages) {
|
for (final Message message : this.messages) {
|
||||||
|
@ -208,11 +194,15 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
|
|
||||||
public boolean markAsDeleted(final List<String> uuids) {
|
public boolean markAsDeleted(final List<String> uuids) {
|
||||||
boolean deleted = false;
|
boolean deleted = false;
|
||||||
|
final PgpDecryptionService pgpDecryptionService = account.getPgpDecryptionService();
|
||||||
synchronized (this.messages) {
|
synchronized (this.messages) {
|
||||||
for(Message message : this.messages) {
|
for(Message message : this.messages) {
|
||||||
if (uuids.contains(message.getUuid())) {
|
if (uuids.contains(message.getUuid())) {
|
||||||
message.setDeleted(true);
|
message.setDeleted(true);
|
||||||
deleted = true;
|
deleted = true;
|
||||||
|
if (message.getEncryption() == Message.ENCRYPTION_PGP && pgpDecryptionService != null) {
|
||||||
|
pgpDecryptionService.discard(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1635,8 +1635,8 @@ public class XmppConnectionService extends Service {
|
||||||
final File file = new File(path);
|
final File file = new File(path);
|
||||||
final boolean isInternalFile = fileBackend.isInternalFile(file);
|
final boolean isInternalFile = fileBackend.isInternalFile(file);
|
||||||
final List<String> uuids = databaseBackend.markFileAsDeleted(file, isInternalFile);
|
final List<String> uuids = databaseBackend.markFileAsDeleted(file, isInternalFile);
|
||||||
Log.d(Config.LOGTAG, "deleted file " + path+" internal="+isInternalFile+", database hits="+uuids.size());
|
Log.d(Config.LOGTAG, "deleted file " + path+" internal="+isInternalFile+", database hits="+uuids.size());
|
||||||
markUuidsAsDeletedFiles(uuids);
|
markUuidsAsDeletedFiles(uuids);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markUuidsAsDeletedFiles(List<String> uuids) {
|
private void markUuidsAsDeletedFiles(List<String> uuids) {
|
||||||
|
|
|
@ -1089,7 +1089,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
copyLink.setVisible(true);
|
copyLink.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
|
if (m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED && !deleted) {
|
||||||
retryDecryption.setVisible(true);
|
retryDecryption.setVisible(true);
|
||||||
}
|
}
|
||||||
if (!showError
|
if (!showError
|
||||||
|
|
Loading…
Reference in New Issue