Cancel notifications on ignore with group

This commit is contained in:
M66B 2023-05-14 09:04:26 +02:00
parent 98bda4fd77
commit 32909d157b
4 changed files with 8 additions and 3 deletions

View File

@ -1980,8 +1980,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
} else if (action.startsWith("thread")) {
long id = Long.parseLong(action.split(":", 2)[1]);
boolean ignore = intent.getBooleanExtra("ignore", false);
long group = intent.getLongExtra("group", -1L);
if (ignore)
ServiceUI.ignore(this, id);
ServiceUI.ignore(this, id, group);
intent.putExtra("id", id);
onViewThread(intent);

View File

@ -5668,6 +5668,7 @@ class Core {
// Build pending intents
Intent thread = new Intent(context, ActivityView.class);
thread.setAction("thread:" + message.id);
thread.putExtra("group", group);
thread.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
thread.putExtra("account", message.account);
thread.putExtra("folder", message.folder);

View File

@ -6220,6 +6220,7 @@ public class FragmentCompose extends FragmentBase {
Intent thread = new Intent(v.getContext(), ActivityView.class);
thread.setAction("thread:" + message.id);
// No group
thread.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
thread.putExtra("account", message.account);
thread.putExtra("folder", message.folder);

View File

@ -157,6 +157,7 @@ public class ServiceUI extends IntentService {
break;
case "ignore":
cancel(group, id);
onIgnore(id);
break;
@ -520,10 +521,11 @@ public class ServiceUI extends IntentService {
}
}
static void ignore(Context context, long id) {
static void ignore(Context context, long id, long group) {
try {
Intent ignore = new Intent(context, ServiceUI.class)
.setAction("ignore:" + id);
.setAction("ignore:" + id)
.putExtra("group", group);
context.startService(ignore);
} catch (Throwable ex) {
Log.e(ex);