polymerfire
polymerfire copied to clipboard
Subscribed users are not being unsubscribed
Description
Unsubscribing from the messaging is not working.
I've followed the https://github.com/Polymer/polycasts/tree/master/ep59-firebase-messaging polycast to create a subscription flow. Added the unsubscription in the else
block as follows:
toggleSubscription: function () {
var requestPermission = this.$.subscribe.checked;
if (requestPermission) {
this.$.messaging.requestPermission().then(() => {
console.log('user subscribed successfully!');
}, (err) => {
console.log('user subscribe failed :(', err);
});
} else {
this.$.userToken.destroy();
console.log('user rejected permission');
}
},
Token gets deleted as expected when toggling the switch, but when I refresh the browser the user token gets registered again. Browser somehow remembers the permission acceptance from the user in the first place and proceeds without asking for the permission again
Expected outcome
During page load, it should not take the previous permission acceptance from the user! The state of acceptance shall be unset
when the user has explicitly unsubscribed.
Actual outcome
the user is getting subscribed everytime I refresh the page
Steps to reproduce
Explained above in the description
Browsers Affected
- [x] Firefox