@convivainc/conviva-react-native-appanalytics 0.0.1 → 0.1.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.
- package/CHANGELOG.md +8 -1
- package/README.md +2 -12
- package/RNConvivaAppAnalytics.podspec +24 -0
- package/android/build.gradle +55 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/android/gradle.properties +2 -0
- package/android/gradlew +172 -0
- package/android/gradlew.bat +84 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/conviva/react/apptracker/RNConvivaTrackerModule.java +804 -0
- package/android/src/main/java/com/conviva/react/apptracker/RNConvivaTrackerPackage.java +29 -0
- package/android/src/main/java/com/conviva/react/apptracker/util/ConfigUtil.java +346 -0
- package/android/src/main/java/com/conviva/react/apptracker/util/EventUtil.java +339 -0
- package/android/src/main/java/com/conviva/react/apptracker/util/TrackerVersion.java +9 -0
- package/{index.js → conviva-react-native-appanalytics.js} +3 -3
- package/ios/RNConvivaAppAnalytics.h +34 -0
- package/ios/RNConvivaAppAnalytics.m +1022 -0
- package/ios/RNConvivaAppAnalytics.xcodeproj/project.pbxproj +325 -0
- package/ios/RNConvivaAppAnalytics.xcodeproj/xcshareddata/xcschemes/RNSnowplowTracker.xcscheme +76 -0
- package/ios/Util/NSDictionary+RNCAT_TypeMethods.h +33 -0
- package/ios/Util/NSDictionary+RNCAT_TypeMethods.m +40 -0
- package/ios/Util/RNConfigUtils.h +44 -0
- package/ios/Util/RNConfigUtils.m +209 -0
- package/ios/Util/RNTrackerVersion.h +27 -0
- package/ios/Util/RNTrackerVersion.m +27 -0
- package/ios/Util/RNUtilities.h +32 -0
- package/ios/Util/RNUtilities.m +68 -0
- package/package.json +1 -1
- /package/{index.d.ts → conviva-react-native-appanalytics.d.ts} +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNConfigUtils.m
|
|
3
|
+
//
|
|
4
|
+
// Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
5
|
+
//
|
|
6
|
+
// This program is licensed to you under the Apache License Version 2.0,
|
|
7
|
+
// and you may not use this file except in compliance with the Apache License
|
|
8
|
+
// Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the Apache License Version 2.0 is distributed on
|
|
13
|
+
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
14
|
+
// express or implied. See the Apache License Version 2.0 for the specific
|
|
15
|
+
// language governing permissions and limitations there under.
|
|
16
|
+
//
|
|
17
|
+
// Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
|
|
18
|
+
// License: Apache License Version 2.0
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#import "RNConfigUtils.h"
|
|
22
|
+
#import "RNTrackerVersion.h"
|
|
23
|
+
#import "RNUtilities.h"
|
|
24
|
+
#import "NSDictionary+RNCAT_TypeMethods.h"
|
|
25
|
+
|
|
26
|
+
#import <Foundation/Foundation.h>
|
|
27
|
+
|
|
28
|
+
#import <ConvivaAppAnalytics/CATAppAnalytics.h>
|
|
29
|
+
#import <ConvivaAppAnalytics/CATTrackerConfiguration.h>
|
|
30
|
+
#import <ConvivaAppAnalytics/CATDevicePlatform.h>
|
|
31
|
+
#import <ConvivaAppAnalytics/CATLoggerDelegate.h>
|
|
32
|
+
#import <ConvivaAppAnalytics/CATSessionConfiguration.h>
|
|
33
|
+
#import <ConvivaAppAnalytics/CATEmitterConfiguration.h>
|
|
34
|
+
#import <ConvivaAppAnalytics/CATSubjectConfiguration.h>
|
|
35
|
+
#import <ConvivaAppAnalytics/CATGDPRConfiguration.h>
|
|
36
|
+
#import <ConvivaAppAnalytics/CATGlobalContextsConfiguration.h>
|
|
37
|
+
|
|
38
|
+
@implementation RNConfigUtils
|
|
39
|
+
|
|
40
|
+
+ (CATTrackerConfiguration *) mkTrackerConfig:(NSDictionary *) trackerConfig {
|
|
41
|
+
CATTrackerConfiguration *trackerConfiguration = [CATTrackerConfiguration new];
|
|
42
|
+
trackerConfiguration.trackerVersionSuffix = kRNTrackerVersion;
|
|
43
|
+
|
|
44
|
+
NSString *appId = [trackerConfig rncat_stringForKey:@"appId" defaultValue:nil];
|
|
45
|
+
if (appId) {
|
|
46
|
+
trackerConfiguration.appId = appId;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
NSString *devicePlatform = [trackerConfig rncat_stringForKey:@"devicePlatform" defaultValue:nil];
|
|
50
|
+
if (devicePlatform) {
|
|
51
|
+
trackerConfiguration.devicePlatform = CATStringToDevicePlatform(devicePlatform);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
trackerConfiguration.base64Encoding = [trackerConfig rncat_boolForKey:@"base64Encoding" defaultValue:YES];
|
|
55
|
+
|
|
56
|
+
NSString *logLevel = [trackerConfig rncat_stringForKey:@"logLevel" defaultValue:nil];
|
|
57
|
+
if (logLevel) {
|
|
58
|
+
NSUInteger index = [@[@"off", @"error", @"debug", @"verbose"] indexOfObject:logLevel];
|
|
59
|
+
trackerConfiguration.logLevel = index != NSNotFound ? index : CATLogLevelOff;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
trackerConfiguration.sessionContext = [trackerConfig rncat_boolForKey:@"sessionContext" defaultValue:YES];
|
|
63
|
+
trackerConfiguration.applicationContext = [trackerConfig rncat_boolForKey:@"applicationContext" defaultValue:YES];
|
|
64
|
+
trackerConfiguration.platformContext = [trackerConfig rncat_boolForKey:@"platformContext" defaultValue:YES];
|
|
65
|
+
trackerConfiguration.geoLocationContext = [trackerConfig rncat_boolForKey:@"geoLocationContext" defaultValue:NO];
|
|
66
|
+
trackerConfiguration.screenContext = [trackerConfig rncat_boolForKey:@"screenContext" defaultValue:YES];
|
|
67
|
+
trackerConfiguration.deepLinkContext = [trackerConfig rncat_boolForKey:@"deepLinkContext" defaultValue:YES];
|
|
68
|
+
trackerConfiguration.screenViewAutotracking = [trackerConfig rncat_boolForKey:@"screenViewAutotracking" defaultValue:YES];
|
|
69
|
+
trackerConfiguration.lifecycleAutotracking = [trackerConfig rncat_boolForKey:@"lifecycleAutotracking" defaultValue:NO];
|
|
70
|
+
trackerConfiguration.installAutotracking = [trackerConfig rncat_boolForKey:@"installAutotracking" defaultValue:YES];
|
|
71
|
+
trackerConfiguration.exceptionAutotracking = [trackerConfig rncat_boolForKey:@"exceptionAutotracking" defaultValue:YES];
|
|
72
|
+
trackerConfiguration.diagnosticAutotracking = [trackerConfig rncat_boolForKey:@"diagnosticAutotracking" defaultValue:NO];
|
|
73
|
+
// trackerConfiguration.userAnonymisation = [trackerConfig rncat_boolForKey:@"userAnonymisation" defaultValue:NO];
|
|
74
|
+
|
|
75
|
+
return trackerConfiguration;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
+ (CATSessionConfiguration *) mkSessionConfig:(NSDictionary *) sessionConfig {
|
|
79
|
+
|
|
80
|
+
NSInteger foreground = [[sessionConfig rncat_numberForKey:@"foregroundTimeout" defaultValue:@1800] integerValue];
|
|
81
|
+
NSInteger background = [[sessionConfig rncat_numberForKey:@"backgroundTimeout" defaultValue:@1800] integerValue];
|
|
82
|
+
CATSessionConfiguration *sessionConfiguration = [[CATSessionConfiguration alloc] initWithForegroundTimeoutInSeconds:foreground backgroundTimeoutInSeconds:background];
|
|
83
|
+
|
|
84
|
+
return sessionConfiguration;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
+ (CATEmitterConfiguration *) mkEmitterConfig:(NSDictionary *) emitterConfig {
|
|
88
|
+
CATEmitterConfiguration *emitterConfiguration = [[CATEmitterConfiguration alloc] init];
|
|
89
|
+
NSString *bufferOption = [emitterConfig rncat_stringForKey:@"bufferOption" defaultValue:@"single"];
|
|
90
|
+
if ([bufferOption isEqualToString:@"default"]) {
|
|
91
|
+
emitterConfiguration.bufferOption = CATBufferOptionDefaultGroup;
|
|
92
|
+
} else if ([bufferOption isEqualToString:@"large"]) {
|
|
93
|
+
emitterConfiguration.bufferOption = CATBufferOptionLargeGroup;
|
|
94
|
+
} else {
|
|
95
|
+
emitterConfiguration.bufferOption = CATBufferOptionSingle;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
emitterConfiguration.emitRange = [[emitterConfig rncat_numberForKey:@"emitRange" defaultValue:@150] integerValue];
|
|
99
|
+
emitterConfiguration.threadPoolSize = [[emitterConfig rncat_numberForKey:@"threadPoolSize" defaultValue:@15] integerValue];
|
|
100
|
+
emitterConfiguration.byteLimitGet = [[emitterConfig rncat_numberForKey:@"byteLimitGet" defaultValue:@40000] integerValue];
|
|
101
|
+
emitterConfiguration.byteLimitPost = [[emitterConfig rncat_numberForKey:@"byteLimitPost" defaultValue:@40000] integerValue];
|
|
102
|
+
// emitterConfiguration.serverAnonymisation = [emitterConfig rncat_boolForKey:@"serverAnonymisation" defaultValue:NO];
|
|
103
|
+
|
|
104
|
+
return emitterConfiguration;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
+ (CATSubjectConfiguration *) mkSubjectConfig:(NSDictionary *) subjectConfig {
|
|
108
|
+
|
|
109
|
+
CATSubjectConfiguration *subjectConfiguration = [CATSubjectConfiguration new];
|
|
110
|
+
|
|
111
|
+
NSString *userId = [subjectConfig rncat_stringForKey:@"userId" defaultValue:nil];
|
|
112
|
+
if (userId) {
|
|
113
|
+
subjectConfiguration.userId = userId;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
NSString *networkUserId = [subjectConfig rncat_stringForKey:@"networkUserId" defaultValue:nil];
|
|
117
|
+
if (networkUserId) {
|
|
118
|
+
subjectConfiguration.networkUserId = networkUserId;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
NSString *domainUserId = [subjectConfig rncat_stringForKey:@"domainUserId" defaultValue:nil];
|
|
122
|
+
if (domainUserId) {
|
|
123
|
+
subjectConfiguration.domainUserId = domainUserId;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
NSString *useragent = [subjectConfig rncat_stringForKey:@"useragent" defaultValue:nil];
|
|
127
|
+
if (useragent) {
|
|
128
|
+
subjectConfiguration.useragent = useragent;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
NSString *ipAddress = [subjectConfig rncat_stringForKey:@"ipAddress" defaultValue:nil];
|
|
132
|
+
if (ipAddress) {
|
|
133
|
+
subjectConfiguration.ipAddress = ipAddress;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
NSString *timezone = [subjectConfig rncat_stringForKey:@"timezone" defaultValue:nil];
|
|
137
|
+
if (timezone) {
|
|
138
|
+
subjectConfiguration.timezone = timezone;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
NSString *language = [subjectConfig rncat_stringForKey:@"language" defaultValue:nil];
|
|
142
|
+
if (language) {
|
|
143
|
+
subjectConfiguration.language = language;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// screenResolution - type checked RN side
|
|
147
|
+
NSArray *screenRSize = [subjectConfig objectForKey:@"screenResolution"];
|
|
148
|
+
if (screenRSize != nil) {
|
|
149
|
+
NSNumber *resWidth = [screenRSize objectAtIndex:0];
|
|
150
|
+
NSNumber *resHeight = [screenRSize objectAtIndex:1];
|
|
151
|
+
CISSize *resSize = [[CISSize alloc] initWithWidth:[resWidth integerValue] height:[resHeight integerValue]];
|
|
152
|
+
subjectConfiguration.screenResolution = resSize;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// screenViewport - type checked RN side
|
|
156
|
+
NSArray *screenVPSize = [subjectConfig objectForKey:@"screenViewport"];
|
|
157
|
+
if (screenVPSize != nil) {
|
|
158
|
+
NSNumber *vpWidth = [screenVPSize objectAtIndex:0];
|
|
159
|
+
NSNumber *vpHeight = [screenVPSize objectAtIndex:1];
|
|
160
|
+
CISSize *vpSize = [[CISSize alloc] initWithWidth:[vpWidth integerValue] height:[vpHeight integerValue]];
|
|
161
|
+
subjectConfiguration.screenViewPort = vpSize;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// colorDepth
|
|
165
|
+
NSNumber *colorDepth = [subjectConfig rncat_numberForKey:@"colorDepth" defaultValue: nil];
|
|
166
|
+
if (colorDepth != nil) {
|
|
167
|
+
subjectConfiguration.colorDepth = colorDepth;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return subjectConfiguration;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
+ (CATGDPRConfiguration *) mkGdprConfig:(NSDictionary *) gdprConfig {
|
|
174
|
+
NSString *basis = [gdprConfig objectForKey:@"basisForProcessing"];
|
|
175
|
+
NSString *docId = [gdprConfig objectForKey:@"documentId"];
|
|
176
|
+
NSString *docVer = [gdprConfig objectForKey:@"documentVersion"];
|
|
177
|
+
NSString *docDesc = [gdprConfig objectForKey:@"documentDescription"];
|
|
178
|
+
|
|
179
|
+
CATGDPRConfiguration *gdprConfiguration = [[CATGDPRConfiguration alloc] initWithBasis:[RNUtilities getBasis:basis] documentId:docId documentVersion:docVer documentDescription:docDesc];
|
|
180
|
+
|
|
181
|
+
return gdprConfiguration;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
+ (CATGlobalContextsConfiguration *) mkGCConfig:(NSArray *) gcConfig {
|
|
185
|
+
|
|
186
|
+
CATGlobalContextsConfiguration *gcConfiguration = [[CATGlobalContextsConfiguration alloc] init];
|
|
187
|
+
//NSMutableDictionary *contextGens = [NSMutableDictionary dictionary];
|
|
188
|
+
|
|
189
|
+
for (NSDictionary *gcMap in gcConfig) {
|
|
190
|
+
NSString *itag = [gcMap objectForKey:@"tag"];
|
|
191
|
+
NSArray *globalContexts = [gcMap objectForKey:@"globalContexts"];
|
|
192
|
+
|
|
193
|
+
NSMutableArray *staticContexts = [NSMutableArray array];
|
|
194
|
+
for (NSDictionary *sdj in globalContexts) {
|
|
195
|
+
CATSelfDescribingJson *gContext = [[CATSelfDescribingJson alloc] initWithSchema:(NSString *)[sdj objectForKey:@"schema"]
|
|
196
|
+
andDictionary:(NSDictionary *)[sdj objectForKey:@"data"]];
|
|
197
|
+
|
|
198
|
+
[staticContexts addObject:gContext];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
CATGlobalContext *gcStatic = [[CATGlobalContext alloc] initWithStaticContexts:(NSArray *)[staticContexts copy]];
|
|
202
|
+
|
|
203
|
+
[gcConfiguration addWithTag:itag contextGenerator:gcStatic];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return gcConfiguration;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNTrackerVersion.h
|
|
3
|
+
//
|
|
4
|
+
// Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
5
|
+
//
|
|
6
|
+
// This program is licensed to you under the Apache License Version 2.0,
|
|
7
|
+
// and you may not use this file except in compliance with the Apache License
|
|
8
|
+
// Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the Apache License Version 2.0 is distributed on
|
|
13
|
+
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
14
|
+
// express or implied. See the Apache License Version 2.0 for the specific
|
|
15
|
+
// language governing permissions and limitations there under.
|
|
16
|
+
//
|
|
17
|
+
// Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
|
|
18
|
+
// License: Apache License Version 2.0
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#import <Foundation/Foundation.h>
|
|
22
|
+
|
|
23
|
+
@interface RNTrackerVersion : NSObject
|
|
24
|
+
|
|
25
|
+
extern NSString * const kRNTrackerVersion;
|
|
26
|
+
|
|
27
|
+
@end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNTrackerVersion.m
|
|
3
|
+
//
|
|
4
|
+
// Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
5
|
+
//
|
|
6
|
+
// This program is licensed to you under the Apache License Version 2.0,
|
|
7
|
+
// and you may not use this file except in compliance with the Apache License
|
|
8
|
+
// Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the Apache License Version 2.0 is distributed on
|
|
13
|
+
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
14
|
+
// express or implied. See the Apache License Version 2.0 for the specific
|
|
15
|
+
// language governing permissions and limitations there under.
|
|
16
|
+
//
|
|
17
|
+
// Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
|
|
18
|
+
// License: Apache License Version 2.0
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#import "RNTrackerVersion.h"
|
|
22
|
+
|
|
23
|
+
@implementation RNTrackerVersion
|
|
24
|
+
|
|
25
|
+
NSString * const kRNTrackerVersion = @"rn-0.1.1";
|
|
26
|
+
|
|
27
|
+
@end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNUtilities.h
|
|
3
|
+
//
|
|
4
|
+
// Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
5
|
+
//
|
|
6
|
+
// This program is licensed to you under the Apache License Version 2.0,
|
|
7
|
+
// and you may not use this file except in compliance with the Apache License
|
|
8
|
+
// Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the Apache License Version 2.0 is distributed on
|
|
13
|
+
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
14
|
+
// express or implied. See the Apache License Version 2.0 for the specific
|
|
15
|
+
// language governing permissions and limitations there under.
|
|
16
|
+
//
|
|
17
|
+
// Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
|
|
18
|
+
// License: Apache License Version 2.0
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#import <Foundation/Foundation.h>
|
|
22
|
+
#import <ConvivaAppAnalytics/CATGDPRConfiguration.h>
|
|
23
|
+
|
|
24
|
+
@interface RNUtilities : NSObject
|
|
25
|
+
|
|
26
|
+
+ (NSDictionary *) removeNSNullFromDict:(NSDictionary *)trackerConfig;
|
|
27
|
+
|
|
28
|
+
+ (CISGdprProcessingBasis) getBasis:(NSString *)basis;
|
|
29
|
+
|
|
30
|
+
+ (NSMutableArray *) mkSDJArray:(NSArray<NSDictionary *> *)sdjArray;
|
|
31
|
+
|
|
32
|
+
@end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNUtilities.m
|
|
3
|
+
//
|
|
4
|
+
// Copyright (c) 2021-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
5
|
+
//
|
|
6
|
+
// This program is licensed to you under the Apache License Version 2.0,
|
|
7
|
+
// and you may not use this file except in compliance with the Apache License
|
|
8
|
+
// Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the Apache License Version 2.0 is distributed on
|
|
13
|
+
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
14
|
+
// express or implied. See the Apache License Version 2.0 for the CATecific
|
|
15
|
+
// language governing permissions and limitations there under.
|
|
16
|
+
//
|
|
17
|
+
// Copyright: Copyright (c) 2023 Snowplow Analytics Ltd
|
|
18
|
+
// License: Apache License Version 2.0
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#import "RNUtilities.h"
|
|
22
|
+
#import <Foundation/Foundation.h>
|
|
23
|
+
#import <ConvivaAppAnalytics/CATGDPRConfiguration.h>
|
|
24
|
+
#import <ConvivaAppAnalytics/CATSelfDescribingJson.h>
|
|
25
|
+
|
|
26
|
+
@implementation RNUtilities
|
|
27
|
+
|
|
28
|
+
+ (NSDictionary *) removeNSNullFromDict:(NSDictionary *)dictionary {
|
|
29
|
+
const NSMutableDictionary *newDict = [dictionary mutableCopy];
|
|
30
|
+
const id nullPointer = [NSNull null];
|
|
31
|
+
|
|
32
|
+
for (NSString *key in dictionary) {
|
|
33
|
+
id obj = [dictionary objectForKey:key];
|
|
34
|
+
if (obj == nullPointer) {
|
|
35
|
+
[newDict removeObjectForKey:key];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return [NSDictionary dictionaryWithDictionary:[newDict copy]];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
+ (CISGdprProcessingBasis) getBasis:(NSString *)basis {
|
|
42
|
+
if ([basis isEqualToString:@"consent"]) {
|
|
43
|
+
return CISGdprProcessingBasisConsent;
|
|
44
|
+
} else if ([basis isEqualToString:@"contract"]) {
|
|
45
|
+
return CISGdprProcessingBasisContract;
|
|
46
|
+
} else if ([basis isEqualToString:@"legal_obligation"]) {
|
|
47
|
+
return CISGdprProcessingBasisLegalObligation;
|
|
48
|
+
} else if ([basis isEqualToString:@"legitimate_interests"]) {
|
|
49
|
+
return CISGdprProcessingBasisLegitimateInterests;
|
|
50
|
+
} else if ([basis isEqualToString:@"public_task"]) {
|
|
51
|
+
return CISGdprProcessingBasisPublicTask;
|
|
52
|
+
} else {
|
|
53
|
+
return CISGdprProcessingBasisVitalInterest;;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
+ (NSMutableArray *) mkSDJArray:(NSArray<NSDictionary *> *)sdjArray {
|
|
58
|
+
NSMutableArray *sdjs = [NSMutableArray array];
|
|
59
|
+
for (NSDictionary* sdj in sdjArray) {
|
|
60
|
+
CATSelfDescribingJson *nativeSdj = [[CATSelfDescribingJson alloc] initWithSchema:(NSString *)[sdj objectForKey:@"schema"]
|
|
61
|
+
andDictionary:(NSDictionary *)[sdj objectForKey:@"data"]];
|
|
62
|
+
[sdjs addObject:nativeSdj];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return sdjs;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@end
|
package/package.json
CHANGED
|
File without changes
|