react-native-mparticle 2.8.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -651,23 +651,21 @@ RCT_EXPORT_METHOD(setCCPAConsentState:(MPCCPAConsent *)consent)
|
|
|
651
651
|
}
|
|
652
652
|
MPIdentityApiRequest *request = [MPIdentityApiRequest requestWithEmptyUser];
|
|
653
653
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
654
|
+
for (NSString *key in dict) {
|
|
655
|
+
id value = dict[key];
|
|
656
|
+
if (value == [NSNull null]) {
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
if ([key isEqualToString:@"email"]) {
|
|
661
|
+
request.email = (NSString *)value;
|
|
662
|
+
} else if ([key isEqualToString:@"customerId"]) {
|
|
663
|
+
request.customerId = (NSString *)value;
|
|
664
|
+
} else if ([RNMParticle isNumericIdentityKey:key]) {
|
|
657
665
|
MPIdentity identityType = (MPIdentity)[key integerValue];
|
|
658
|
-
NSString *value
|
|
659
|
-
[request setIdentity:value identityType:identityType];
|
|
666
|
+
[request setIdentity:(NSString *)value identityType:identityType];
|
|
660
667
|
}
|
|
661
668
|
}
|
|
662
|
-
|
|
663
|
-
if (dict[@"customerId"] && dict[@"customerId"] != [NSNull null]) {
|
|
664
|
-
request.customerId = dict[@"customerId"];
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
if (dict[@"email"] && dict[@"email"] != [NSNull null]) {
|
|
668
|
-
request.email = dict[@"email"];
|
|
669
|
-
}
|
|
670
|
-
|
|
671
669
|
return request;
|
|
672
670
|
}
|
|
673
671
|
|
|
@@ -727,6 +725,17 @@ RCT_EXPORT_METHOD(setCCPAConsentState:(MPCCPAConsent *)consent)
|
|
|
727
725
|
}
|
|
728
726
|
#endif
|
|
729
727
|
|
|
728
|
+
+ (BOOL)isNumericIdentityKey:(NSString *)key {
|
|
729
|
+
static NSCharacterSet *numericSet = nil;
|
|
730
|
+
static dispatch_once_t onceToken;
|
|
731
|
+
dispatch_once(&onceToken, ^{
|
|
732
|
+
numericSet = [NSCharacterSet decimalDigitCharacterSet];
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
NSCharacterSet *keyCharacterSet = [NSCharacterSet characterSetWithCharactersInString:key];
|
|
736
|
+
return [numericSet isSupersetOfSet:keyCharacterSet];
|
|
737
|
+
}
|
|
738
|
+
|
|
730
739
|
@end
|
|
731
740
|
|
|
732
741
|
// RCTConvert category methods for mParticle types
|
|
@@ -1087,27 +1096,27 @@ typedef NS_ENUM(NSUInteger, MPReactCommerceEventAction) {
|
|
|
1087
1096
|
return action;
|
|
1088
1097
|
}
|
|
1089
1098
|
|
|
1099
|
+
|
|
1090
1100
|
+ (MPIdentityApiRequest *)MPIdentityApiRequest:(id)json {
|
|
1091
1101
|
NSDictionary *dict = json;
|
|
1092
1102
|
MPIdentityApiRequest *request = [MPIdentityApiRequest requestWithEmptyUser];
|
|
1093
1103
|
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1104
|
+
for (NSString *key in dict) {
|
|
1105
|
+
id value = dict[key];
|
|
1106
|
+
if (value == [NSNull null]) {
|
|
1107
|
+
continue;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
if ([key isEqualToString:@"email"]) {
|
|
1111
|
+
request.email = (NSString *)value;
|
|
1112
|
+
} else if ([key isEqualToString:@"customerId"]) {
|
|
1113
|
+
request.customerId = (NSString *)value;
|
|
1114
|
+
} else if ([RNMParticle isNumericIdentityKey:key]) {
|
|
1097
1115
|
MPIdentity identityType = (MPIdentity)[key integerValue];
|
|
1098
|
-
NSString *value
|
|
1099
|
-
[request setIdentity:value identityType:identityType];
|
|
1116
|
+
[request setIdentity:(NSString *)value identityType:identityType];
|
|
1100
1117
|
}
|
|
1101
1118
|
}
|
|
1102
1119
|
|
|
1103
|
-
if (dict[@"customerId"] && dict[@"customerId"] != [NSNull null]) {
|
|
1104
|
-
request.customerId = dict[@"customerId"];
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
if (dict[@"email"] && dict[@"email"] != [NSNull null]) {
|
|
1108
|
-
request.email = dict[@"email"];
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
1120
|
return request;
|
|
1112
1121
|
}
|
|
1113
1122
|
|
package/package.json
CHANGED