Skip to content

Commit 87599c7

Browse files
committed
Merge branch 'staging' of github.com:Countly/countly-sdk-react-native-bridge into staging-np
2 parents 1a8903a + d8273ec commit 87599c7

File tree

90 files changed

+5784
-988
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+5784
-988
lines changed

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
1+
## 25.1.0-np
2+
* ! Minor breaking change ! `Countly.userDataBulk.save()` method is now optional. SDK will save the cached data with internal triggers regularly.
3+
4+
* Added Content feature methods:
5+
* `enterContentZone`, to start Content checks (Experimental!)
6+
* `exitContentZone`, to stop Content checks (Experimental!)
7+
* Added feedback widget convenience methods to display the first available widget or the one meets the criteria:
8+
* `Countly.feedback.showNPS(nameIDorTag?: string, widgetClosedCallback?: WidgetCallback): void`
9+
* `Countly.feedback.showSurvey(nameIDorTag?: string, widgetClosedCallback?: WidgetCallback): void`
10+
* `Countly.feedback.showRating(nameIDorTag?: string, widgetClosedCallback?: WidgetCallback): void`
11+
* Added config interface `experimental` that provides experimental config options:
12+
* `.experimental.enablePreviousNameRecording()` for reporting previous event/view names
13+
* `.experimental.enableVisibilityTracking()` for reporting app visibility with events
14+
* Added `Countly.deviceId.setID` method for changing device ID based on the device ID type
15+
* Added support for Arrays of primitive types in event segmentation
16+
17+
* Deprecated following SDK calls:
18+
* `Countly.getCurrentDeviceId` (replaced with: `Countly.deviceId.getID`)
19+
* `Countly.getDeviceIDType` (replaced with: `Countly.deviceId.getType`)
20+
* `Countly.changeDeviceId` (replaced with: `Countly.deviceId.setID`)
21+
22+
* Mitigated an issue where a session could have started while the app was in the background when the device ID was changed (non-merge).
23+
* Mitigated an issue where intent redirection checks were disabled by default
24+
* Mitigated an issue crash tracking was not enabled with init config
25+
* Mitigated an issue where app start time tracking was on by default
26+
27+
* Android Specific Changes:
28+
* ! Minor breaking change ! Unsupported types for user properties will now be omitted, they won't be converted to strings.
29+
* Disabled caching for webviews.
30+
* Mitigated an issue in the upload plugin that prevented the upload of a symbol file
31+
* Resolved a problem where revoked consents were sent after changes without merging.
32+
* Mitigated an issue that caused the device ID to be incorrectly set after changes with merging.
33+
* Mitigated an issue where on consent revoke, remote config values were cleared, not anymore.
34+
35+
* iOS Specific Changes:
36+
* Orientation info is now also sent during initialization
37+
* Added visionOS build support
38+
* Updated the SDK to ensure compatibility with the latest server response models
39+
* Improved view tracking capabilities
40+
* Mitigated an issue with the feedback widget URL encoding on iOS 16 and earlier, which prevented the widget from displaying
41+
* Mitigated an issue with content fetch URL encoding on iOS 16 and earlier, which caused the request to fail
42+
* Mitigated an issue where the terms and conditions URL (`tc` key) was sent without double quotes
43+
* Mitigated an issue where consent information was not sent when no consent was given during initialization
44+
* Mitigated an issue where a session did not end when session consent was removed
45+
* Mitigated an issue where pausing a view resulted in a '0' view duration.
46+
* Mitigated an issue where the user provided URLSessionConfiguration was not applied to direct requests
47+
48+
* Updated the underlying Android SDK version to 24.7.8
49+
* Updated the underlying iOS SDK version to 24.7.9
50+
151
## 24.4.1-np
252
* Added support for Feedback Widget terms and conditions
353
* Added six new configuration options under the 'sdkInternalLimits' interface of 'CountlyConfig':

Countly.d.ts

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
interface Segmentation {
2-
[key: string]: number | string | boolean;
2+
[key: string]: number | string | boolean | (number | string | boolean)[];
33
}
44

55
interface CountlyEventOptions {
@@ -89,6 +89,29 @@ declare module "countly-sdk-react-native-bridge-np" {
8989
* Countly Feedback Module
9090
*/
9191
namespace feedback {
92+
93+
/**
94+
* Shows the first available NPS widget that meets the criteria.
95+
* @param {String} [nameIDorTag] - name, id, or tag of the widget to show (optional)
96+
* @param {callback} [widgetClosedCallback] - called when the widget is closed (optional)
97+
*/
98+
export function showNPS(nameIDorTag?: string, widgetClosedCallback?: WidgetCallback): void;
99+
100+
/**
101+
* Shows the first available survey widget that meets the criteria.
102+
* @param {String} [nameIDorTag] - name, id, or tag of the widget to show (optional)
103+
* @param {callback} [widgetClosedCallback] - called when the widget is closed (optional)
104+
*/
105+
export function showSurvey(nameIDorTag?: string, widgetClosedCallback?: WidgetCallback): void;
106+
107+
/**
108+
* Shows the first available rating widget that meets the criteria.
109+
* @param {String} [nameIDorTag] - name, id, or tag of the widget to show (optional)
110+
* @param {callback} [widgetClosedCallback] - called when the widget is closed (optional)
111+
*/
112+
export function showRating(nameIDorTag?: string, widgetClosedCallback?: WidgetCallback): void;
113+
114+
92115
/**
93116
* Get a list of available feedback widgets as an array of objects.
94117
* @param {FeedbackWidgetCallback} [onFinished] - returns (retrievedWidgets, error). This parameter is optional.
@@ -106,7 +129,7 @@ declare module "countly-sdk-react-native-bridge-np" {
106129
*
107130
* @return {ErrorObject} object {error: string or null}
108131
*/
109-
export function presentFeedbackWidget(feedbackWidget: FeedbackWidget, closeButtonText: string, widgetShownCallback: callback, widgetClosedCallback: callback): ErrorObject;
132+
export function presentFeedbackWidget(feedbackWidget: FeedbackWidget, closeButtonText: string, widgetShownCallback: WidgetCallback, widgetClosedCallback: WidgetCallback): ErrorObject;
110133

111134
/**
112135
* Get a feedback widget's data as an object.
@@ -176,6 +199,21 @@ declare module "countly-sdk-react-native-bridge-np" {
176199
export function cancelEvent(eventName: string): void;
177200
}
178201

202+
/**
203+
* Countly Content Module
204+
*/
205+
namespace content {
206+
/**
207+
* Opt in user for the content fetching and updates
208+
*/
209+
export function enterContentZone(): void;
210+
211+
/**
212+
* Opt out user from the content fetching and updates
213+
*/
214+
export function exitContentZone(): void;
215+
}
216+
179217
/**
180218
* Initialize Countly
181219
*
@@ -391,7 +429,8 @@ declare module "countly-sdk-react-native-bridge-np" {
391429
export function disableLocation(): string | void;
392430

393431
/**
394-
*
432+
* @deprecated use 'Countly.deviceId.getID' instead of 'Countly.getCurrentDeviceId'
433+
*
395434
* Get currently used device Id.
396435
* Should be called after Countly init
397436
*
@@ -400,6 +439,8 @@ declare module "countly-sdk-react-native-bridge-np" {
400439
export function getCurrentDeviceId(): Promise<string> | string;
401440

402441
/**
442+
* @deprecated use 'Countly.deviceId.getType' instead of 'Countly.getDeviceIDType'
443+
*
403444
* Get currently used device Id type.
404445
* Should be called after Countly init
405446
*
@@ -408,6 +449,8 @@ declare module "countly-sdk-react-native-bridge-np" {
408449
export function getDeviceIDType(): Promise<DeviceIdType> | null;
409450

410451
/**
452+
* @deprecated use 'Countly.deviceId.setID' instead of 'Countly.changeDeviceId'
453+
*
411454
* Change the current device id
412455
*
413456
* @param {string} newDeviceID id new device id
@@ -416,6 +459,34 @@ declare module "countly-sdk-react-native-bridge-np" {
416459
*/
417460
export function changeDeviceId(newDeviceID: string, onServer: boolean): string | void;
418461

462+
namespace deviceId {
463+
/**
464+
*
465+
* Get currently used device ID.
466+
* Should be called after Countly init
467+
*
468+
* @returns {string | null} device ID or null
469+
*/
470+
export function getID(): Promise<string> | string;
471+
472+
/**
473+
*
474+
* Get currently used device ID type.
475+
* Should be called after Countly init
476+
*
477+
* @return {DeviceIdType | null} deviceIdType or null
478+
*/
479+
export function getType(): Promise<DeviceIdType> | null;
480+
481+
/**
482+
* Sets device ID according to the device ID Type.
483+
* If previous ID was Developer Supplied sets it without merge, otherwise with merge.
484+
*
485+
* @param {string} newDeviceID device ID to set
486+
*/
487+
export function setID(newDeviceID: string): void;
488+
}
489+
419490
/**
420491
*
421492
* Set to "true" if you want HTTP POST to be used for all requests
@@ -1101,6 +1172,18 @@ declare module "countly-sdk-react-native-bridge-np" {
11011172
}
11021173

11031174
declare module "countly-sdk-react-native-bridge-np/CountlyConfig" {
1175+
interface experimental {
1176+
/**
1177+
* Enables previous name recording for views and events
1178+
*/
1179+
enablePreviousNameRecording(): this;
1180+
1181+
/**
1182+
* Enables app visibility tracking with events.
1183+
*/
1184+
enableVisibilityTracking(): this;
1185+
}
1186+
11041187
/**
11051188
*
11061189
* This class holds APM specific configurations to be used with
@@ -1193,6 +1276,11 @@ declare module "countly-sdk-react-native-bridge-np/CountlyConfig" {
11931276
*/
11941277
sdkInternalLimits: CountlyConfigSDKInternalLimits;
11951278

1279+
/**
1280+
* getter for experimental features
1281+
*/
1282+
experimental: experimental;
1283+
11961284
/**
11971285
* Method to set the server url
11981286
*

Countly.js

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import CountlyConfig from "./CountlyConfig.js";
1010
import CountlyState from "./CountlyState.js";
1111
import Feedback from "./Feedback.js";
1212
import Event from "./Event.js";
13+
import DeviceId from "./DeviceId.js";
1314
import * as L from "./Logger.js";
1415
import * as Utils from "./Utils.js";
1516
import * as Validate from "./Validators.js";
@@ -26,12 +27,15 @@ CountlyState.eventEmitter = eventEmitter;
2627

2728
Countly.feedback = new Feedback(CountlyState);
2829
Countly.events = new Event(CountlyState);
30+
Countly.deviceId = new DeviceId(CountlyState);
2931

3032
let _isCrashReportingEnabled = false;
3133

3234
Countly.userData = {}; // userData interface
3335
Countly.userDataBulk = {}; // userDataBulk interface
3436

37+
Countly.content = {}; // content interface
38+
3539
let _isPushInitialized = false;
3640

3741
const BUILDING_WITH_PUSH_DISABLED = true;
@@ -479,7 +483,8 @@ Countly.disableLocation = function () {
479483
};
480484

481485
/**
482-
*
486+
* @deprecated use 'Countly.deviceId.getID' instead of 'Countly.getCurrentDeviceId'
487+
*
483488
* Get currently used device Id.
484489
* Should be called after Countly init
485490
*
@@ -497,6 +502,8 @@ Countly.getCurrentDeviceId = async function () {
497502
};
498503

499504
/**
505+
* @deprecated use 'Countly.deviceId.getType' instead of 'Countly.getDeviceIDType'
506+
*
500507
* Get currently used device Id type.
501508
* Should be called after Countly init
502509
*
@@ -513,7 +520,9 @@ Countly.getDeviceIDType = async function () {
513520
};
514521

515522
/**
516-
* Change the current device id
523+
* @deprecated use 'Countly.deviceId.setID' instead of 'Countly.changeDeviceId' for setting device ID.
524+
*
525+
* Change the current device ID
517526
*
518527
* @param {string} newDeviceID id new device id
519528
* @param {boolean} onServer merge device id
@@ -2201,4 +2210,34 @@ Countly.setCustomMetrics = async function (customMetric) {
22012210
}
22022211
};
22032212

2213+
/**
2214+
* Opt in user for the content fetching and updates
2215+
*
2216+
* NOTE: This is an EXPERIMENTAL feature, and it can have breaking changes
2217+
*/
2218+
Countly.content.enterContentZone = function() {
2219+
L.i("enterContentZone, opting for content fetching.");
2220+
if (!_state.isInitialized) {
2221+
const message = "'init' must be called before 'enterContentZone'";
2222+
L.e(`enterContentZone, ${message}`);
2223+
return;
2224+
}
2225+
CountlyReactNative.enterContentZone();
2226+
};
2227+
2228+
/**
2229+
* Opt out user from the content fetching and updates
2230+
*
2231+
* NOTE: This is an EXPERIMENTAL feature, and it can have breaking changes
2232+
*/
2233+
Countly.content.exitContentZone = function() {
2234+
L.i("exitContentZone, opting out from content fetching.");
2235+
if (!_state.isInitialized) {
2236+
const message = "'init' must be called before 'exitContentZone'";
2237+
L.e(`exitContentZone, ${message}`);
2238+
return;
2239+
}
2240+
CountlyReactNative.exitContentZone();
2241+
};
2242+
22042243
export default Countly;

CountlyConfig.js

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
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";
4-
4+
import CountlyConfigExp from "./lib/configuration_interfaces/countly_config_experimental.js";
55
const BUILDING_WITH_PUSH_DISABLED = true;
6-
76
/**
87
* Countly SDK React Native Bridge
98
* https://github.com/Countly/countly-sdk-react-native-bridge
@@ -17,11 +16,15 @@ const BUILDING_WITH_PUSH_DISABLED = true;
1716
* @param {String} appKey application key
1817
*/
1918
class CountlyConfig {
19+
#crashReporting = false;
20+
#apmLegacy = false;
21+
#disableIntentRedirectionCheck = false;
2022
constructor(serverURL, appKey) {
2123
this.serverURL = serverURL;
2224
this.appKey = appKey;
2325
this._countlyConfigApmInstance = new CountlyConfigApm();
2426
this._countlyConfigSDKLimitsInstance = new CountlyConfigSDKInternalLimits();
27+
this._countlyConfigExpInstance = new CountlyConfigExp();
2528
}
2629

2730
/**
@@ -35,6 +38,32 @@ class CountlyConfig {
3538
return this._countlyConfigSDKLimitsInstance;
3639
}
3740

41+
/**
42+
* Getter to get the SDK internal limits
43+
*/
44+
get sdkInternalLimits() {
45+
return this._countlyConfigSDKLimitsInstance;
46+
}
47+
48+
/**
49+
* Getter to get the experimental configurations
50+
*/
51+
get experimental() {
52+
return this._countlyConfigExpInstance;
53+
}
54+
55+
get _crashReporting() {
56+
return this.#crashReporting;
57+
}
58+
59+
get _apmLegacy() {
60+
return this.#apmLegacy;
61+
}
62+
63+
get _disableIntentRedirectionCheck() {
64+
return this.#disableIntentRedirectionCheck;
65+
}
66+
3867
/**
3968
* Method to set the server url
4069
*
@@ -81,7 +110,7 @@ class CountlyConfig {
81110
* Method to enable crash reporting to report unhandled crashes to Countly
82111
*/
83112
enableCrashReporting() {
84-
this.crashReporting = true;
113+
this.#crashReporting = true;
85114
return this;
86115
}
87116

@@ -144,7 +173,7 @@ class CountlyConfig {
144173
* Method to enable application performance monitoring which includes the recording of app start time.
145174
*/
146175
enableApm() {
147-
this.enableApm = true;
176+
this.#apmLegacy = true;
148177
return this;
149178
}
150179

@@ -156,7 +185,7 @@ class CountlyConfig {
156185
if (BUILDING_WITH_PUSH_DISABLED) {
157186
return this;
158187
}
159-
this.disableAdditionalIntentRedirectionChecks = true;
188+
this.#disableIntentRedirectionCheck = true;
160189
return this;
161190
}
162191

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

0 commit comments

Comments
 (0)