-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Inbox message list should be cleared when clicking an action button with foreground=false #2699
Description
Expected Behaviour
If I click an action button that's supposed to run in background, the list of messages in an "inbox" notification should be cleared (exactly as it happens when you click the notification itself, or if it's a foreground notification). If I receive a new notification for that inbox, the list should only display the new message.
The same happens with inline replies.
Actual Behaviour
I click an action button and the task runs in background. If I get a new notification for that inbox, the previous messages are still there. The same happens with inline replies.
Reproduce Scenario (including but not limited to)
Send a couple of notifications with "inbox" style including an action button with foreground=false. Click the action button. Send a new notification, the previous messages are still there.
I've checked the code and when you click the notification itself (or when the button has foreground=true), the list is dismissed from PushHandlerActivity. If the button is processed in background, this activity isn't started and the list isn't cleared.
Steps to Reproduce
1- Send 2 notifications using "style: 'inbox'" and including an action button with "foreground": false". Check that you see both messages in the notification.
2- Click the action button. The notification will be dismissed.
3- Send a new notification using "style: 'inbox'". Check that you see 3 messages in the notification, but you should only see the new one.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
I tested it in Android 8, but it probably affects all versions.
(Android) What device vendor (e.g. Samsung, HTC, Sony...)
I tested it in a Pixel XL device and in an emulator, both with Android 8.
Cordova CLI version and cordova platform version
cordova --version 8.0.0
cordova platform version android 7.1.2
Plugin version
cordova plugin version | grep phonegap-plugin-push 2.2.3
Sample Push Data Payload
data: {
title: 'John Smith',
body: 'First message',
style: 'inbox',
summaryText: 'There are %n% notifications',
"actions": [
{
"title": "EMAIL GUESTS",
"callback": "testAction",
"foreground": false
}
]
}
Sample Code that illustrates the problem
NA
Logs taken while reproducing problem
NA