mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Swipe to permanently delete local drafts
This commit is contained in:
parent
e451e82977
commit
8eb987ef38
1 changed files with 31 additions and 4 deletions
|
@ -1924,16 +1924,23 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
if (EntityFolder.OUTBOX.equals(message.folderType))
|
||||
return makeMovementFlags(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT);
|
||||
|
||||
TupleAccountSwipes swipes = accountSwipes.get(message.account);
|
||||
if (swipes == null)
|
||||
return 0;
|
||||
|
||||
if (message.uid == null &&
|
||||
message.accountProtocol == EntityAccount.TYPE_IMAP &&
|
||||
EntityFolder.DRAFTS.equals(message.folderType))
|
||||
return makeMovementFlags(0,
|
||||
(EntityFolder.TRASH.equals(swipes.left_type) ? ItemTouchHelper.LEFT : 0) |
|
||||
(EntityFolder.TRASH.equals(swipes.right_type) ? ItemTouchHelper.RIGHT : 0));
|
||||
|
||||
if (message.uid == null && message.accountProtocol == EntityAccount.TYPE_IMAP)
|
||||
return 0;
|
||||
|
||||
if (message.folderReadOnly)
|
||||
return 0;
|
||||
|
||||
TupleAccountSwipes swipes = accountSwipes.get(message.account);
|
||||
if (swipes == null)
|
||||
return 0;
|
||||
|
||||
if (message.accountProtocol != EntityAccount.TYPE_IMAP)
|
||||
return makeMovementFlags(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT);
|
||||
|
||||
|
@ -1999,6 +2006,18 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
return;
|
||||
}
|
||||
|
||||
if (message.uid == null &&
|
||||
message.accountProtocol == EntityAccount.TYPE_IMAP &&
|
||||
EntityFolder.DRAFTS.equals(message.folderType)) {
|
||||
boolean right = EntityFolder.TRASH.equals(swipes.right_type);
|
||||
boolean left = EntityFolder.TRASH.equals(swipes.left_type);
|
||||
swipes = new TupleAccountSwipes();
|
||||
swipes.swipe_right = (right ? EntityMessage.SWIPE_ACTION_DELETE : null);
|
||||
swipes.right_type = null;
|
||||
swipes.swipe_left = (left ? EntityMessage.SWIPE_ACTION_DELETE : null);
|
||||
swipes.left_type = null;
|
||||
}
|
||||
|
||||
if (message.accountProtocol != EntityAccount.TYPE_IMAP) {
|
||||
if (swipes.swipe_right == null)
|
||||
swipes.swipe_right = EntityMessage.SWIPE_ACTION_SEEN;
|
||||
|
@ -2123,6 +2142,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
return;
|
||||
}
|
||||
|
||||
if (message.uid == null &&
|
||||
message.accountProtocol == EntityAccount.TYPE_IMAP &&
|
||||
EntityFolder.DRAFTS.equals(message.folderType) &&
|
||||
EntityFolder.TRASH.equals(actionType)) {
|
||||
action = EntityMessage.SWIPE_ACTION_DELETE;
|
||||
actionType = null;
|
||||
}
|
||||
|
||||
Log.i("Swiped dir=" + direction + " message=" + message.id);
|
||||
|
||||
if (EntityMessage.SWIPE_ACTION_ASK.equals(action)) {
|
||||
|
|
Loading…
Reference in a new issue