mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 11:25:13 +01:00
Added notification action hide
This commit is contained in:
@@ -54,9 +54,10 @@ public class ServiceUI extends IntentService {
|
||||
static final int PI_REPLY_DIRECT = 6;
|
||||
static final int PI_FLAG = 7;
|
||||
static final int PI_SEEN = 8;
|
||||
static final int PI_SNOOZE = 9;
|
||||
static final int PI_IGNORED = 10;
|
||||
static final int PI_THREAD = 11;
|
||||
static final int PI_HIDE = 9;
|
||||
static final int PI_SNOOZE = 10;
|
||||
static final int PI_IGNORED = 11;
|
||||
static final int PI_THREAD = 12;
|
||||
|
||||
public ServiceUI() {
|
||||
this(ServiceUI.class.getName());
|
||||
@@ -139,6 +140,11 @@ public class ServiceUI extends IntentService {
|
||||
onSeen(id);
|
||||
break;
|
||||
|
||||
case "hide":
|
||||
cancel(group, id);
|
||||
onHide(id);
|
||||
break;
|
||||
|
||||
case "snooze":
|
||||
cancel(group, id);
|
||||
onSnooze(id);
|
||||
@@ -379,6 +385,25 @@ public class ServiceUI extends IntentService {
|
||||
}
|
||||
}
|
||||
|
||||
private void onHide(long id) {
|
||||
DB db = DB.getInstance(this);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message == null)
|
||||
return;
|
||||
|
||||
db.message().setMessageSnoozed(message.id, Long.MAX_VALUE);
|
||||
db.message().setMessageUiIgnored(message.id, true);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
private void onSnooze(long id) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
int notify_snooze_duration = prefs.getInt("default_snooze", 1);
|
||||
|
||||
Reference in New Issue
Block a user