OneSignal-Flutter-SDK
OneSignal-Flutter-SDK copied to clipboard
[Bug]: removeSms and removeEmail do not work after logout user
What happened?
I'm using OneSignal 5.1.0 to subscribe users and get data in my flutter app. When I use other session to save / remove data, the removeEmail and removeSms don't remove the subscriptions. Testing with the rest requests, everything works fine, but not using the api call.
My flutter doctor: [✓] Flutter (Channel stable, 2.10.5, on macOS 14.2.1 23C71 darwin-arm, locale en-PT) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.1) [✓] Connected device (3 available)
Api methods called: OneSignal.User.removeSms(_smsNumber); OneSignal.User.removeEmail(_email);
Steps to reproduce?
OneSignal 5.1.0
My flutter doctor:
[✓] Flutter (Channel stable, 2.10.5, on macOS 14.2.1 23C71 darwin-arm, locale en-PT)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] Connected device (3 available)
Steps:
- initialize OneSignal in app;
- start a user sesssion and add email, sms and tags to subscription (calls login and then the methods to add email, sms and tags);
- end session in app -> call logout() in onesignal api;
- start new session with same user and change preferences to unsubscibe emails and sms (calls removeSms and removeEmail) -> no error is reported but the email and sms records are not removed
What did you expect to happen?
I expected the api to remove email and sms data from onesignal.
OneSignal Flutter SDK version
5.1.0
Which platform(s) are affected?
- [X] iOS
- [X] Android
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Hi @inesga,
start new session with same user and change preferences to unsubscibe emails and sms (calls removeSms and removeEmail) -> no error is reported but the email and sms records are not removed
When you say "start new session with same user", are you logging the user back in before calling removeSms and removeEmail?
If not, this is expected behavior. After you call logout, that user is no longer in the SDK and cannot be operated on.
When I say "start new session with same user" I do call login. The api methods are called this order:
- login
- add email
- add sms
- add tags
- ...
- logout
- login (again)
- (change user settings)
- removeEmail
- removeSms
- removeTags
If I remove email and sms in the first session (before point 6), everything goes well, but when I logout and login again, noting happens. This also happens if I login with the same user in other phone.
Hi @inesga thank you for the additional details. I will try to reproduce with those steps and reach out with any questions.
This is happening 100% of the time for you with these steps?
This is happening 100% of the time for you with these steps?
I suppose so, yes.