diff --git a/CleverTapSDK/InApps/Matchers/CTEventAdapter.m b/CleverTapSDK/InApps/Matchers/CTEventAdapter.m index 301f551f..bf28a1d5 100644 --- a/CleverTapSDK/InApps/Matchers/CTEventAdapter.m +++ b/CleverTapSDK/InApps/Matchers/CTEventAdapter.m @@ -8,6 +8,7 @@ #import "CTEventAdapter.h" #import "CTConstants.h" +#import "CTUtils.h" static NSDictionary *systemPropToKey; @@ -96,6 +97,14 @@ - (CTTriggerValue *)propertyValueNamed:(NSString *)name { - (id)getActualPropertyValue:(NSString *)propertyName { id value = self.eventProperties[propertyName]; + + // Check if event properties name are normalized equal + for (NSString *key in self.eventProperties) { + if ([CTUtils areEqualNormalizedName:key andName:propertyName]) { + value = self.eventProperties[key]; + break; + } + } if (value == nil) { if ([propertyName isEqualToString:CLTAP_PROP_CAMPAIGN_ID]) { value = self.eventProperties[CLTAP_PROP_WZRK_ID]; diff --git a/CleverTapSDKTests/InApps/CTTriggersMatcherTest.m b/CleverTapSDKTests/InApps/CTTriggersMatcherTest.m index d7d2f5da..8a61b3f7 100644 --- a/CleverTapSDKTests/InApps/CTTriggersMatcherTest.m +++ b/CleverTapSDKTests/InApps/CTTriggersMatcherTest.m @@ -773,6 +773,44 @@ - (void)testMatchEqualsExtectedStringWithActualString { XCTAssertFalse(match); } +- (void)testMatchEqualsPropertyNameWithNormalization { + NSArray *whenTriggers = @[ + @{ + @"eventName": @"event1", + @"eventProperties": @[ + @{ + @"propertyName": @"prop1", + @"operator": @1, + @"propertyValue": @"test" + } + ] + } + ]; + + CTTriggersMatcher *triggerMatcher = [[CTTriggersMatcher alloc] init]; + + BOOL match = [triggerMatcher matchEventWhenTriggers:whenTriggers eventName:@"event1" eventProperties:@{ + @"prop 1": @"test" + }]; + XCTAssertTrue(match); + + match = [triggerMatcher matchEventWhenTriggers:whenTriggers eventName:@"event1" eventProperties:@{ + @"Prop 1": @"test" + }]; + XCTAssertTrue(match); + + match = [triggerMatcher matchEventWhenTriggers:whenTriggers eventName:@"E vent1" eventProperties:@{ + @"Prop 1": @"test" + }]; + XCTAssertTrue(match); + + match = [triggerMatcher matchEventWhenTriggers:whenTriggers eventName:@"event1" eventProperties:@{ + @"Prop.1": @"test" + }]; + XCTAssertFalse(match); +} + + - (void)testMatchEqualsExtectedNumberWithActualString { NSArray *whenTriggers = @[ @{