Skip to content

Commit c838451

Browse files
authored
Merge pull request #391 from Countly/np
Changes
2 parents 1dc1e21 + c5f0a0d commit c838451

35 files changed

+650
-128
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
## 24.4.1-np
2+
* Added support for Feedback Widget terms and conditions
3+
* Added six new configuration options under the 'sdkInternalLimits' interface of 'CountlyConfig':
4+
* 'setMaxKeyLength' for limiting the maximum size of all user provided string keys
5+
* 'setMaxValueSize' for limiting the size of all values in user provided segmentation key-value pairs
6+
* 'setMaxSegmentationValues' for limiting the max amount of user provided segmentation key-value pair count in one event
7+
* 'setMaxBreadcrumbCount' for limiting the max amount of breadcrumbs that can be recorded before the oldest one is deleted
8+
* 'setMaxStackTraceLinesPerThread' for limiting the max amount of stack trace lines to be recorded per thread
9+
* 'setMaxStackTraceLineLength' for limiting the max characters allowed per stack trace lines
10+
11+
* Android Specific Changes:
12+
* ! Minor breaking change ! Introduced SDK internal limits
13+
* Mitigated an issue where the session duration could have been calculated wrongly after a device ID change without merge
14+
* Mitigated an issue where a session could have continued after a device ID change without merge
15+
16+
* iOS Specific Changes:
17+
* Mitigated an issue where internal limits were not being applied to some values
18+
* Mitigated an issue where SDK limits could affect internal keys
19+
* Mitigated an issue that enabled recording reserved events
20+
* Mitigated an issue where timed events could have no ID
21+
* Mitigated an issue where the request queue could overflow while sending a request
22+
* Removed timestamps from crash breadcrumbs
23+
24+
* Updated the underlying Android SDK version to 24.4.1
25+
* Updated the underlying iOS SDK version to 24.4.1
26+
127
## 24.4.0-np
228
* This flavor is a "no Push Notification" variant of the Countly React Native SDK branched from the same version.
329
* All FCM related code is removed.

Countly.d.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,44 @@ declare module "countly-sdk-react-native-bridge-np/CountlyConfig" {
11331133
setAppStartTimestampOverride(timestamp: number): CountlyConfigApm;
11341134
}
11351135

1136+
class CountlyConfigSDKInternalLimits {
1137+
/**
1138+
* Limits the maximum size of all string keys
1139+
* @param keyLengthLimit - maximum char size of all string keys (default 128 chars)
1140+
*/
1141+
setMaxKeyLength(keyLengthLimit: number) : CountlyConfigSDKInternalLimits;
1142+
1143+
/**
1144+
* Limits the size of all values in segmentation key-value pairs
1145+
* @param valueSizeLimit - the maximum char size of all values in our key-value pairs (default 256 chars)
1146+
*/
1147+
setMaxValueSize(valueSizeLimit: number) : CountlyConfigSDKInternalLimits;
1148+
1149+
/**
1150+
* Limits the max amount of custom segmentation in one event
1151+
* @param segmentationAmountLimit - the maximum amount of custom segmentation in one event (default 100 key-value pairs)
1152+
*/
1153+
setMaxSegmentationValues(segmentationAmountLimit: number) : CountlyConfigSDKInternalLimits;
1154+
1155+
/**
1156+
* Limits the max amount of breadcrumbs that can be recorded before the oldest one is deleted
1157+
* @param breadcrumbCountLimit - the maximum amount of breadcrumbs that can be recorded before the oldest one is deleted (default 100)
1158+
*/
1159+
setMaxBreadcrumbCount(breadcrumbCountLimit: number) : CountlyConfigSDKInternalLimits;
1160+
1161+
/**
1162+
* Limits the max amount of stack trace lines to be recorded per thread
1163+
* @param stackTraceLinesPerThreadLimit - maximum amount of stack trace lines to be recorded per thread (default 30)
1164+
*/
1165+
setMaxStackTraceLinesPerThread(stackTraceLinesPerThreadLimit: number) : CountlyConfigSDKInternalLimits;
1166+
1167+
/**
1168+
* Limits the max characters allowed per stack trace lines. Also limits the crash message length
1169+
* @param stackTraceLineLengthLimit - maximum length of each stack trace line (default 200)
1170+
*/
1171+
setMaxStackTraceLineLength(stackTraceLineLengthLimit: number) : CountlyConfigSDKInternalLimits;
1172+
}
1173+
11361174
/**
11371175
*
11381176
* Config object for Countly Init
@@ -1150,6 +1188,10 @@ declare module "countly-sdk-react-native-bridge-np/CountlyConfig" {
11501188
* getter for CountlyConfigApm instance that is used to access CountlyConfigApm methods
11511189
*/
11521190
apm: CountlyConfigApm;
1191+
/**
1192+
* getter for CountlySDKLimits instance that is used to access CountlyConfigSDKInternalLimits methods
1193+
*/
1194+
sdkInternalLimits: CountlyConfigSDKInternalLimits;
11531195

11541196
/**
11551197
* Method to set the server url

CountlyConfig.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { initialize } from "./Logger.js";
22
import CountlyConfigApm from "./lib/configuration_interfaces/countly_config_apm.js";
3+
import CountlyConfigSDKInternalLimits from "./lib/configuration_interfaces/countly_config_limits.js";
34

45
const BUILDING_WITH_PUSH_DISABLED = true;
56

@@ -20,6 +21,7 @@ class CountlyConfig {
2021
this.serverURL = serverURL;
2122
this.appKey = appKey;
2223
this._countlyConfigApmInstance = new CountlyConfigApm();
24+
this._countlyConfigSDKLimitsInstance = new CountlyConfigSDKInternalLimits();
2325
}
2426

2527
/**
@@ -29,6 +31,10 @@ class CountlyConfig {
2931
return this._countlyConfigApmInstance;
3032
}
3133

34+
get sdkInternalLimits() {
35+
return this._countlyConfigSDKLimitsInstance;
36+
}
37+
3238
/**
3339
* Method to set the server url
3440
*

CountlyReactNative.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'CountlyReactNative'
3-
s.version = '24.4.0'
3+
s.version = '24.4.1'
44
s.license = {
55
:type => 'COMMUNITY',
66
:text => <<-LICENSE

Utils.js

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ const DeviceIdType = {
1717
function intToDeviceIDType(deviceIdType) {
1818
let result = null;
1919
switch (deviceIdType) {
20-
case 10101:
21-
result = DeviceIdType.SDK_GENERATED;
22-
break;
23-
case 20202:
24-
result = DeviceIdType.DEVELOPER_SUPPLIED;
25-
break;
26-
case 30303:
27-
result = DeviceIdType.TEMPORARY_ID;
28-
break;
29-
default:
30-
L.e("_getDeviceIdType, " + `unexpected deviceIdType [${deviceIdType}] from native side`);
31-
result = DeviceIdType.SDK_GENERATED;
32-
break;
20+
case 10101:
21+
result = DeviceIdType.SDK_GENERATED;
22+
break;
23+
case 20202:
24+
result = DeviceIdType.DEVELOPER_SUPPLIED;
25+
break;
26+
case 30303:
27+
result = DeviceIdType.TEMPORARY_ID;
28+
break;
29+
default:
30+
L.e("_getDeviceIdType, " + `unexpected deviceIdType [${deviceIdType}] from native side`);
31+
result = DeviceIdType.SDK_GENERATED;
32+
break;
3333
}
3434
L.d(`_getDeviceIdType, DeviceIDType: ${result}`);
3535
return result;
@@ -134,6 +134,50 @@ function configToJson(config) {
134134
if (config.attributionValues) {
135135
json.attributionValues = config.attributionValues;
136136
}
137+
// Limits -----------------------------------------------
138+
if (config.sdkInternalLimits.maxKeyLength) {
139+
if (config.sdkInternalLimits.maxKeyLength < 1) {
140+
L.w(`configToJson, Provided value for maxKeyLength is invalid!`)
141+
} else {
142+
json.maxKeyLength = config.sdkInternalLimits.maxKeyLength;
143+
}
144+
}
145+
if (config.sdkInternalLimits.maxValueSize) {
146+
if (config.sdkInternalLimits.maxValueSize < 1) {
147+
L.w(`configToJson, Provided value for maxValueSize is invalid!`)
148+
} else {
149+
json.maxValueSize = config.sdkInternalLimits.maxValueSize;
150+
}
151+
}
152+
if (config.sdkInternalLimits.maxSegmentationValues) {
153+
if (config.sdkInternalLimits.maxSegmentationValues < 1) {
154+
L.w(`configToJson, Provided value for maxSegmentationValues is invalid!`)
155+
} else {
156+
json.maxSegmentationValues = config.sdkInternalLimits.maxSegmentationValues;
157+
}
158+
}
159+
if (config.sdkInternalLimits.maxBreadcrumbCount) {
160+
if (config.sdkInternalLimits.maxBreadcrumbCount < 1) {
161+
L.w(`configToJson, Provided value for maxBreadcrumbCount is invalid!`)
162+
} else {
163+
json.maxBreadcrumbCount = config.sdkInternalLimits.maxBreadcrumbCount;
164+
}
165+
}
166+
if (config.sdkInternalLimits.maxStackTraceLinesPerThread) {
167+
if (config.sdkInternalLimits.maxStackTraceLinesPerThread < 1) {
168+
L.w(`configToJson, Provided value for maxStackTraceLinesPerThread is invalid!`)
169+
} else {
170+
json.maxStackTraceLinesPerThread = config.sdkInternalLimits.maxStackTraceLinesPerThread;
171+
}
172+
}
173+
if (config.sdkInternalLimits.maxStackTraceLineLength) {
174+
if (config.sdkInternalLimits.maxStackTraceLineLength < 1) {
175+
L.w(`configToJson, Provided value for maxStackTraceLineLength is invalid!`)
176+
} else {
177+
json.maxStackTraceLineLength = config.sdkInternalLimits.maxStackTraceLineLength;
178+
}
179+
}
180+
// Limits End --------------------------------------------
137181
} catch (err) {
138182
L.e(`configToJson, Exception occured during converting config to json.${err.toString()}`);
139183
}

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ repositories {
4141

4242
dependencies {
4343
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
44-
implementation 'ly.count.android:sdk:24.4.0'
44+
implementation 'ly.count.android:sdk:24.4.1'
4545
}

android/src/main/java/ly/count/android/sdk/react/CountlyReactNative.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public String toString() {
8585
public class CountlyReactNative extends ReactContextBaseJavaModule implements LifecycleEventListener {
8686

8787
public static final String TAG = "CountlyRNPlugin";
88-
private String COUNTLY_RN_SDK_VERSION_STRING = "24.4.0";
88+
private String COUNTLY_RN_SDK_VERSION_STRING = "24.4.1";
8989
private String COUNTLY_RN_SDK_NAME = "js-rnb-android";
9090

9191
private static final CountlyConfig config = new CountlyConfig();
@@ -231,6 +231,26 @@ private void populateConfig(JSONObject _config) {
231231
config.setRecordAppStartTime(_config.getBoolean("enableApm"));
232232
}
233233
// APM END --------------------------------------------
234+
// Limits -----------------------------------------------
235+
if(_config.has("maxKeyLength")) {
236+
config.sdkInternalLimits.setMaxKeyLength(_config.getInt("maxKeyLength"));
237+
}
238+
if(_config.has("maxValueSize")) {
239+
config.sdkInternalLimits.setMaxValueSize(_config.getInt("maxValueSize"));
240+
}
241+
if(_config.has("maxSegmentationValues")) {
242+
config.sdkInternalLimits.setMaxSegmentationValues(_config.getInt("maxSegmentationValues"));
243+
}
244+
if(_config.has("maxBreadcrumbCount")) {
245+
config.sdkInternalLimits.setMaxBreadcrumbCount(_config.getInt("maxBreadcrumbCount"));
246+
}
247+
if(_config.has("maxStackTraceLinesPerThread")) {
248+
config.sdkInternalLimits.setMaxStackTraceLinesPerThread(_config.getInt("maxStackTraceLinesPerThread"));
249+
}
250+
if(_config.has("maxStackTraceLineLength")) {
251+
config.sdkInternalLimits.setMaxStackTraceLineLength(_config.getInt("maxStackTraceLineLength"));
252+
}
253+
// Limits End -------------------------------------------
234254
if (_config.has("crashReporting")) {
235255
config.enableCrashReporting();
236256
}

example/CountlyRNExample/Configuration.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,13 @@ const countlyConfig = new CountlyConfig(COUNTLY_SERVER_KEY, COUNTLY_APP_KEY).set
2929
// .enableManualAppLoadedTrigger()
3030
// .setAppStartTimestampOverride(11223344);
3131

32+
// Countly SDK Limits ========================================
33+
// countlyConfig.limits
34+
// .setMaxKeyLength()
35+
// .setMaxValueSize()
36+
// .setMaxSegmentationValues()
37+
// .setMaxBreadcrumbCount()
38+
// .setMaxStackTraceLineLength()
39+
// .setMaxStackTraceLinesPerThread();
40+
3241
export default countlyConfig;

ios/src/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 24.4.1
2+
* Added support for Feedback Widget terms and conditions
3+
4+
* Mitigated an issue where SDK limits could affect internal keys
5+
* Mitigated an issue that enabled recording reserved events
6+
* Mitigated an issue where timed events could have no ID
7+
* Mitigated an issue where internal limits were not being applied to some values
8+
* Mitigated an issue where the request queue could overflow while sending a request
9+
10+
* Removed timestamps from crash breadcrumbs
11+
112
## 24.4.0
213
* Added `attemptToSendStoredRequests` method to combine all events in event queue into a request and attempt to process stored requests
314
* Added the iOS privacy manifest to the Countly SDK

ios/src/Countly-PL.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Countly-PL'
3-
s.version = '24.4.0'
3+
s.version = '24.4.1'
44
s.license = { :type => 'MIT', :file => 'LICENSE' }
55
s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.'
66
s.homepage = 'https://github.com/Countly/countly-sdk-ios'

0 commit comments

Comments
 (0)