Skip to content

Commit d2c223b

Browse files
jinliu9508AR Abdul Azeez
andcommitted
fix: IAM with NOT_EQUAL_TO trigger always shows up (#2509)
Co-authored-by: AR Abdul Azeez <[email protected]>
1 parent 00139a0 commit d2c223b

File tree

2 files changed

+1086
-4
lines changed

2 files changed

+1086
-4
lines changed

OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/triggers/impl/TriggerController.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ internal class TriggerController(
5959
}
6060

6161
val operatorType = trigger.operatorType
62+
// If trigger is type of NOT_EQUAL_TO, true if only there exists a trigger with the same key and different value.
63+
// In that case, do not return early so it will evaluate later.
6264
val deviceValue =
6365
triggers[trigger.property]
64-
?: // If we don't have a local value for this trigger, can only be true in two cases;
65-
// 1. If operator is Not Exists
66-
// 2. Checking to make sure the key doesn't equal a specific value, other than null of course.
67-
return if (operatorType == Trigger.OSTriggerOperator.NOT_EXISTS) true else operatorType == Trigger.OSTriggerOperator.NOT_EQUAL_TO && trigger.value != null
66+
?: // If we don't have a local value for this trigger, can only be true if operator is Not Exists
67+
return operatorType == Trigger.OSTriggerOperator.NOT_EXISTS
6868

6969
// We have local value at this point, we can evaluate existence checks
7070
if (operatorType == Trigger.OSTriggerOperator.EXISTS) {

0 commit comments

Comments
 (0)