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);
|
args.putLong("id", id);
|
||||||
|
|
||||||
// Build pending intents
|
// Build pending intents
|
||||||
Intent thread = new Intent(context, ActivityView.class);
|
PendingIntent piContent;
|
||||||
thread.setAction("thread:" + message.thread);
|
if (notify_remove) {
|
||||||
thread.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
Intent thread = new Intent(context, ServiceUI.class);
|
||||||
thread.putExtra("account", message.account);
|
thread.setAction("ignore:" + message.id);
|
||||||
thread.putExtra("id", message.id);
|
thread.putExtra("view", true);
|
||||||
PendingIntent piContent = PendingIntent.getActivity(
|
piContent = PendingIntent.getService(context, ServiceUI.PI_THREAD, thread, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
context, ActivityView.REQUEST_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);
|
Intent ignore = new Intent(context, ServiceUI.class).setAction("ignore:" + message.id);
|
||||||
PendingIntent piIgnore = PendingIntent.getService(context, ServiceUI.PI_IGNORED, ignore, PendingIntent.FLAG_UPDATE_CURRENT);
|
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));
|
swBadge.setChecked(prefs.getBoolean("badge", true));
|
||||||
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
|
swUnseenIgnored.setChecked(prefs.getBoolean("unseen_ignored", false));
|
||||||
swNotifySummary.setChecked(prefs.getBoolean("notify_summary", false));
|
swNotifySummary.setChecked(prefs.getBoolean("notify_summary", false));
|
||||||
|
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
|
||||||
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
|
swNotifyPreview.setChecked(prefs.getBoolean("notify_preview", true));
|
||||||
swWearablePreview.setChecked(prefs.getBoolean("wearable_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);
|
cbNotifyActionSeen.setChecked(prefs.getBoolean("notify_seen", true) || !pro);
|
||||||
cbNotifyActionSnooze.setChecked(prefs.getBoolean("notify_snooze", false) || !pro);
|
cbNotifyActionSnooze.setChecked(prefs.getBoolean("notify_snooze", false) || !pro);
|
||||||
|
|
||||||
swNotifyRemove.setChecked(prefs.getBoolean("notify_remove", true));
|
|
||||||
swBiometricsNotify.setChecked(prefs.getBoolean("biometrics_notify", false));
|
swBiometricsNotify.setChecked(prefs.getBoolean("biometrics_notify", false));
|
||||||
|
|
||||||
swLight.setChecked(prefs.getBoolean("light", 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_SEEN = 8;
|
||||||
static final int PI_SNOOZE = 9;
|
static final int PI_SNOOZE = 9;
|
||||||
static final int PI_IGNORED = 10;
|
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() {
|
public ServiceUI() {
|
||||||
this(ServiceUI.class.getName());
|
this(ServiceUI.class.getName());
|
||||||
|
@ -139,7 +140,8 @@ public class ServiceUI extends IntentService {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "ignore":
|
case "ignore":
|
||||||
onIgnore(id);
|
boolean view = intent.getBooleanExtra("view", false);
|
||||||
|
onIgnore(id, view);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "wakeup":
|
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);
|
DB db = DB.getInstance(this);
|
||||||
try {
|
try {
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
|
|
||||||
EntityMessage message = db.message().getMessage(id);
|
message = db.message().getMessage(id);
|
||||||
if (message == null)
|
if (message == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -355,6 +359,15 @@ public class ServiceUI extends IntentService {
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
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) {
|
private void onWakeup(long id) {
|
||||||
|
|
Loading…
Reference in New Issue