From ea0144ea34776ffe534bca12ef097f0af1b1006d Mon Sep 17 00:00:00 2001 From: rajveermalviya Date: Wed, 19 Jun 2024 18:45:48 +0530 Subject: [PATCH 1/2] notif: Enable autoCancel flag for summary notification On Android 11 and lower, if autoCancel is not specified, the summary notification may linger even after all child notifications have been opened and cleared. --- lib/notifications/display.dart | 4 ++++ test/notifications/display_test.dart | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/notifications/display.dart b/lib/notifications/display.dart index acbf15012a..e70f5e90a2 100644 --- a/lib/notifications/display.dart +++ b/lib/notifications/display.dart @@ -158,6 +158,10 @@ class NotificationDisplayManager { inboxStyle: InboxStyle( // TODO(#570) Show organization name, not URL summaryText: data.realmUri.toString()), + // On Android 11 and lower, if autoCancel is not specified, + // the summary notification may linger even after all child + // notifications have been opened and cleared. + autoCancel: true, ); } diff --git a/test/notifications/display_test.dart b/test/notifications/display_test.dart index 907ab3991f..5c352123d3 100644 --- a/test/notifications/display_test.dart +++ b/test/notifications/display_test.dart @@ -150,7 +150,7 @@ void main() { ..isGroupSummary.equals(true) ..inboxStyle.which((it) => it.isNotNull() ..summaryText.equals(data.realmUri.toString())) - ..autoCancel.isNull() + ..autoCancel.equals(true) ..contentIntent.isNull() ]); } From 8bf700c6733299ed51919515eb7ac78f4747c62d Mon Sep 17 00:00:00 2001 From: Greg Price Date: Thu, 20 Jun 2024 12:43:24 -0700 Subject: [PATCH 2/2] notif [nfc]: Add TODO-android comment on autoCancel workaround --- lib/notifications/display.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/notifications/display.dart b/lib/notifications/display.dart index e70f5e90a2..54e8d18c19 100644 --- a/lib/notifications/display.dart +++ b/lib/notifications/display.dart @@ -158,9 +158,11 @@ class NotificationDisplayManager { inboxStyle: InboxStyle( // TODO(#570) Show organization name, not URL summaryText: data.realmUri.toString()), + // On Android 11 and lower, if autoCancel is not specified, // the summary notification may linger even after all child // notifications have been opened and cleared. + // TODO(android-12): cut this autoCancel workaround autoCancel: true, ); }