Skip to content

Commit 964b577

Browse files
FabianTrainfflach
andauthored
Change unsubscribedFromEmails type to boolean for userAttributesForDictionary ios (#206)
Co-authored-by: fflach <[email protected]>
1 parent 6e50271 commit 964b577

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

ios/IntercomAttributesBuilder.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ + (ICMUserAttributes *)userAttributesForDictionary:(NSDictionary *)attributesDic
2424
attributes.signedUpAt = [self dateValueForKey:@"signedUpAt" inDictionary:attributesDict];
2525
}
2626
if ([self stringValueForKey:@"unsubscribedFromEmails" inDictionary:attributesDict]) {
27-
attributes.unsubscribedFromEmails = [self stringValueForKey:@"unsubscribedFromEmails" inDictionary:attributesDict];
27+
attributes.unsubscribedFromEmails = [self boolValueForKey:@"unsubscribedFromEmails" inDictionary:attributesDict];
2828
}
2929
if (attributesDict[@"customAttributes"]) {
3030
attributes.customAttributes = attributesDict[@"customAttributes"];
@@ -98,5 +98,16 @@ + (NSDate *)dateValueForKey:(NSString *)key inDictionary:(NSDictionary *)diction
9898
return nil;
9999
}
100100

101+
+ (BOOL)boolValueForKey:(NSString *)key inDictionary:(NSDictionary *)dictionary {
102+
id value = dictionary[key];
103+
if ([value isKindOfClass:[NSNumber class]]) {
104+
return [value boolValue];
105+
}
106+
if ([value isKindOfClass:[NSString class]]) {
107+
return [value boolValue];
108+
}
109+
return NO;
110+
}
111+
101112

102113
@end

0 commit comments

Comments
 (0)