Skip to content

Commit 8bbf7de

Browse files
Merge pull request #488 from CleverTap/develop
Release 3.8.0
2 parents 7648504 + 4623b66 commit 8bbf7de

File tree

14 files changed

+129
-23
lines changed

14 files changed

+129
-23
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
Change Log
22
==========
33

4+
Version 3.8.0 *(December 22 2025)*
5+
-------------------------------------------
6+
**What's new**
7+
* **[Android Platform]**
8+
* Supports [CleverTap Android SDK v7.7.1](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-771-december-02-2025).
9+
10+
* **[iOS Platform]**
11+
* Supports [CleverTap iOS SDK v7.4.1](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-741-december-02-2025).
12+
13+
**API changes**
14+
* **[Android and iOS Platform]**
15+
* Adds a new API `variants` to fetch A/B experiment variants for the user, enabling easier access to experiment data for custom implementations.
16+
* `variants()`
17+
* Adds a new overloaded API for `discardInAppNotifications()` method. Calling this with `true` immediately dismisses any currently visible In-App notification in addition to clearing the queue of pending messages.
18+
* `discardInAppNotifications(dismissInAppIfVisible: Boolean)`
19+
420
Version 3.7.0 *(October 3 2025)*
521
-------------------------------------------
622
**What's new**

Example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ dependencies {
223223

224224

225225
//clevertap
226-
implementation 'com.clevertap.android:clevertap-android-sdk:7.5.2'
226+
implementation 'com.clevertap.android:clevertap-android-sdk:7.7.1'
227227
implementation "com.clevertap.android:push-templates:2.1.0"
228228
implementation project(':clevertap-react-native')
229229

Example/app/App.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ export default class App extends Component {
173173
action: Actions.SYNC_VARIABLES,
174174
name: 'Sync Variables'
175175
},
176+
{
177+
action: Actions.GET_VARIANTS,
178+
name: 'Get Variants'
179+
},
176180
{
177181
action: Actions.GET_VARIABLES,
178182
name: 'Get Variables'
@@ -325,6 +329,7 @@ export default class App extends Component {
325329
subCategory: [
326330
{ action: Actions.IN_APPS_SUSPEND, name: 'suspendInAppNotifications' },
327331
{ action: Actions.IN_APPS_DISCARD, name: 'discardInAppNotifications' },
332+
{ action: Actions.IN_APPS_DISCARD_WITH_DISMISS, name: 'discardInAppNotifications(true)' },
328333
{ action: Actions.IN_APPS_RESUME, name: 'resumeInAppNotifications' },
329334
],
330335
},
@@ -606,6 +611,9 @@ export default class App extends Component {
606611
case Actions.IN_APPS_DISCARD:
607612
CleverTap.discardInAppNotifications();
608613
break;
614+
case Actions.IN_APPS_DISCARD_WITH_DISMISS:
615+
CleverTap.discardInAppNotifications(true);
616+
break;
609617
case Actions.IN_APPS_RESUME:
610618
CleverTap.resumeInAppNotifications();
611619
break;
@@ -799,6 +807,16 @@ export default class App extends Component {
799807
case Actions.SYNC_VARIABLES:
800808
CleverTap.syncVariables()
801809
break;
810+
case Actions.GET_VARIANTS:
811+
CleverTap.variants((err, variants) => {
812+
console.log('variants: ', variants);
813+
if (variants && variants.length > 0) {
814+
AppUtils.showToast('Variants', `Found ${variants.length} active variants`);
815+
} else {
816+
AppUtils.showToast('Variants', 'No active variants found');
817+
}
818+
});
819+
break;
802820
case Actions.GET_VARIABLES:
803821
CleverTap.getVariables((err, variables) => {
804822
console.log('getVariables: ', variables, err);

Example/app/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const Actions = {
6060
GET_FEATURE_FLAG: 'GET_FEATURE_FLAG',
6161
IN_APPS_SUSPEND: 'IN_APPS_SUSPEND',
6262
IN_APPS_DISCARD: 'IN_APPS_DISCARD',
63+
IN_APPS_DISCARD_WITH_DISMISS: 'IN_APPS_DISCARD_WITH_DISMISS',
6364
IN_APPS_RESUME: 'IN_APPS_RESUME',
6465
ENABLE_PERSONALIZATION: 'ENABLE_PERSONALIZATION',
6566
ATTRIBUTION_IDENTIFIER: 'ATTRIBUTION_IDENTIFIER',
@@ -79,6 +80,7 @@ export const Actions = {
7980
HARD_PERMISSION: 'HARD_PERMISSION',
8081
HARD_PERMISSION_FALLBACK: 'HARD_PERMISSION_FALLBACK',
8182
SYNC_VARIABLES: 'SYNC_VARIABLES',
83+
GET_VARIANTS: 'GET_VARIANTS',
8284
GET_VARIABLES: 'GET_VARIABLES',
8385
GET_VARIABLE: 'GET_VARIABLE',
8486
GET_FILE_VARIABLE: 'GET_FILE_VARIABLE',

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ android {
3535
defaultConfig {
3636
minSdkVersion 21
3737
targetSdkVersion 35
38-
versionCode 370
39-
versionName "3.7.0"
38+
versionCode 380
39+
versionName "3.8.0"
4040
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
4141
}
4242

@@ -54,7 +54,7 @@ android {
5454
}
5555

5656
dependencies {
57-
api 'com.clevertap.android:clevertap-android-sdk:7.5.2'
57+
api 'com.clevertap.android:clevertap-android-sdk:7.7.1'
5858
implementation 'com.android.installreferrer:installreferrer:2.2'
5959
//compile 'com.android.support:appcompat-v7:28.0.0'
6060
implementation 'com.facebook.react:react-native:+'

android/src/main/java/com/clevertap/react/CleverTapModuleImpl.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555

5656
import java.text.SimpleDateFormat;
5757
import java.util.ArrayList;
58+
import java.util.List;
5859
import java.util.Date;
5960
import java.util.HashMap;
6061
import java.util.Iterator;
@@ -1138,6 +1139,17 @@ public void discardInAppNotifications() {
11381139
}
11391140
}
11401141

1142+
public void discardInAppNotifications(Boolean dismissInAppIfVisible) {
1143+
CleverTapAPI cleverTap = getCleverTapAPI();
1144+
if (cleverTap != null) {
1145+
if (dismissInAppIfVisible != null) {
1146+
cleverTap.discardInAppNotifications(dismissInAppIfVisible);
1147+
} else {
1148+
cleverTap.discardInAppNotifications();
1149+
}
1150+
}
1151+
}
1152+
11411153
public void resumeInAppNotifications() {
11421154
CleverTapAPI cleverTap = getCleverTapAPI();
11431155
if (cleverTap != null) {
@@ -1234,6 +1246,19 @@ public void syncCustomTemplates() {
12341246
}
12351247
}
12361248

1249+
public void variants(final Callback callback) {
1250+
WritableArray result = null;
1251+
String error = null;
1252+
CleverTapAPI cleverTap = getCleverTapAPI();
1253+
if (cleverTap != null) {
1254+
List<Map<String, Object>> variantsList = cleverTap.variants();
1255+
result = variantsToWritableArray(variantsList);
1256+
} else {
1257+
error = ErrorMessages.CLEVERTAP_NOT_INITIALIZED;
1258+
}
1259+
callbackWithErrorAndResult(callback, error, result);
1260+
}
1261+
12371262
private void resolveWithTemplateContext(String templateName, Promise promise, TemplateContextAction action) {
12381263
CleverTapAPI cleverTap = getCleverTapAPI();
12391264
if (cleverTap != null) {
@@ -1961,6 +1986,14 @@ private static ArrayList<String> arrayListStringFromReadableArray(ReadableArray
19611986
return array;
19621987
}
19631988

1989+
public static WritableArray variantsToWritableArray(List<Map<String, Object>> variantsList) {
1990+
WritableArray result = Arguments.createArray();
1991+
if (variantsList != null) {
1992+
result = CleverTapUtils.MapUtil.ArrayUtil.toWritableArray(new ArrayList<>(variantsList));
1993+
}
1994+
return result;
1995+
}
1996+
19641997
private static WritableMap eventLogToWritableMap(UserEventLog eventLog) {
19651998
WritableMap ret = Arguments.createMap();
19661999

android/src/newarch/CleverTapModule.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ class CleverTapModule(reactContext: ReactApplicationContext?) :
428428
cleverTapModuleImpl.suspendInAppNotifications()
429429
}
430430

431-
override fun discardInAppNotifications() {
432-
cleverTapModuleImpl.discardInAppNotifications()
431+
override fun discardInAppNotifications(dismissInAppIfVisible: Boolean?) {
432+
cleverTapModuleImpl.discardInAppNotifications(dismissInAppIfVisible)
433433
}
434434

435435
override fun resumeInAppNotifications() {
@@ -519,6 +519,10 @@ class CleverTapModule(reactContext: ReactApplicationContext?) :
519519
cleverTapModuleImpl.syncCustomTemplates()
520520
}
521521

522+
override fun variants(callback: Callback?) {
523+
cleverTapModuleImpl.variants(callback)
524+
}
525+
522526
override fun syncVariables() {
523527
cleverTapModuleImpl.syncVariables()
524528
}

android/src/oldarch/CleverTapModule.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,8 @@ class CleverTapModule(reactContext: ReactApplicationContext?) :
504504
}
505505

506506
@ReactMethod
507-
fun discardInAppNotifications() {
508-
cleverTapModuleImpl.discardInAppNotifications()
507+
fun discardInAppNotifications(dismissInAppIfVisible: Boolean?) {
508+
cleverTapModuleImpl.discardInAppNotifications(dismissInAppIfVisible)
509509
}
510510

511511
@ReactMethod
@@ -610,6 +610,11 @@ class CleverTapModule(reactContext: ReactApplicationContext?) :
610610
cleverTapModuleImpl.syncCustomTemplates()
611611
}
612612

613+
@ReactMethod
614+
fun variants(callback: Callback?) {
615+
cleverTapModuleImpl.variants(callback)
616+
}
617+
613618
@ReactMethod
614619
fun syncVariables() {
615620
cleverTapModuleImpl.syncVariables()

clevertap-react-native.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Pod::Spec.new do |s|
2424
s.dependency 'React-Core'
2525
end
2626

27-
s.dependency 'CleverTap-iOS-SDK', '7.3.3'
27+
s.dependency 'CleverTap-iOS-SDK', '7.4.1'
2828

2929
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
3030
s.pod_target_xcconfig = {

ios/CleverTapReact/CleverTapReact.mm

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ - (void)setCleverTapInstance:(CleverTap *)instance {
206206

207207
#pragma mark - OptOut API
208208

209-
RCT_EXPORT_METHOD(setOptOut:(BOOL)userOptOut allowSystemEvents:(NSNumber *)allowSystemEvents) {
210-
RCTLogInfo(@"[CleverTap setOptOut and allowSystemEvents: %i, %@]", userOptOut, allowSystemEvents);
211-
if (allowSystemEvents != nil) {
212-
[[self cleverTapInstance] setOptOut:userOptOut allowSystemEvents:[allowSystemEvents boolValue]];
209+
RCT_EXPORT_METHOD(setOptOut:(BOOL)userOptOut allowSystemEvents:(BOOL)allowSystemEvents) {
210+
RCTLogInfo(@"[CleverTap setOptOut and allowSystemEvents: %d, %d]", userOptOut, allowSystemEvents);
211+
if (allowSystemEvents) {
212+
[[self cleverTapInstance] setOptOut:userOptOut allowSystemEvents:allowSystemEvents];
213213
} else {
214214
[[self cleverTapInstance] setOptOut:userOptOut];
215215
}
@@ -934,9 +934,9 @@ - (void)messageDidSelect:(CleverTapInboxMessage *_Nonnull)message atIndex:(int)i
934934
[[self cleverTapInstance] suspendInAppNotifications];
935935
}
936936

937-
RCT_EXPORT_METHOD(discardInAppNotifications) {
938-
RCTLogInfo(@"[CleverTap discardInAppNotifications");
939-
[[self cleverTapInstance] discardInAppNotifications];
937+
RCT_EXPORT_METHOD(discardInAppNotifications:(BOOL)dismissInAppIfVisible) {
938+
RCTLogInfo(@"[CleverTap discardInAppNotifications: %d]", dismissInAppIfVisible);
939+
[[self cleverTapInstance] discardInAppNotifications:dismissInAppIfVisible];
940940
}
941941

942942
RCT_EXPORT_METHOD(resumeInAppNotifications) {
@@ -1094,6 +1094,13 @@ - (CTLocalInApp*)_localInAppConfigFromReadableMap: (NSDictionary *)json {
10941094
[self returnResult:varValues withCallback:callback andError:nil];
10951095
}
10961096

1097+
RCT_EXPORT_METHOD(variants:(RCTResponseSenderBlock)callback) {
1098+
RCTLogInfo(@"[CleverTap variants]");
1099+
1100+
NSArray<NSDictionary<NSString*,id>*> *variants = [[self cleverTapInstance]variants];
1101+
[self returnResult:variants withCallback:callback andError:nil];
1102+
}
1103+
10971104
RCT_EXPORT_METHOD(fetchVariables:(RCTResponseSenderBlock)callback) {
10981105
RCTLogInfo(@"[CleverTap fetchVariables]");
10991106
[[self cleverTapInstance]fetchVariables:^(BOOL success) {

0 commit comments

Comments
 (0)