mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 14:46:31 +02:00
Added message importance/rule
This commit is contained in:
@@ -100,6 +100,7 @@ public class EntityRule {
|
||||
static final int TYPE_NOOP = 10;
|
||||
static final int TYPE_KEYWORD = 11;
|
||||
static final int TYPE_HIDE = 12;
|
||||
static final int TYPE_IMPORTANCE = 13;
|
||||
|
||||
static final String ACTION_AUTOMATION = BuildConfig.APPLICATION_ID + ".AUTOMATION";
|
||||
static final String EXTRA_RULE = "rule";
|
||||
@@ -306,6 +307,8 @@ public class EntityRule {
|
||||
return onActionSnooze(context, message, jaction);
|
||||
case TYPE_FLAG:
|
||||
return onActionFlag(context, message, jaction);
|
||||
case TYPE_IMPORTANCE:
|
||||
return onActionImportance(context, message, jaction);
|
||||
case TYPE_KEYWORD:
|
||||
return onActionKeyword(context, message, jaction);
|
||||
case TYPE_MOVE:
|
||||
@@ -495,6 +498,19 @@ public class EntityRule {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean onActionImportance(Context context, EntityMessage message, JSONObject jargs) throws JSONException {
|
||||
Integer importance = jargs.getInt("value");
|
||||
if (importance == EntityMessage.PRIORITIY_NORMAL)
|
||||
importance = null;
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
db.message().setMessageImportance(message.id, importance);
|
||||
|
||||
message.importance = importance;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean onActionKeyword(Context context, EntityMessage message, JSONObject jargs) throws JSONException {
|
||||
String keyword = jargs.getString("keyword");
|
||||
if (TextUtils.isEmpty(keyword)) {
|
||||
|
||||
Reference in New Issue
Block a user