OneSignal push notification alert appears even when disabled

Hello everyone. I use OneSignal as a service for Push notifications. Strange thing happens when app is in foreground mode. Default alert box with incoming Push notification appears if I disabled it previously by running:

 this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);

So this is what happens: When I launch app for the first time from Xcode, everything works well. Alert box doesn’t appear when notification is received and handleNotificationReceived is called, what is expected.

When I close the app and open it again, if I send new notification, alert box will appear and call handleNotificationReceived and handleNotificationOpened what is not expected at all because I disabled alert when calling this line of code:

 this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);

So the app works well only once, when opened for the first time after fresh installation through Xcode.

Here is the code I call on every app startup, in app.component.ts:

initializePushNotifs() {
    this.oneSignal.startInit('0000', '0000');

    this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);

    this.oneSignal.handleNotificationReceived().subscribe(data => {
      this.presentNoConnectionAlert('Received', 'Received', 'Received');
    });

    this.oneSignal.handleNotificationOpened().subscribe(data => {
      this.presentNoConnectionAlert('Opened', 'Opened', 'Opened');
    });

    this.oneSignal.endInit();
  }

Anyone knows or can point out what is the issue.

Thanks in advance

I forgot to mention that this problem appears on iOS only, it looks like that iOS is somehow overriding my configuration and sets this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert);
even though I set it to this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);

Anyone got any idea what could be causing this behavior?

Thanks

The issue is fixed after downgrading to 2.7.0 version of onesignal-cordova-plugin so the bug still persists in 2.8.0 and 2.8.1 versions.