Steffaan / cordova-plugin-local-notifications

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

Android 10 update call adds actions multiple times #27

Closed tripflex closed 4 years ago

tripflex commented 4 years ago

Expected Behavior

Should only show 1 action button

Actual Behavior

On each .update call, another action button is added each time

Steps to Reproduce

Reproduce this issue; include code to reproduce, if relevant

const notification = {
    sticky: true,
    channel: 'abc123',
    vibrate: true,
    priority: 2,
    id: 123456,
    title: 'Testing Progress',
    text: "Running...",
    lockscreen: true,
    foreground: true,
    progressBar: {
        value: 0
    },
    actions: [{
        id: 'stopTest',
        title: 'STOP'
    }]
}
cordova.plugins.notification.local.schedule(notification)
const updateObject = {
    id: 123456,
    vibrate: false,
    sticky: true,
    channel: 'abc123',
    text: `${progress} so far`,
    progressBar: {
        value: progress
    }
}
cordova.plugins.notification.local.update(updateObject)

This also happens in the origin repo this version was forked from, in adb logcat i can see that the actions is the value that was originally set -- so maybe in newer version of Android is it for some reason adding a new button/action instead of just checking if one already exists or something?

tripflex commented 4 years ago

Well I guess that's the good thing about opening issues, while doing so I thought .. well maybe I should just pass an empty array for actions when calling update ... and sure enough, when I did, it resolves this issue.

Will need to test in older versions of Android to see if this removes that action/button, will re-open this ticket if it does.

Thanks for your fork of this lib, helped fix the vibrate not working (turning it off) and using the app icon! Yay!