Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various API issues: getToastList doesn't provide results, closeToast doesn't work #3

Open
Herrie82 opened this issue Jan 24, 2024 · 3 comments

Comments

@Herrie82
Copy link

Herrie82 commented Jan 24, 2024

After creating Toasts with a luna-send call, they will not appear in the getToastList call.

Steps to reproduce:

  1. 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"}

  1. 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.

@Herrie82
Copy link
Author

@Herrie82
Copy link
Author

Herrie82 commented Jan 25, 2024

Seems that getToastList https://github.com/webosose/notificationmgr/blob/master/src/NotificationService.cpp#1975 and closeToast look into the history db8 kind (

History::instance()->deleteMessage("timestamp", timestamp);
) 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.

@Heeam-Shin
Copy link

@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": [
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants