From 565ad98db622bc580341d2f377369a92dcec04cc Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 21 Oct 2019 16:56:55 +0200 Subject: [PATCH] Set wearable dismissal ID --- app/src/main/java/eu/faircode/email/Core.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 07d36dbf8e..81082ea53b 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -2876,8 +2876,9 @@ class Core { ContactInfo info = messageContact.get(message); // Build arguments + long id = (message.content ? message.id : -message.id); Bundle args = new Bundle(); - args.putLong("id", message.content ? message.id : -message.id); + args.putLong("id", id); // Build pending intents Intent thread = new Intent(context, ActivityView.class); @@ -3076,10 +3077,6 @@ class Core { wactions.add(actionSnooze.build()); } - if (wactions.size() > 0) - mbuilder.extend(new NotificationCompat.WearableExtender() - .addActions(wactions)); - if (message.content && notify_preview) { // Wearables StringBuilder sb = new StringBuilder(); @@ -3124,6 +3121,12 @@ class Core { mbuilder.setColorized(true); } + // https://developer.android.com/training/wearables/notifications + // https://developer.android.com/reference/android/app/Notification.WearableExtender + mbuilder.extend(new NotificationCompat.WearableExtender() + .addActions(wactions) + .setDismissalId(BuildConfig.APPLICATION_ID + ":" + id)); + notifications.add(mbuilder); }