@convivainc/conviva-react-native-appanalytics 0.1.1 → 0.1.2
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 +5 -0
- package/README.md +9 -0
- package/RNConvivaAppAnalytics.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/conviva/react/apptracker/util/TrackerVersion.java +1 -1
- package/ios/RNConvivaAppAnalytics.m +44 -15
- package/ios/Util/RNConfigUtils.h +2 -0
- package/ios/Util/RNConfigUtils.m +8 -0
- package/ios/Util/RNTrackerVersion.m +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
# Changelog
|
|
3
|
+
## 0.1.2 (01/MAY/2023)
|
|
4
|
+
* Supports the inclusion of the latest Android/iOS Native sensor always in the Android/iOS Bridge going forward
|
|
5
|
+
* Fixes the issue of App Name being incorrect for iOS Bridge
|
|
6
|
+
* Updates related to the default Network and Tracker Config in the iOS Bridge
|
|
7
|
+
|
|
3
8
|
## 0.1.1 (24/APR/2023)
|
|
4
9
|
* Published the Android/iOS folders along with the podspec files
|
|
5
10
|
|
package/README.md
CHANGED
|
@@ -10,6 +10,15 @@ npm install @convivainc/conviva-react-native-appanalytics --save
|
|
|
10
10
|
npx pod-install
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Android Gradle dependency
|
|
14
|
+
Add the following line to app's build.gradle file along with the dependencies:
|
|
15
|
+
```
|
|
16
|
+
dependencies {
|
|
17
|
+
...
|
|
18
|
+
implementation 'com.conviva.sdk:conviva-android-tracker:<version>'
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
13
22
|
## Initialize the tracker
|
|
14
23
|
```js
|
|
15
24
|
import { createTracker } from '@convivainc/conviva-react-native-appanalytics';
|
package/android/build.gradle
CHANGED
|
@@ -51,5 +51,5 @@ dependencies {
|
|
|
51
51
|
implementation "com.squareup.okhttp3:okhttp:4.9.3"
|
|
52
52
|
implementation "com.facebook.react:react-native:+"
|
|
53
53
|
implementation 'com.googlecode.json-simple:json-simple:1.1'
|
|
54
|
-
implementation 'com.conviva.sdk:conviva-android-tracker
|
|
54
|
+
implementation 'com.conviva.sdk:conviva-android-tracker:+'
|
|
55
55
|
}
|
|
@@ -61,17 +61,32 @@ RCT_EXPORT_METHOD(createTracker:
|
|
|
61
61
|
NSString *customerKey = [argmap objectForKey:@"customerKey"];
|
|
62
62
|
NSDictionary *networkConfig =[argmap objectForKey:@"networkConfig"];
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
CATNetworkConfiguration *networkConfiguration = nil;
|
|
65
|
+
if(nil != networkConfig){
|
|
66
|
+
|
|
67
|
+
// NetworkConfiguration
|
|
68
|
+
NSString *method = [networkConfig rncat_stringForKey:@"method" defaultValue:nil];
|
|
69
|
+
CATHttpMethod httpMethod = CATHttpMethodPost;
|
|
70
|
+
|
|
71
|
+
if(0 < [method length]){
|
|
72
|
+
httpMethod = [@"get" isEqualToString:method] ? CATHttpMethodGet : CATHttpMethodPost;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
NSString *endpoint = networkConfig[@"endpoint"];
|
|
76
|
+
|
|
77
|
+
if(0 < [endpoint length]) {
|
|
78
|
+
networkConfiguration = [[CATNetworkConfiguration alloc] initWithEndpoint:networkConfig[@"endpoint"] method:httpMethod];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
NSString *customPostPath = [networkConfig rncat_stringForKey:@"customPostPath" defaultValue:nil];
|
|
82
|
+
if (0 < [customPostPath length]) {
|
|
83
|
+
networkConfiguration.customPostPath = customPostPath;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
NSObject *requestHeaders = [networkConfig objectForKey:@"requestHeaders"];
|
|
87
|
+
if (requestHeaders != nil && [requestHeaders isKindOfClass:NSDictionary.class]) {
|
|
88
|
+
networkConfiguration.requestHeaders = (NSDictionary *)requestHeaders;
|
|
89
|
+
}
|
|
75
90
|
}
|
|
76
91
|
|
|
77
92
|
// Configurations
|
|
@@ -83,6 +98,10 @@ RCT_EXPORT_METHOD(createTracker:
|
|
|
83
98
|
CATTrackerConfiguration *trackerConfiguration = [RNConfigUtils mkTrackerConfig:(NSDictionary *)trackerArg];
|
|
84
99
|
[controllers addObject:trackerConfiguration];
|
|
85
100
|
}
|
|
101
|
+
else{
|
|
102
|
+
CATTrackerConfiguration *trackerConfiguration = [RNConfigUtils mkDefaultTrackerConfig];
|
|
103
|
+
[controllers addObject:trackerConfiguration];
|
|
104
|
+
}
|
|
86
105
|
|
|
87
106
|
// SessionConfiguration
|
|
88
107
|
NSObject *sessionArg = [argmap objectForKey:@"sessionConfig"];
|
|
@@ -118,10 +137,20 @@ RCT_EXPORT_METHOD(createTracker:
|
|
|
118
137
|
CATGlobalContextsConfiguration *gcConfiguration = [RNConfigUtils mkGCConfig:(NSArray *)gcArg];
|
|
119
138
|
[controllers addObject:gcConfiguration];
|
|
120
139
|
}
|
|
121
|
-
|
|
122
|
-
id<CATTrackerController> tracker =
|
|
123
|
-
|
|
124
|
-
|
|
140
|
+
|
|
141
|
+
id<CATTrackerController> tracker = nil;
|
|
142
|
+
if(nil != networkConfiguration){
|
|
143
|
+
tracker = [CATAppAnalytics createTrackerWithCustomerKey:customerKey
|
|
144
|
+
appName:appName
|
|
145
|
+
network:networkConfiguration
|
|
146
|
+
configurations:controllers];
|
|
147
|
+
}
|
|
148
|
+
else{
|
|
149
|
+
tracker = [CATAppAnalytics createTrackerWithCustomerKey:customerKey
|
|
150
|
+
appName:appName
|
|
151
|
+
configurations:controllers];
|
|
152
|
+
}
|
|
153
|
+
|
|
125
154
|
if (tracker) {
|
|
126
155
|
resolve(@YES);
|
|
127
156
|
} else {
|
package/ios/Util/RNConfigUtils.h
CHANGED
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
|
|
30
30
|
@interface RNConfigUtils : NSObject
|
|
31
31
|
|
|
32
|
+
+ (CATTrackerConfiguration *) mkDefaultTrackerConfig;
|
|
33
|
+
|
|
32
34
|
+ (CATTrackerConfiguration *) mkTrackerConfig:(NSDictionary *) trackerConfig;
|
|
33
35
|
|
|
34
36
|
+ (CATSessionConfiguration *) mkSessionConfig:(NSDictionary *) sessionConfig;
|
package/ios/Util/RNConfigUtils.m
CHANGED
|
@@ -37,6 +37,14 @@
|
|
|
37
37
|
|
|
38
38
|
@implementation RNConfigUtils
|
|
39
39
|
|
|
40
|
+
+ (CATTrackerConfiguration *) mkDefaultTrackerConfig {
|
|
41
|
+
|
|
42
|
+
CATTrackerConfiguration *trackerConfiguration = [CATTrackerConfiguration new];
|
|
43
|
+
trackerConfiguration.trackerVersionSuffix = kRNTrackerVersion;
|
|
44
|
+
|
|
45
|
+
return trackerConfiguration;
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
+ (CATTrackerConfiguration *) mkTrackerConfig:(NSDictionary *) trackerConfig {
|
|
41
49
|
CATTrackerConfiguration *trackerConfiguration = [CATTrackerConfiguration new];
|
|
42
50
|
trackerConfiguration.trackerVersionSuffix = kRNTrackerVersion;
|
package/package.json
CHANGED