Skip to content

Commit 346b82e

Browse files
committed
version update
1 parent 6a7d360 commit 346b82e

File tree

17 files changed

+213
-16
lines changed

17 files changed

+213
-16
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
## 25.4.1
2+
* Improved Content display mechanics.
3+
* Added "setRequestTimeoutDuration" init config parameter to change request timeout duration in seconds.
4+
* Added a new function "recordMetrics(metricsOverride)" to send a manual metrics requests.
5+
* Added a new Consent option "metrics" for controlling "recordMetrics" method. (This has no effect on Session metrics.)
6+
* Added event listener calls for new architecture (thanks @j-q-in-berlin)
7+
8+
* Mitigated an issue in SDK limits config class initialization (thanks @albertlaiuste)
9+
10+
* Android specific changes:
11+
* Improved disk size calculation in crash reports.
12+
* Mitigated an issue that could have happened when navigating back from a Content.
13+
* Mitigated a persistency issue with init configuration provided SBS and its initial state.
14+
* Mitigated an issue where SBS could have been fetched twice.
15+
16+
* iOS specific changes:
17+
* Improved CPU architecture detection capabilities.
18+
* Added the ability to record reserved events.
19+
* Changed default log level from "Debug" to "Verbose".
20+
* Mitigated an SBS issue while in temporary ID mode.
21+
* Mitigated a possible Health Check network log recording issue.
22+
23+
* Updated the underlying Android SDK version to 25.4.4
24+
* Updated the underlying iOS SDK version to 25.4.6
25+
126
## 25.4.0
227
* ! Minor breaking change ! The SDK now exclusively uses random UUIDs for device id generation instead of platform specific OpenUDID or IDFV
328
* ! Minor breaking change ! Server Configuration is now enabled by default. Changes made on SDK Manager > SDK Configuration on your server will affect SDK behavior directly

Countly.d.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,13 @@ declare module "countly-sdk-react-native-bridge" {
516516
*/
517517
export function addCrashLog(crashLog: string): string | void;
518518

519+
520+
/**
521+
* Record a metrics request to be sent to the server
522+
* @param {Record<string, string>} [metricsOverride] - optional metrics override map
523+
*/
524+
export function recordMetrics(metricsOverride?: Record<string, string>): void;
525+
519526
/**
520527
*
521528
* Log exception for Countly
@@ -1353,7 +1360,7 @@ declare module "countly-sdk-react-native-bridge/CountlyConfig" {
13531360
*
13541361
* @param {string[]} consents consents e.g ['location', 'sessions',
13551362
* 'attribution', 'push', 'events', 'views', 'crashes', 'users', 'push',
1356-
* 'star-rating', 'apm', 'feedback', 'remote-config']
1363+
* 'star-rating', 'apm', 'feedback', 'remote-config', 'metrics']
13571364
*/
13581365
giveConsent(consents: readonly string[]): CountlyConfig;
13591366

@@ -1479,6 +1486,14 @@ declare module "countly-sdk-react-native-bridge/CountlyConfig" {
14791486
* @return {CountlyConfig}
14801487
*/
14811488
setSDKBehaviorSettings(settingsObject: object): CountlyConfig;
1489+
1490+
/**
1491+
* Method to set the request timeout duration
1492+
*
1493+
* @param {number} requestTimeoutDuration - request timeout duration in seconds
1494+
* @return {CountlyConfig}
1495+
*/
1496+
setRequestTimeoutDuration(requestTimeoutDuration: number): CountlyConfig;
14821497
}
14831498

14841499
export default CountlyConfig;

Countly.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,29 @@ Countly.addCrashLog = function (crashLog) {
619619
CountlyNativeModule.addCrashLog([crashLog]);
620620
};
621621

622+
/**
623+
* Record a metrics request to be sent to the server
624+
*
625+
* @param {object} [metricsOverride] - optional metrics override map
626+
*/
627+
Countly.recordMetrics = function (metricsOverride = {}) {
628+
if (!_state.isInitialized) {
629+
L.e(`recordMetrics, 'init' must be called before 'recordMetrics'`);
630+
}
631+
L.d(`recordMetrics, Sending metrics request with override: [${JSON.stringify(metricsOverride)}]`);
632+
if (metricsOverride && typeof metricsOverride !== "object") {
633+
L.w(`recordMetrics, ignoring non-object metricsOverride of type '${typeof metricsOverride}'`);
634+
metricsOverride = {};
635+
}
636+
637+
const args = [];
638+
for (const key in metricsOverride) {
639+
args.push(key.toString());
640+
args.push(metricsOverride[key].toString());
641+
}
642+
CountlyNativeModule.recordMetrics(args);
643+
};
644+
622645
/**
623646
*
624647
* Log exception for Countly

CountlyConfig.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class CountlyConfig {
2929

3030
#sdkBehaviorSettings;
3131

32+
#requestTimeoutDuration;
33+
3234
constructor(serverURL, appKey) {
3335
this.serverURL = serverURL;
3436
this.appKey = appKey;
@@ -90,6 +92,10 @@ class CountlyConfig {
9092
return this.#sdkBehaviorSettings;
9193
}
9294

95+
get _requestTimeoutDuration() {
96+
return this.#requestTimeoutDuration;
97+
}
98+
9399
/**
94100
* Method to set the server url
95101
*
@@ -120,6 +126,17 @@ class CountlyConfig {
120126
return this;
121127
}
122128

129+
/**
130+
* Method to set the request timeout duration
131+
*
132+
* @param {Number} timeout - request timeout duration in seconds
133+
* @returns {CountlyConfig} this
134+
*/
135+
setRequestTimeoutDuration(timeout) {
136+
this.#requestTimeoutDuration = timeout;
137+
return this;
138+
}
139+
123140
/**
124141
* Method to enable countly internal debugging logs
125142
*

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 = '25.4.0'
3+
s.version = '25.4.1'
44
s.license = {
55
:type => 'COMMUNITY',
66
:text => <<-LICENSE

Utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ function configToJson(config) {
172172
json.campaignData = config.campaignData;
173173
L.i(`init configuration, Campaign type: ${config.campaignType}, Campaign data: ${config.campaignData}`);
174174
}
175+
if (config._requestTimeoutDuration) {
176+
json.requestTimeoutDuration = config._requestTimeoutDuration;
177+
L.i(`init configuration, Request timeout duration: ${config._requestTimeoutDuration}`);
178+
}
175179
if (config.attributionValues) {
176180
json.attributionValues = config.attributionValues;
177181
L.i(`init configuration, Attribution values: ${config.attributionValues}`);

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public class CountlyReactNativeImpl extends ReactContextBaseJavaModule implement
9292

9393
public static final String NAME = "CountlyReactNative";
9494
public static final String TAG = "CountlyRNPlugin";
95-
private String COUNTLY_RN_SDK_VERSION_STRING = "25.4.0";
95+
private String COUNTLY_RN_SDK_VERSION_STRING = "25.4.1";
9696
private String COUNTLY_RN_SDK_NAME = "js-rnb-android";
9797

9898
private static final CountlyConfig config = new CountlyConfig();
@@ -364,6 +364,14 @@ public void onContentCallback(ContentStatus contentStatus,Map<String, Object> co
364364
log("RecordIndirectAttribution: failure, no attribution values provided", LogLevel.DEBUG);
365365
}
366366
}
367+
if (_config.has("requestTimeoutDuration")) {
368+
int timeout = _config.getInt("requestTimeoutDuration");
369+
if (timeout > 0) {
370+
config.setRequestTimeoutDuration(timeout);
371+
} else {
372+
log("setRequestTimeoutDuration: failure, timeout value must be greater than 0", LogLevel.DEBUG);
373+
}
374+
}
367375
if (_config.has("disableSDKBehaviorSettingsUpdates")) {
368376
boolean disableUpdates = _config.getBoolean("disableSDKBehaviorSettingsUpdates");
369377
if (disableUpdates) {
@@ -727,6 +735,16 @@ public void addCrashLog(ReadableArray args) {
727735
Countly.sharedInstance().crashes().addCrashBreadcrumb(record);
728736
}
729737

738+
public void recordMetrics(ReadableArray args) {
739+
Map<String, String> metricsMap = new HashMap<>();
740+
for (int i = 0; i < args.size(); i += 2) {
741+
String key = args.getString(i);
742+
String value = args.getString(i + 1);
743+
metricsMap.put(key, value);
744+
}
745+
Countly.sharedInstance().requestQueue().recordMetrics(metricsMap);
746+
}
747+
730748

731749
public void logException(ReadableArray args) {
732750
String exceptionString = args.getString(0);
@@ -1786,4 +1804,12 @@ public void onHostPause() {
17861804
public void onHostDestroy() {
17871805

17881806
}
1807+
1808+
public void addListener(String eventType) {
1809+
log("addListener", LogLevel.ERROR);
1810+
}
1811+
1812+
public void removeListeners(double id) {
1813+
log("removeListeners", LogLevel.ERROR);
1814+
}
17891815
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ public void logException(ReadableArray args) {
201201
this.impl.logException(args);
202202
}
203203

204+
@Override
205+
public void recordMetrics(ReadableArray args) {
206+
this.impl.recordMetrics(args);
207+
}
208+
204209
@Override
205210
public void logJSException(String err, String message, String stack) {
206211
this.impl.logJSException(err, message, stack);
@@ -568,4 +573,14 @@ public void setID(String newDeviceID) {
568573
public void setCustomMetrics(ReadableArray args) {
569574
this.impl.setCustomMetrics(args);
570575
}
576+
577+
@Override
578+
public void addListener(String eventType) {
579+
this.impl.addListener(eventType);
580+
}
581+
582+
@Override
583+
public void removeListeners(double id) {
584+
this.impl.removeListeners(id);
585+
}
571586
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ public void addCrashLog(ReadableArray args) {
102102
this.impl.addCrashLog(args);
103103
}
104104

105+
@ReactMethod
106+
public void recordMetrics(ReadableArray args) {
107+
this.impl.recordMetrics(args);
108+
}
109+
105110
@ReactMethod
106111
public void logException(ReadableArray args) {
107112
this.impl.logException(args);
@@ -476,4 +481,14 @@ public void setID(String newDeviceID) {
476481
public void setCustomMetrics(ReadableArray args) {
477482
this.impl.setCustomMetrics(args);
478483
}
484+
485+
@ReactMethod
486+
public void addListener(String eventType) {
487+
this.impl.addListener(eventType);
488+
}
489+
490+
@ReactMethod
491+
public void removeListeners(double id) {
492+
this.impl.removeListeners(id);
493+
}
479494
}

example/CountlyRNExample/Configuration.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const countlyConfig = new CountlyConfig(COUNTLY_SERVER_KEY, COUNTLY_APP_KEY).set
2121
// .setStarRatingDialogTexts('Title', 'Message', 'Dismiss')
2222
// .recordDirectAttribution('countly', campaignData)
2323
// .recordIndirectAttribution(attributionValues)
24+
// .setRequestTimeoutDuration(60) // Set custom request timeout duration in seconds (default is 30 seconds)
2425

2526
// APM configuration ========================================
2627
// countlyConfig.apm

0 commit comments

Comments
 (0)