pushy / pushy-flutter

The official Pushy SDK for Flutter apps.
Apache License 2.0
21 stars 19 forks source link

Unable to turn off notifications with Pushy.toggleNotifications(false) and Pushy.toggleFCM(false) #27

Closed yixiaoyx closed 3 years ago

yixiaoyx commented 3 years ago

I need to stop the notifications in the app when a user logout. I have these calls in my logout method:

Pushy.toggleFCM(false);
Pushy.toggleNotifications(false);

And according to the logs these methods indeed get called:

2021-01-27 13:16:12.208 29530-29530/[package.name] D/Pushy: Stop requested
2021-01-27 13:16:12.525 29530-2935/[package.name] D/Pushy: Connection lost
2021-01-27 13:16:12.525 29530-2935/[package.name] D/Pushy: Notifications have been disabled by the app

However after this, when I send a further notification from the Pushy dashboard, I still received it on the phone, which means the notification was not turned off. Please advice how I can toggle the notification off. Thanks!

pushy commented 3 years ago

Hi @yixiaoyx , Thanks for reporting this issue.

We've been able to reproduce the bug which occurs when FCM fallback was previously enabled, yet notifications have been toggled off via Pushy.toggleNotifications(false). To apply the fix, please follow these steps:

1) Please edit the pubspec.yaml in the root directory of your project and update the plugin version referenced to the following:

pushy_flutter: 1.1.9

2) Run flutter pub get to fetch the new version.

3) Run your app and observe whether both the Pushy SDK and Firebase are able to register successfully and receive notifications.

yixiaoyx commented 3 years ago

Thanks! It works with the new version.