OneSignal-Flutter-SDK
OneSignal-Flutter-SDK copied to clipboard
[Bug]: disablePush method is not working properly
What happened?
I'm calling OneSignal.shared.disablePush(true); method in logout function to disable the notifications.
but when i "turn off" the Internet" while method is executing it returns the below logs
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
and after completing the above method execution calling
OSDeviceState? state = await OneSignal.shared.getDeviceState(); method to check if user is subscribed.
state.subscribed which returns false
but in OneSignal console user still shows as "Subscribed / Active"
as we can see in the above logs the method is OneSignal.shared.disablePush(true); is failed
and user is not "OPTED-OUT" from the console.
is there any we can catch any error if OneSignal.shared.disablePush(true); fails
or any way to check if it's completed successfully in console also.
Steps to reproduce?
1.OneSignal.shared.disablePush(false); first enable notifications.
2. Turn off the internet.
3.await OneSignal.shared.disablePush(true); call this method.
4.wait to finish execution.
What did you expect to happen?
I'm expecting OneSignal.shared.disablePush(false) method to return any error / exception if the method is not executed successfully. and to make sure user is "OPTED-OUT" successfully in console.
OneSignal Flutter SDK version
3.3.2
Which platform(s) are affected?
- [X] iOS
- [X] Android
Relevant log output
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
E/OneSignal(20428): Failed PUT sync request with status code: -1 and response: null
E/OneSignal(20428): Error setting external user id for push with status code: -1 and message: null
Code of Conduct
- [X] I agree to follow this project's Code of Conduct