Skip to content

Commit 5627f10

Browse files
notif: Enable autoCancel to dismiss notifications when tapped
Set autoCancel flag for notifications, ensuring they automatically disappear from the panel when tapped. See: https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setAutoCancel(boolean) Also, zulip-mobile does this already: https://github.com/zulip/zulip-mobile/blob/e352f563ecf2fa9b09b688d5a65b6bc89b0358bc/android/app/src/main/java/com/zulipmobile/notifications/NotificationUiManager.kt#L353
1 parent 9d6f5a8 commit 5627f10

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/notifications/display.dart

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class NotificationDisplayManager {
142142
// TODO this doesn't set the Intent flags we set in zulip-mobile; is that OK?
143143
// (This is a legacy of `flutter_local_notifications`.)
144144
),
145+
autoCancel: true,
145146
);
146147

147148
await ZulipBinding.instance.androidNotificationHost.notify(

test/notifications/display_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void main() {
132132
..groupKey.equals(expectedGroupKey)
133133
..isGroupSummary.isNull()
134134
..inboxStyle.isNull()
135-
..autoCancel.isNull()
135+
..autoCancel.equals(true)
136136
..contentIntent.which((it) => it.isNotNull()
137137
..requestCode.equals(expectedId)
138138
..flags.equals(expectedIntentFlags)

0 commit comments

Comments
 (0)