Steffaan / cordova-plugin-local-notifications

Cordova Local Notifications Plugin
Apache License 2.0
31 stars 38 forks source link

Time in notification with progress bar get reseted after notification update #2

Closed hordesalik closed 5 years ago

hordesalik commented 5 years ago

Android 8.1 Cordova 8.0.0 Cordova Android 7.1.0

When I'm creating notification with progressBar, there is a timer appears near the notification title. But when I'm updating progress bar value it get set to 00:00 and counter starts again. You can try next snippet:

cordova.plugins.notification.local.schedule({
            id: 1,
            channel: 'progress',
            title: 'Downloading...',
            text: 'File name',
            sound: false,
            vibrate: false,
            foreground: false,
            progressBar: {value: 0},
        });

        for (var i = 1; i <= 10; i++) {
            (function (i) {
                setTimeout(function () {
                    cordova.plugins.notification.local.update({
                        id: 1,
                        progressBar: {value: i * 10},
                    })
                }, i * 3000);
            })(i);
        }

It was working properly before fix #1

Steffaan commented 5 years ago

Pass the property channel inside your update payload and it should work fine. Since the plugin now supports multiple channels, it's fallback is to use the default channel name if no channel name is given.

Let me know if it works.

hordesalik commented 5 years ago

Nope, it didn't help

hordesalik commented 5 years ago

Hi @Steffaan Any progress or info here?

Steffaan commented 5 years ago

Fixed in commit https://github.com/Steffaan/cordova-plugin-local-notifications/commit/27687fd5c87b89bb993912b7df7053b9c9ee2e63 and merged to master.