Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cannot access OneSignal.User.getTags() from Angular SDK #44

Open
akhileshptp opened this issue Feb 16, 2024 · 0 comments
Open

[Bug]: Cannot access OneSignal.User.getTags() from Angular SDK #44

akhileshptp opened this issue Feb 16, 2024 · 0 comments

Comments

@akhileshptp
Copy link

What happened?

I am using the Angular SDK from one-signal (v11). It allows me to addTags but when I try to access the method to getTags, it says the method is not available on User object [getTags is undefined]. On checking the declaration file, it seems that the method is not exposed from the package. If I try to access it from the console on the web-page, I am able to get the tags then.

import { OneSignal } from 'onesignal-ngx';
export class OneSignalSDKService {

  constructor(private oneSignal: OneSignalModule) {} 
  getMarketingPushNotificationState(): boolean {
      const tags = this.oneSignal.User.getTags();  // throws error at this line
      return (tags?.someValue == 'true');
  }

I have made sure that OneSignal initialization is already done and there are values in this.oneSignal and this.oneSignal.User.
I am also able to call the methods this.oneSignal.User.addTag() and this.oneSignal.User.addTags() with proper params.

What browsers are you seeing the problem on?

Firefox, Chrome (Chromium), Safari, Microsoft Edge

What operating system are you running?

Windows 10

Steps to reproduce?

1. Use `import { OneSignal } from 'onesignal-ngx';` in any angular app and call the init method with a valid app id.
2. Try to get the tags from the OneSignal object (inject as dependency in constructor as shown in the code above) this.oneSignal.User.getTags();

What did you expect to happen?

I should be able to get the list of tags and their values through that method. The method should be exposed from the declaration file of the npm package.

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant