File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Analytics/Classes/Integrations Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -425,8 +425,10 @@ + (BOOL)isIntegration:(NSString *)key enabledInOptions:(NSDictionary *)options
425
425
if ([value isKindOfClass: [NSNumber class ]]) {
426
426
NSNumber *numberValue = (NSNumber *)value;
427
427
return [numberValue boolValue ];
428
+ } if ([value isKindOfClass: [NSDictionary class ]]) {
429
+ return YES ;
428
430
} else {
429
- NSString *msg = [NSString stringWithFormat: @" Value for `%@ ` in integration options is supposed to be a boolean and it is not!"
431
+ NSString *msg = [NSString stringWithFormat: @" Value for `%@ ` in integration options is supposed to be a boolean or dictionary and it is not!"
430
432
" This is likely due to a user-added value in `integrations` that overwrites a value received from the server" , key];
431
433
SEGLog (msg);
432
434
NSAssert (NO , msg);
Original file line number Diff line number Diff line change @@ -9,6 +9,18 @@ class IntegrationsManagerTest: QuickSpec {
9
9
describe ( " IntegrationsManager " ) {
10
10
context ( " is track event enabled for integration in plan " ) {
11
11
12
+ it ( " valid value types are used in integration enablement flags " ) {
13
+ var exception : NSException ? = nil
14
+ SwiftTryCatch . tryRun ( {
15
+ SEGIntegrationsManager . isIntegration ( " comScore " , enabledInOptions: [ " comScore " : [ " blah " : 1 ] ] )
16
+ SEGIntegrationsManager . isIntegration ( " comScore " , enabledInOptions: [ " comScore " : true ] )
17
+ } , catchRun: { e in
18
+ exception = e
19
+ } , finallyRun: nil )
20
+
21
+ expect ( exception) . to ( beNil ( ) )
22
+ }
23
+
12
24
it ( " asserts when invalid value types are used integration enablement flags " ) {
13
25
var exception : NSException ? = nil
14
26
SwiftTryCatch . tryRun ( {
@@ -23,7 +35,8 @@ class IntegrationsManagerTest: QuickSpec {
23
35
it ( " asserts when invalid value types are used integration enablement flags " ) {
24
36
var exception : NSException ? = nil
25
37
SwiftTryCatch . tryRun ( {
26
- SEGIntegrationsManager . isIntegration ( " comScore " , enabledInOptions: [ " comScore " : [ " key " : 1 ] ] )
38
+ // we don't accept array's as values.
39
+ SEGIntegrationsManager . isIntegration ( " comScore " , enabledInOptions: [ " comScore " : [ " key " , 1 ] ] )
27
40
} , catchRun: { e in
28
41
exception = e
29
42
} , finallyRun: nil )
You can’t perform that action at this time.
0 commit comments