Onesignal-ios-sdk: Can't disable InApp Alert.

Created on 5 Apr 2017  路  3Comments  路  Source: OneSignal/OneSignal-iOS-SDK

The problem should be this line

https://github.com/OneSignal/OneSignal-iOS-SDK/blob/master/iOS_SDK/OneSignalSDK/Source/OneSignal.m#L396

instead of

if (inAppAlertsPassed || inAppAlertsPassed) {

should be

if(inAppAlertsPassed || inFocusDisplayPassed) {

but there is another problem.
if the execution does not enter in this if block, there is no else case for if(inAppAlertsPassed || inFocusDisplayPassed) { and default value is to display the InApp alert.

It would be nice to have some Unit tests for this.

P.S. also they are displayed twice

Medium Priority

All 3 comments

Workaround is to set the value explicitly after init

[OneSignal setInFocusDisplayType:OSNotificationDisplayTypeNone];

@ogres Thanks for the details. Just fixed this with commit 301338eb2695f7d0090a40e5ad98fe7b72802021 and added a unit test too.

You can actually call the following instead as inFocusDisplayType is a static property on the OneSignal class.

OneSignal.inFocusDisplayType = OSNotificationDisplayTypeNone;

It can also be called anytime before or after OneSignal initWithLaunchOptions.

I am not sure I understand your P.S. comment "also they are displayed twice". Are you seeing the alert 2 times in your app? Are you also displaying your own alert from a open / received event?

Thanks.

@ogres Fix released in 2.5.2.

Was this page helpful?
0 / 5 - 0 ratings