mirror of https://github.com/M66B/FairEmail.git
Local relock
This commit is contained in:
parent
2d1226daad
commit
ece233c65d
|
@ -2894,7 +2894,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
(EntityMessage.SMIME_SIGNENCRYPT.equals(message.ui_encrypt) &&
|
||||
!EntityMessage.SMIME_SIGNENCRYPT.equals(message.encrypt));
|
||||
if (lock)
|
||||
onMenuResync(message);
|
||||
onActionLock(message);
|
||||
else
|
||||
onActionDecrypt(message, false);
|
||||
break;
|
||||
|
@ -3799,6 +3799,46 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
.putExtra("type", encrypt));
|
||||
}
|
||||
|
||||
private void onActionLock(TupleMessageEx message) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", message.id);
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
||||
long id = args.getLong("id");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message == null)
|
||||
return null;
|
||||
|
||||
File file = message.getFile(context);
|
||||
Helper.writeText(file, null);
|
||||
db.message().setMessageContent(message.id, true, null, null, null, null);
|
||||
//db.message().setMessageSubject(id, subject);
|
||||
db.attachment().deleteAttachments(message.id);
|
||||
db.message().setMessageEncrypt(message.id, message.ui_encrypt);
|
||||
db.message().setMessageStored(message.id, new Date().getTime());
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
|
||||
}
|
||||
}.execute(context, owner, args, "message:lock");
|
||||
}
|
||||
|
||||
private void onActionAnswer(TupleMessageEx message, View anchor) {
|
||||
properties.reply(message, getSelectedText(), anchor);
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ public interface DaoAttachment {
|
|||
int deleteAttachment(long id);
|
||||
|
||||
@Query("DELETE FROM attachment" +
|
||||
" WHERE message = :message")
|
||||
" WHERE message = :message" +
|
||||
" AND encryption IS NULL")
|
||||
int deleteAttachments(long message);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue