Auto ignore type specific

pull/205/head
M66B 4 years ago
parent 62e700eb10
commit db7e88ba7b

@ -787,12 +787,16 @@ public interface DaoMessage {
" AND account IN (" + " AND account IN (" +
" SELECT id FROM account" + " SELECT id FROM account" +
" WHERE :folder IS NOT NULL" + " WHERE :folder IS NOT NULL" +
" OR :type IS NOT NULL" +
" OR id = :account" + " OR id = :account" +
" OR (:account IS NULL AND NOT account.notify))" + " OR (:account IS NULL AND NOT notify))" +
" AND folder IN (" + " AND folder IN (" +
" SELECT id FROM folder" + " SELECT id FROM folder" +
" WHERE (:folder IS NULL AND folder.unified) OR id = :folder)") " WHERE notify" +
int ignoreAll(Long account, Long folder); " AND (id = :folder" +
" OR (type = :type AND type <> '" + EntityFolder.OUTBOX + "')" +
" OR (:folder IS NULL AND :type IS NULL AND unified)))")
int ignoreAll(Long account, Long folder, String type);
@Query("UPDATE message SET ui_found = 1 WHERE id = :id AND NOT (ui_found IS 1)") @Query("UPDATE message SET ui_found = 1 WHERE id = :id AND NOT (ui_found IS 1)")
int setMessageFound(long id); int setMessageFound(long id);

@ -4078,16 +4078,19 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (notify_clear) { if (notify_clear) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("folder", folder); args.putLong("folder", folder);
args.putString("type", type);
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override @Override
protected Void onExecute(Context context, Bundle args) { protected Void onExecute(Context context, Bundle args) {
Long folder = args.getLong("folder"); Long folder = args.getLong("folder");
String type = args.getString("type");
if (folder < 0) if (folder < 0)
folder = null; folder = null;
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
db.message().ignoreAll(null, folder); db.message().ignoreAll(null, folder, type);
return null; return null;
} }

@ -191,9 +191,9 @@ public class ServiceUI extends IntentService {
DB db = DB.getInstance(this); DB db = DB.getInstance(this);
int cleared; int cleared;
if (group < 0) if (group < 0)
cleared = db.message().ignoreAll(null, -group); cleared = db.message().ignoreAll(null, -group, null);
else else
cleared = db.message().ignoreAll(group == 0 ? null : group, null); cleared = db.message().ignoreAll(group == 0 ? null : group, null, null);
EntityLog.log(this, EntityLog.Type.Notification, EntityLog.log(this, EntityLog.Type.Notification,
"Notify clear group=" + group + " cleared=" + cleared); "Notify clear group=" + group + " cleared=" + cleared);
} }

Loading…
Cancel
Save