Skip to content

Commit 32ed102

Browse files
committed
fix: NotEqualTo trigger no longer matches non-existent properties
- Changes the behavior of trigger evaluation when a property doesn't exist. - Previously, a trigger with NotEqualTo operator would return true for non-existent properties (e.g., subscription_type != "premium" would match users without any subscription_type set). - Now, only the NotExists operator returns true for non-existent properties. NotEqualTo requires the property to exist with a different value. - This provides stricter trigger matching where NotEqualTo only matches users who have explicitly set a value that differs from the trigger value.
1 parent f731bc5 commit 32ed102

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

iOS_SDK/OneSignalSDK/OneSignalInAppMessages/Controller/OSTriggerController.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,9 @@ - (BOOL)messageMatchesTriggers:(OSInAppMessageInternal *)message {
181181
- (BOOL)evaluateTrigger:(OSTrigger *)trigger forMessage:(OSInAppMessageInternal *)message {
182182
if (!self.triggers[trigger.property] && [trigger.kind isEqualToString:OS_DYNAMIC_TRIGGER_KIND_CUSTOM]) {
183183
// The value doesn't exist
184-
185-
// The condition for this trigger is true since the value doesn't exist
186-
// Either loop to the next condition, or return true if we are the last condition
187-
return trigger.operatorType == OSTriggerOperatorTypeNotExists ||
188-
(trigger.value && trigger.operatorType == OSTriggerOperatorTypeNotEqualTo);
184+
185+
// Only NotExists operator should return true for non-existent values
186+
return trigger.operatorType == OSTriggerOperatorTypeNotExists;
189187

190188
} else if (trigger.operatorType == OSTriggerOperatorTypeExists) {
191189
return true;

0 commit comments

Comments
 (0)