@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 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';
@@ -20,5 +20,5 @@ Pod::Spec.new do |s|
20
20
  s.requires_arc = true
21
21
 
22
22
  s.dependency "React-Core"
23
- s.dependency "ConvivaAppAnalytics", "~> 0.2.10"
23
+ s.dependency "ConvivaAppAnalytics", ">= 0.2.12"
24
24
  end
@@ -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:0.5.+'
54
+ implementation 'com.conviva.sdk:conviva-android-tracker:+'
55
55
  }
@@ -4,6 +4,6 @@ import com.conviva.react.apptracker.BuildConfig;
4
4
 
5
5
  public class TrackerVersion {
6
6
 
7
- public final static String RN_CONVIVA_TRACKER_VERSION = "rn-0.1.1";
7
+ public final static String RN_CONVIVA_TRACKER_VERSION = "rn-0.1.2";
8
8
 
9
9
  }
@@ -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
- // NetworkConfiguration
65
- NSString *method = [networkConfig rncat_stringForKey:@"method" defaultValue:nil];
66
- CATHttpMethod httpMethod = [@"get" isEqualToString:method] ? CATHttpMethodGet : CATHttpMethodPost;
67
- CATNetworkConfiguration *networkConfiguration = [[CATNetworkConfiguration alloc] initWithEndpoint:networkConfig[@"endpoint"] method:httpMethod];
68
- NSString *customPostPath = [networkConfig rncat_stringForKey:@"customPostPath" defaultValue:nil];
69
- if (customPostPath != nil) {
70
- networkConfiguration.customPostPath = customPostPath;
71
- }
72
- NSObject *requestHeaders = [networkConfig objectForKey:@"requestHeaders"];
73
- if (requestHeaders != nil && [requestHeaders isKindOfClass:NSDictionary.class]) {
74
- networkConfiguration.requestHeaders = (NSDictionary *)requestHeaders;
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 = [CATAppAnalytics createTrackerWithNamespace:trackerNs customerKey:customerKey network:networkConfiguration configurations:controllers];
123
- tracker.appId = appName;
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 {
@@ -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;
@@ -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;
@@ -22,6 +22,6 @@
22
22
 
23
23
  @implementation RNTrackerVersion
24
24
 
25
- NSString * const kRNTrackerVersion = @"rn-0.1.1";
25
+ NSString * const kRNTrackerVersion = @"rn-0.1.2";
26
26
 
27
27
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@convivainc/conviva-react-native-appanalytics",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Conviva React Native Application Analytics Library",
5
5
  "main": "conviva-react-native-appanalytics.js",
6
6
  "repository": {