Cancel send improvements

pull/197/head
M66B 4 years ago
parent 3a25f87d06
commit b11ef63ab6

@ -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;

@ -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();

Loading…
Cancel
Save