Skip to content

Commit f834c73

Browse files
committed
Merge branch 'staging' of github.com:Countly/countly-sdk-react-native-bridge into staging-np
2 parents 333c3fc + 0f939c5 commit f834c73

23 files changed

+309
-46
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 25.1.1-np
2+
3+
* Updated the underlying Android SDK version to 25.1.1
4+
* Updated the underlying iOS SDK version to 25.1.1
5+
16
## 25.1.0-np
27
* ! Minor breaking change ! `Countly.userDataBulk.save()` method is now optional. SDK will save the cached data with internal triggers regularly.
38

Countly.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,20 @@ declare module "countly-sdk-react-native-bridge-np/CountlyConfig" {
11841184
enableVisibilityTracking(): this;
11851185
}
11861186

1187+
interface content {
1188+
/**
1189+
*
1190+
* @param zoneTimerInterval - the interval in seconds to check for new content
1191+
*/
1192+
setZoneTimerInterval(zoneTimerInterval: number): this;
1193+
1194+
/**
1195+
*
1196+
* @param callback - callback to be called when new content is available
1197+
*/
1198+
setGlobalContentCallback(callback: Function): this;
1199+
}
1200+
11871201
/**
11881202
*
11891203
* This class holds APM specific configurations to be used with
@@ -1281,6 +1295,11 @@ declare module "countly-sdk-react-native-bridge-np/CountlyConfig" {
12811295
*/
12821296
experimental: experimental;
12831297

1298+
/**
1299+
* getter for content features
1300+
*/
1301+
content: content;
1302+
12841303
/**
12851304
* Method to set the server url
12861305
*

Countly.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ Countly.initWithConfig = async function (countlyConfig) {
9494
return;
9595
}
9696
L.d("initWithConfig, Initializing Countly");
97+
if (countlyConfig.content.contentCallback) {
98+
eventEmitter.addListener("globalContentCallback", (data) => {
99+
L.d(`init configuration, Global content callback called with data: ${data}`);
100+
try {
101+
data = JSON.parse(data);
102+
countlyConfig.content.contentCallback(data.status, data.data);
103+
} catch (error) {
104+
L.e(`init configuration, Error parsing global content callback data: ${error}`);
105+
}
106+
});
107+
}
97108
const args = [];
98109
const argsMap = Utils.configToJson(countlyConfig);
99110
const argsString = JSON.stringify(argsMap);

CountlyConfig.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { initialize } from "./Logger.js";
22
import CountlyConfigApm from "./lib/configuration_interfaces/countly_config_apm.js";
33
import CountlyConfigSDKInternalLimits from "./lib/configuration_interfaces/countly_config_limits.js";
44
import CountlyConfigExp from "./lib/configuration_interfaces/countly_config_experimental.js";
5+
import CountlyConfigContent from "./lib/configuration_interfaces/countly_config_content.js";
56
const BUILDING_WITH_PUSH_DISABLED = true;
67
/**
78
* Countly SDK React Native Bridge
@@ -25,6 +26,7 @@ class CountlyConfig {
2526
this._countlyConfigApmInstance = new CountlyConfigApm();
2627
this._countlyConfigSDKLimitsInstance = new CountlyConfigSDKInternalLimits();
2728
this._countlyConfigExpInstance = new CountlyConfigExp();
29+
this._countlyConfigContentInstance = new CountlyConfigContent();
2830
}
2931

3032
/**
@@ -52,6 +54,13 @@ class CountlyConfig {
5254
return this._countlyConfigExpInstance;
5355
}
5456

57+
/**
58+
* Getter to get the content specific configurations
59+
*/
60+
get content() {
61+
return this._countlyConfigContentInstance;
62+
}
63+
5564
get _crashReporting() {
5665
return this.#crashReporting;
5766
}

Utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ function configToJson(config) {
117117
json.enableVisibilityTracking = true;
118118
L.i(`init configuration, Enabled visibility tracking`)
119119
}
120+
if (config.content.timerInterval) {
121+
json.setZoneTimerInterval = config.content.timerInterval;
122+
L.i(`init configuration, Set zone timer interval to ${config.content.timerInterval}`)
123+
}
124+
if (config.content.contentCallback) {
125+
json.setGlobalContentCallback = true;
126+
L.i(`init configuration, Set global content callback`)
127+
}
120128
if (config._disableIntentRedirectionCheck) {
121129
json.disableAdditionalIntentRedirectionChecks = true;
122130
L.i(`init configuration, Disabled additional intent redirection checks`)

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.7.8'
44+
implementation 'ly.count.android:sdk:25.1.1'
4545
}

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import ly.count.android.sdk.RCDownloadCallback;
2828
import ly.count.android.sdk.RemoteConfigCallback;
2929
import ly.count.android.sdk.FeedbackRatingCallback;
30+
import ly.count.android.sdk.ContentCallback;
31+
import ly.count.android.sdk.ContentStatus;
3032

3133
import java.io.BufferedReader;
3234
import java.io.IOException;
@@ -238,6 +240,27 @@ private void populateConfig(JSONObject _config) {
238240
if (_config.has("enableVisibilityTracking")) {
239241
config.experimental.enableVisibilityTracking();
240242
}
243+
if (_config.has("setZoneTimerInterval")) {
244+
config.content.setZoneTimerInterval(_config.getInt("setZoneTimerInterval"));
245+
}
246+
if (_config.has("setGlobalContentCallback")) {
247+
config.content.setGlobalContentCallback(new ContentCallback() {
248+
@Override
249+
public void onContentCallback(ContentStatus contentStatus,Map<String, Object> contentData) {
250+
JSONObject contentMap = new JSONObject();
251+
try {
252+
contentMap.put("status", contentStatus.toString());
253+
contentMap.put("data", new JSONObject(contentData));
254+
} catch (JSONException e) {
255+
log("onContentCallback, JSON exception: ", e, LogLevel.ERROR);
256+
}
257+
258+
((ReactApplicationContext) _reactContext)
259+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
260+
.emit("globalContentCallback", contentMap.toString());
261+
}
262+
});
263+
}
241264
// Limits -----------------------------------------------
242265
if(_config.has("maxKeyLength")) {
243266
config.sdkInternalLimits.setMaxKeyLength(_config.getInt("maxKeyLength"));

example/CountlyRNExample/Configuration.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,9 @@ const countlyConfig = new CountlyConfig(COUNTLY_SERVER_KEY, COUNTLY_APP_KEY).set
4242
// .enablePreviousNameRecording()
4343
// .enableVisibilityTracking();
4444

45+
// countlyConfig.content.setZoneTimerInterval(120);
46+
// countlyConfig.content.setGlobalContentCallback((status: string, data: object) => {
47+
// console.log("Global content callback", status, data);
48+
// });
49+
4550
export default countlyConfig;

ios/src/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 25.1.1
2+
* Mitigated an issue while setting zone timer interval for content.
3+
4+
## 25.1.0
5+
* Added dynamic resizing functionality for the content zone
6+
* Added a config option to content (setZoneTimerInterval) to set content zone timer. (Experimental!)
7+
8+
* Improved management of content zone size for better responsiveness
9+
* Fixed an issue where the build UUID and executable name were missing from crash reports
10+
111
## 24.7.9
212
* Improved view tracking capabilities
313

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.7.9'
3+
s.version = '25.1.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)