OneSignal-Flutter-SDK icon indicating copy to clipboard operation
OneSignal-Flutter-SDK copied to clipboard

[Bug]: removeSms and removeEmail do not work after logout user

Open inesga opened this issue 1 year ago • 5 comments
trafficstars

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

inesga avatar Feb 21 '24 16:02 inesga

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.

nan-li avatar Feb 21 '24 17:02 nan-li

When I say "start new session with same user" I do call login. The api methods are called this order:

  1. login
  2. add email
  3. add sms
  4. add tags
  5. ...
  6. logout
  7. login (again)
  8. (change user settings)
  9. removeEmail
  10. removeSms
  11. 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.

inesga avatar Feb 21 '24 18:02 inesga

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?

nan-li avatar Feb 23 '24 07:02 nan-li

This is happening 100% of the time for you with these steps?

I suppose so, yes.

inesga avatar Feb 23 '24 09:02 inesga