mirror of https://github.com/M66B/FairEmail.git
Remove single message notification on tap
This commit is contained in:
parent
c45c74288e
commit
033a60b311
|
@ -2878,13 +2878,20 @@ class Core {
|
|||
args.putLong("id", id);
|
||||
|
||||
// Build pending intents
|
||||
Intent thread = new Intent(context, ActivityView.class);
|
||||
thread.setAction("thread:" + message.thread);
|
||||
thread.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
thread.putExtra("account", message.account);
|
||||
thread.putExtra("id", message.id);
|
||||
PendingIntent piContent = PendingIntent.getActivity(
|
||||
context, ActivityView.REQUEST_THREAD, thread, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent piContent;
|
||||
if (notify_remove) {
|
||||
Intent thread = new Intent(context, ServiceUI.class);
|
||||
thread.setAction("ignore:" + message.id);
|
||||
thread.putExtra("view", true);
|
||||
piContent = PendingIntent.getService(context, ServiceUI.PI_THREAD, thread, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
} else {
|
||||
Intent thread = new Intent(context, ActivityView.class);
|
||||
thread.setAction("thread:" + message.thread);
|
||||
thread.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
thread.putExtra("account", message.account);
|
||||
thread.putExtra("id", message.id);
|
||||
piContent = PendingIntent.getActivity(context, ActivityView.REQUEST_THREAD, thread, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
|
||||
Intent ignore = new Intent(context, ServiceUI.class).setAction("ignore:" + message.id);
|
||||
PendingIntent piIgnore = PendingIntent.getService(context, ServiceUI.PI_IGNORED, ignore, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
|
|
@ -362,6 +362,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
swBadge.setChecked(prefs.getBoolean("badge", true));
|
||||
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
|
||||
swNotifySummary.setChecked(prefs.getBoolean("notify_summary", false));
|
||||
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
|
||||
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
|
||||
swWearablePreview.setChecked(prefs.getBoolean("wearable_preview", true));
|
||||
|
||||
|
@ -375,7 +376,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
|||
cbNotifyActionSeen.setChecked(prefs.getBoolean("notify_seen", true) || !pro);
|
||||
cbNotifyActionSnooze.setChecked(prefs.getBoolean("notify_snooze", false) || !pro);
|
||||
|
||||
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
|
||||
swBiometricsNotify.setChecked(prefs.getBoolean("biometrics_notify", false));
|
||||
|
||||
swLight.setChecked(prefs.getBoolean("light", false));
|
||||
|
|
|
@ -50,7 +50,8 @@ public class ServiceUI extends IntentService {
|
|||
static final int PI_SEEN = 8;
|
||||
static final int PI_SNOOZE = 9;
|
||||
static final int PI_IGNORED = 10;
|
||||
static final int PI_WAKEUP = 11;
|
||||
static final int PI_THREAD = 11;
|
||||
static final int PI_WAKEUP = 12;
|
||||
|
||||
public ServiceUI() {
|
||||
this(ServiceUI.class.getName());
|
||||
|
@ -139,7 +140,8 @@ public class ServiceUI extends IntentService {
|
|||
break;
|
||||
|
||||
case "ignore":
|
||||
onIgnore(id);
|
||||
boolean view = intent.getBooleanExtra("view", false);
|
||||
onIgnore(id, view);
|
||||
break;
|
||||
|
||||
case "wakeup":
|
||||
|
@ -340,12 +342,14 @@ public class ServiceUI extends IntentService {
|
|||
}
|
||||
}
|
||||
|
||||
private void onIgnore(long id) {
|
||||
private void onIgnore(long id, boolean open) {
|
||||
EntityMessage message;
|
||||
|
||||
DB db = DB.getInstance(this);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
message = db.message().getMessage(id);
|
||||
if (message == null)
|
||||
return;
|
||||
|
||||
|
@ -355,6 +359,15 @@ public class ServiceUI extends IntentService {
|
|||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
if (open) {
|
||||
Intent thread = new Intent(this, ActivityView.class);
|
||||
thread.setAction("thread:" + message.thread);
|
||||
thread.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
thread.putExtra("account", message.account);
|
||||
thread.putExtra("id", message.id);
|
||||
startActivity(thread);
|
||||
}
|
||||
}
|
||||
|
||||
private void onWakeup(long id) {
|
||||
|
|
Loading…
Reference in New Issue