Cancel send improvements

This commit is contained in:
M66B 2021-04-01 08:42:07 +02:00
parent 3a25f87d06
commit b11ef63ab6
2 changed files with 12 additions and 5 deletions

View File

@ -36,7 +36,6 @@ import androidx.lifecycle.LifecycleOwner;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -243,13 +242,12 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
static Long undoSend(long id, Context context) {
DB db = DB.getInstance(context);
// Cancel send
EntityOperation operation = db.operation().getOperation(id, EntityOperation.SEND);
if (operation != null)
if ("executing".equals(operation.state)) {
// Trigger update
db.message().setMessageUiBusy(id, new Date().getTime());
if ("executing".equals(operation.state))
return null;
} else
else
db.operation().deleteOperation(operation.id);
EntityMessage message;

View File

@ -7108,6 +7108,15 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
long id = args.getLong("id");
DB db = DB.getInstance(context);
// Cancel send operation
EntityOperation operation = db.operation().getOperation(id, EntityOperation.SEND);
if (operation != null)
if ("executing".equals(operation.state))
return null;
else
db.operation().deleteOperation(operation.id);
try {
db.beginTransaction();