Skip to content

[Bug]: optedIn false after await for optIn() #721

@enricobenedos

Description

@enricobenedos

What happened?

We are trying to manage a flow in which we simply await for optIn() and the after we check if effectively optedIn.

optedIn is false after calling and awaiting optIn(), it becomes true after some time. So, what is the purpose to await the optIn() function?

Steps to reproduce?

static Future<bool> enableNotifications() async {
    await OneSignal.User.pushSubscription.optIn();

    return OneSignal.User.pushSubscription.optedIn == true;
  }

What did you expect to happen?

That simply after waiting for optIn() function the optedIn bool is true. It is the more natural behaviour.

It has no sense to await something that doesn't really finish as expected.

OneSignal Flutter SDK version

5.0.0

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions