OneSignal / OneSignal-Cordova-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: addEventListener is triggering a few of times

lautaro-corfield opened this issue · comments

What happened?

I have the following code:
In app.component.ts:
this.platform.ready().then(async () => { this.oneSignalNotificationService.bindNotifications(); });

In onesignal.service.ts:
bindNotifications(): void { OneSignal.initialize(environment.onesignalAppId); console.log("bindNotifications"); OneSignal.Notifications.addEventListener('click', async (e) => { console.log("eventListener"); //Something else }); }
bindNotifications is displayed only once per console but eventListener is executed more than 30 times.

Steps to reproduce?

1. Build application
2. Initialize the application
3. Send notification
4. Click on the notification

What did you expect to happen?

bindNotifications to be displayed only once and eventListener to be displayed only once for each time a notification is clicked.

OneSignal Cordova SDK version

5.0.3

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

Thanks for your patience, @lautaro-corfield! We're woking on reproducing this and investigating further.