Open Herrie82 opened 6 months ago
@jaeyoonjung @Heeam-Shin @nilaysrivastava-24 ^
Seems that getToastList https://github.com/webosose/notificationmgr/blob/master/src/NotificationService.cpp#1975 and closeToast look into the history db8 kind (https://github.com/webosose/notificationmgr/blob/b4060e77a6fccb87e2a4f7d7ab75cda7e574befd/src/NotificationService.cpp#L1455) and will only work when the Toasts are created with "persistent": true. Which isn't clear from the documentation and we believe the implementation is not fully correct here for getToastList and closeToast and/or the documentation is not complete.
@Herrie82,
It's not a bug.
To save a toast notification into the database, you have to call the createToast
method with "persistent":true
. Please refer to the documentation below.
com.webos.notification/createToast | webOS OSE website
The following sample code creates toasts on two displays and calls getToastList
on each display.
root@raspberrypi4-64:~# luna-send -n 1 -f -a com.webos.app.test luna://com.webos.notification/createToast '{"message":"hello world2","displayId": 1, "persistent":true}'
{
"returnValue": true,
"toastId": "com.webos.app.test-1707137509625"
}
root@raspberrypi4-64:~# luna-send -n 1 -f -a com.webos.app.notification luna://com.webos.notification/getToastList '{"displayId": 0}'
{
"returnValue": true,
"toastInfo": [
]
}
root@raspberrypi4-64:~# luna-send -n 1 -f -a com.webos.app.notification luna://com.webos.notification/getToastList '{"displayId": 1}'
{
"returnValue": true,
"toastInfo": [
{
"iconPath": "/usr/palm/notificationmgr/images/toast-notification-icon.png",
"sourceId": "com.webos.app.test",
"displayId": 1,
"readStatus": false,
"message": "hello world2",
"schedule": {
"expire": 1709729509
},
"iconUrl": "file:///usr/palm/notificationmgr/images/toast-notification-icon.png",
"user": "guest",
"type": "standard",
"action": {
},
"toastId": "com.webos.app.test-1707137509625",
"timestamp": "1707137509625",
"isSysReq": false,
"title": ""
}
]
}
root@raspberrypi4-64:~# luna-send -n 1 -f -a com.webos.app.notification luna://com.webos.notification/getToastList '{"displayId": 0}'
{
"returnValue": true,
"toastInfo": [
]
}
root@raspberrypi4-64:~# luna-send -n 1 -f -a com.webos.app.test luna://com.webos.notification/closeToast '{ "toastId":"com.webos.app.test-1707137509625" }'
{
"returnValue": true
}
root@raspberrypi4-64:~# luna-send -n 1 -f -a com.webos.app.notification luna://com.webos.notification/getToastList '{"displayId": 0}'
{
"returnValue": true,
"toastInfo": [
]
}
root@raspberrypi4-64:~# luna-send -n 1 -f -a com.webos.app.notification luna://com.webos.notification/getToastList '{"displayId": 1}'
{
"returnValue": true,
"toastInfo": [
]
}
After creating Toasts with a luna-send call, they will not appear in the getToastList call.
Steps to reproduce:
Create toast with luna-send
luna-send -n 1 -a com.webos.app.notification luna://com.webos.notification/createToast '{"message":"Test toast"}'
{"returnValue":true,"toastId":"com.webos.app.notification-1706114641627"}
Test getToastList call with luna-send:
luna-send -n 1 -a com.webos.app.notification luna://com.webos.notification/getToastList '{"displayId":0}' {"returnValue":true,"toastInfo":[]}
Expected details of the Toasts as per API: https://www.webosose.org/docs/reference/ls2-api/com-webos-notification/#gettoastlist
Same for the closeToast call. Trying with both sourceId or toastId gives returnvalue "true", however the Toasts are not being closed.