Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Rıza Kat committed Sep 26, 2024
1 parent 1dc1e21 commit c5f0a0d
Show file tree
Hide file tree
Showing 35 changed files with 650 additions and 128 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
## 24.4.1-np
* Added support for Feedback Widget terms and conditions
* Added six new configuration options under the 'sdkInternalLimits' interface of 'CountlyConfig':
* 'setMaxKeyLength' for limiting the maximum size of all user provided string keys
* 'setMaxValueSize' for limiting the size of all values in user provided segmentation key-value pairs
* 'setMaxSegmentationValues' for limiting the max amount of user provided segmentation key-value pair count in one event
* 'setMaxBreadcrumbCount' for limiting the max amount of breadcrumbs that can be recorded before the oldest one is deleted
* 'setMaxStackTraceLinesPerThread' for limiting the max amount of stack trace lines to be recorded per thread
* 'setMaxStackTraceLineLength' for limiting the max characters allowed per stack trace lines

* Android Specific Changes:
* ! Minor breaking change ! Introduced SDK internal limits
* Mitigated an issue where the session duration could have been calculated wrongly after a device ID change without merge
* Mitigated an issue where a session could have continued after a device ID change without merge

* iOS Specific Changes:
* Mitigated an issue where internal limits were not being applied to some values
* Mitigated an issue where SDK limits could affect internal keys
* Mitigated an issue that enabled recording reserved events
* Mitigated an issue where timed events could have no ID
* Mitigated an issue where the request queue could overflow while sending a request
* Removed timestamps from crash breadcrumbs

* Updated the underlying Android SDK version to 24.4.1
* Updated the underlying iOS SDK version to 24.4.1

## 24.4.0-np
* This flavor is a "no Push Notification" variant of the Countly React Native SDK branched from the same version.
* All FCM related code is removed.
Expand Down
42 changes: 42 additions & 0 deletions Countly.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,44 @@ declare module "countly-sdk-react-native-bridge-np/CountlyConfig" {
setAppStartTimestampOverride(timestamp: number): CountlyConfigApm;
}

class CountlyConfigSDKInternalLimits {
/**
* Limits the maximum size of all string keys
* @param keyLengthLimit - maximum char size of all string keys (default 128 chars)
*/
setMaxKeyLength(keyLengthLimit: number) : CountlyConfigSDKInternalLimits;

/**
* Limits the size of all values in segmentation key-value pairs
* @param valueSizeLimit - the maximum char size of all values in our key-value pairs (default 256 chars)
*/
setMaxValueSize(valueSizeLimit: number) : CountlyConfigSDKInternalLimits;

/**
* Limits the max amount of custom segmentation in one event
* @param segmentationAmountLimit - the maximum amount of custom segmentation in one event (default 100 key-value pairs)
*/
setMaxSegmentationValues(segmentationAmountLimit: number) : CountlyConfigSDKInternalLimits;

/**
* Limits the max amount of breadcrumbs that can be recorded before the oldest one is deleted
* @param breadcrumbCountLimit - the maximum amount of breadcrumbs that can be recorded before the oldest one is deleted (default 100)
*/
setMaxBreadcrumbCount(breadcrumbCountLimit: number) : CountlyConfigSDKInternalLimits;

/**
* Limits the max amount of stack trace lines to be recorded per thread
* @param stackTraceLinesPerThreadLimit - maximum amount of stack trace lines to be recorded per thread (default 30)
*/
setMaxStackTraceLinesPerThread(stackTraceLinesPerThreadLimit: number) : CountlyConfigSDKInternalLimits;

/**
* Limits the max characters allowed per stack trace lines. Also limits the crash message length
* @param stackTraceLineLengthLimit - maximum length of each stack trace line (default 200)
*/
setMaxStackTraceLineLength(stackTraceLineLengthLimit: number) : CountlyConfigSDKInternalLimits;
}

/**
*
* Config object for Countly Init
Expand All @@ -1150,6 +1188,10 @@ declare module "countly-sdk-react-native-bridge-np/CountlyConfig" {
* getter for CountlyConfigApm instance that is used to access CountlyConfigApm methods
*/
apm: CountlyConfigApm;
/**
* getter for CountlySDKLimits instance that is used to access CountlyConfigSDKInternalLimits methods
*/
sdkInternalLimits: CountlyConfigSDKInternalLimits;

/**
* Method to set the server url
Expand Down
6 changes: 6 additions & 0 deletions CountlyConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { initialize } from "./Logger.js";
import CountlyConfigApm from "./lib/configuration_interfaces/countly_config_apm.js";
import CountlyConfigSDKInternalLimits from "./lib/configuration_interfaces/countly_config_limits.js";

const BUILDING_WITH_PUSH_DISABLED = true;

Expand All @@ -20,6 +21,7 @@ class CountlyConfig {
this.serverURL = serverURL;
this.appKey = appKey;
this._countlyConfigApmInstance = new CountlyConfigApm();
this._countlyConfigSDKLimitsInstance = new CountlyConfigSDKInternalLimits();
}

/**
Expand All @@ -29,6 +31,10 @@ class CountlyConfig {
return this._countlyConfigApmInstance;
}

get sdkInternalLimits() {
return this._countlyConfigSDKLimitsInstance;
}

/**
* Method to set the server url
*
Expand Down
2 changes: 1 addition & 1 deletion CountlyReactNative.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'CountlyReactNative'
s.version = '24.4.0'
s.version = '24.4.1'
s.license = {
:type => 'COMMUNITY',
:text => <<-LICENSE
Expand Down
70 changes: 57 additions & 13 deletions Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ const DeviceIdType = {
function intToDeviceIDType(deviceIdType) {
let result = null;
switch (deviceIdType) {
case 10101:
result = DeviceIdType.SDK_GENERATED;
break;
case 20202:
result = DeviceIdType.DEVELOPER_SUPPLIED;
break;
case 30303:
result = DeviceIdType.TEMPORARY_ID;
break;
default:
L.e("_getDeviceIdType, " + `unexpected deviceIdType [${deviceIdType}] from native side`);
result = DeviceIdType.SDK_GENERATED;
break;
case 10101:
result = DeviceIdType.SDK_GENERATED;
break;
case 20202:
result = DeviceIdType.DEVELOPER_SUPPLIED;
break;
case 30303:
result = DeviceIdType.TEMPORARY_ID;
break;
default:
L.e("_getDeviceIdType, " + `unexpected deviceIdType [${deviceIdType}] from native side`);
result = DeviceIdType.SDK_GENERATED;
break;
}
L.d(`_getDeviceIdType, DeviceIDType: ${result}`);
return result;
Expand Down Expand Up @@ -134,6 +134,50 @@ function configToJson(config) {
if (config.attributionValues) {
json.attributionValues = config.attributionValues;
}
// Limits -----------------------------------------------
if (config.sdkInternalLimits.maxKeyLength) {
if (config.sdkInternalLimits.maxKeyLength < 1) {
L.w(`configToJson, Provided value for maxKeyLength is invalid!`)
} else {
json.maxKeyLength = config.sdkInternalLimits.maxKeyLength;
}
}
if (config.sdkInternalLimits.maxValueSize) {
if (config.sdkInternalLimits.maxValueSize < 1) {
L.w(`configToJson, Provided value for maxValueSize is invalid!`)
} else {
json.maxValueSize = config.sdkInternalLimits.maxValueSize;
}
}
if (config.sdkInternalLimits.maxSegmentationValues) {
if (config.sdkInternalLimits.maxSegmentationValues < 1) {
L.w(`configToJson, Provided value for maxSegmentationValues is invalid!`)
} else {
json.maxSegmentationValues = config.sdkInternalLimits.maxSegmentationValues;
}
}
if (config.sdkInternalLimits.maxBreadcrumbCount) {
if (config.sdkInternalLimits.maxBreadcrumbCount < 1) {
L.w(`configToJson, Provided value for maxBreadcrumbCount is invalid!`)
} else {
json.maxBreadcrumbCount = config.sdkInternalLimits.maxBreadcrumbCount;
}
}
if (config.sdkInternalLimits.maxStackTraceLinesPerThread) {
if (config.sdkInternalLimits.maxStackTraceLinesPerThread < 1) {
L.w(`configToJson, Provided value for maxStackTraceLinesPerThread is invalid!`)
} else {
json.maxStackTraceLinesPerThread = config.sdkInternalLimits.maxStackTraceLinesPerThread;
}
}
if (config.sdkInternalLimits.maxStackTraceLineLength) {
if (config.sdkInternalLimits.maxStackTraceLineLength < 1) {
L.w(`configToJson, Provided value for maxStackTraceLineLength is invalid!`)
} else {
json.maxStackTraceLineLength = config.sdkInternalLimits.maxStackTraceLineLength;
}
}
// Limits End --------------------------------------------
} catch (err) {
L.e(`configToJson, Exception occured during converting config to json.${err.toString()}`);
}
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ repositories {

dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
implementation 'ly.count.android:sdk:24.4.0'
implementation 'ly.count.android:sdk:24.4.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public String toString() {
public class CountlyReactNative extends ReactContextBaseJavaModule implements LifecycleEventListener {

public static final String TAG = "CountlyRNPlugin";
private String COUNTLY_RN_SDK_VERSION_STRING = "24.4.0";
private String COUNTLY_RN_SDK_VERSION_STRING = "24.4.1";
private String COUNTLY_RN_SDK_NAME = "js-rnb-android";

private static final CountlyConfig config = new CountlyConfig();
Expand Down Expand Up @@ -231,6 +231,26 @@ private void populateConfig(JSONObject _config) {
config.setRecordAppStartTime(_config.getBoolean("enableApm"));
}
// APM END --------------------------------------------
// Limits -----------------------------------------------
if(_config.has("maxKeyLength")) {
config.sdkInternalLimits.setMaxKeyLength(_config.getInt("maxKeyLength"));
}
if(_config.has("maxValueSize")) {
config.sdkInternalLimits.setMaxValueSize(_config.getInt("maxValueSize"));
}
if(_config.has("maxSegmentationValues")) {
config.sdkInternalLimits.setMaxSegmentationValues(_config.getInt("maxSegmentationValues"));
}
if(_config.has("maxBreadcrumbCount")) {
config.sdkInternalLimits.setMaxBreadcrumbCount(_config.getInt("maxBreadcrumbCount"));
}
if(_config.has("maxStackTraceLinesPerThread")) {
config.sdkInternalLimits.setMaxStackTraceLinesPerThread(_config.getInt("maxStackTraceLinesPerThread"));
}
if(_config.has("maxStackTraceLineLength")) {
config.sdkInternalLimits.setMaxStackTraceLineLength(_config.getInt("maxStackTraceLineLength"));
}
// Limits End -------------------------------------------
if (_config.has("crashReporting")) {
config.enableCrashReporting();
}
Expand Down
9 changes: 9 additions & 0 deletions example/CountlyRNExample/Configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,13 @@ const countlyConfig = new CountlyConfig(COUNTLY_SERVER_KEY, COUNTLY_APP_KEY).set
// .enableManualAppLoadedTrigger()
// .setAppStartTimestampOverride(11223344);

// Countly SDK Limits ========================================
// countlyConfig.limits
// .setMaxKeyLength()
// .setMaxValueSize()
// .setMaxSegmentationValues()
// .setMaxBreadcrumbCount()
// .setMaxStackTraceLineLength()
// .setMaxStackTraceLinesPerThread();

export default countlyConfig;
11 changes: 11 additions & 0 deletions ios/src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 24.4.1
* Added support for Feedback Widget terms and conditions

* Mitigated an issue where SDK limits could affect internal keys
* Mitigated an issue that enabled recording reserved events
* Mitigated an issue where timed events could have no ID
* Mitigated an issue where internal limits were not being applied to some values
* Mitigated an issue where the request queue could overflow while sending a request

* Removed timestamps from crash breadcrumbs

## 24.4.0
* Added `attemptToSendStoredRequests` method to combine all events in event queue into a request and attempt to process stored requests
* Added the iOS privacy manifest to the Countly SDK
Expand Down
2 changes: 1 addition & 1 deletion ios/src/Countly-PL.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Countly-PL'
s.version = '24.4.0'
s.version = '24.4.1'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'Countly is an innovative, real-time, open source mobile analytics platform.'
s.homepage = 'https://github.com/Countly/countly-sdk-ios'
Expand Down
Loading

0 comments on commit c5f0a0d

Please sign in to comment.