|
|
@ -185,6 +185,9 @@ class Core {
|
|
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NotificationManager nm =
|
|
|
|
|
|
|
|
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
|
|
|
|
|
|
|
|
|
int retry = 0;
|
|
|
|
int retry = 0;
|
|
|
|
boolean group = true;
|
|
|
|
boolean group = true;
|
|
|
|
Log.i(folder.name + " executing operations=" + ops.size());
|
|
|
|
Log.i(folder.name + " executing operations=" + ops.size());
|
|
|
@ -202,6 +205,10 @@ class Core {
|
|
|
|
" group=" + group +
|
|
|
|
" group=" + group +
|
|
|
|
" retry=" + retry);
|
|
|
|
" retry=" + retry);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (EntityOperation.HEADERS.equals(op.name) ||
|
|
|
|
|
|
|
|
EntityOperation.RAW.equals(op.name))
|
|
|
|
|
|
|
|
nm.cancel(op.name + ":" + op.message, 1);
|
|
|
|
|
|
|
|
|
|
|
|
if (!Objects.equals(folder.id, op.folder))
|
|
|
|
if (!Objects.equals(folder.id, op.folder))
|
|
|
|
throw new IllegalArgumentException("Invalid folder=" + folder.id + "/" + op.folder);
|
|
|
|
throw new IllegalArgumentException("Invalid folder=" + folder.id + "/" + op.folder);
|
|
|
|
|
|
|
|
|
|
|
@ -487,6 +494,7 @@ class Core {
|
|
|
|
|
|
|
|
|
|
|
|
if (message != null &&
|
|
|
|
if (message != null &&
|
|
|
|
!EntityOperation.FETCH.equals(op.name) &&
|
|
|
|
!EntityOperation.FETCH.equals(op.name) &&
|
|
|
|
|
|
|
|
!EntityOperation.ATTACHMENT.equals(op.name) &&
|
|
|
|
!(ex instanceof IllegalArgumentException))
|
|
|
|
!(ex instanceof IllegalArgumentException))
|
|
|
|
db.message().setMessageError(message.id, op.error);
|
|
|
|
db.message().setMessageError(message.id, op.error);
|
|
|
|
|
|
|
|
|
|
|
@ -512,6 +520,8 @@ class Core {
|
|
|
|
(ex.getCause() instanceof BadCommandException ||
|
|
|
|
(ex.getCause() instanceof BadCommandException ||
|
|
|
|
ex.getCause() instanceof CommandFailedException /* NO */)) ||
|
|
|
|
ex.getCause() instanceof CommandFailedException /* NO */)) ||
|
|
|
|
MessageHelper.isRemoved(ex) ||
|
|
|
|
MessageHelper.isRemoved(ex) ||
|
|
|
|
|
|
|
|
EntityOperation.HEADERS.equals(op.name) ||
|
|
|
|
|
|
|
|
EntityOperation.RAW.equals(op.name) ||
|
|
|
|
EntityOperation.ATTACHMENT.equals(op.name) ||
|
|
|
|
EntityOperation.ATTACHMENT.equals(op.name) ||
|
|
|
|
(EntityOperation.ADD.equals(op.name) &&
|
|
|
|
(EntityOperation.ADD.equals(op.name) &&
|
|
|
|
EntityFolder.DRAFTS.equals(folder.type))) {
|
|
|
|
EntityFolder.DRAFTS.equals(folder.type))) {
|
|
|
@ -599,6 +609,18 @@ class Core {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ops.remove(op);
|
|
|
|
ops.remove(op);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int resid = context.getResources().getIdentifier(
|
|
|
|
|
|
|
|
"title_op_title_" + op.name,
|
|
|
|
|
|
|
|
"string",
|
|
|
|
|
|
|
|
context.getPackageName());
|
|
|
|
|
|
|
|
String title = (resid == 0 ? null : context.getString(resid));
|
|
|
|
|
|
|
|
if (title != null) {
|
|
|
|
|
|
|
|
NotificationCompat.Builder builder =
|
|
|
|
|
|
|
|
getNotificationError(context, "warning", title, ex);
|
|
|
|
|
|
|
|
nm.notify(op.name + ":" + op.message, 1, builder.build());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
retry++;
|
|
|
|
retry++;
|
|
|
|
if (retry < LOCAL_RETRY_MAX &&
|
|
|
|
if (retry < LOCAL_RETRY_MAX &&
|
|
|
|