Skip to content

Commit c2d8f56

Browse files
authored
Task/sdk 3752/android support ctv6.2.0 (#386)
* task(SDK-3753) - Removes manifest entry for CTBackgroundJobService - No longer required as it is fixed in v6.2.0 * task(SDK-3752) - Updates Example app * task(SDK-3752) - Adds support for ctv6.2.0 - Updates versions - Removes all xiaomi related code * task(SDK-3752) - Fixes a typo in CHANGELOG.md * task(SDK-3752) - Adds back package name for max compatibility with RN versions react-native-community/discussions-and-proposals#671 (comment) * task(SDK-3752) - Updates CHANGELOG.md
1 parent f1a18af commit c2d8f56

File tree

10 files changed

+42
-54
lines changed

10 files changed

+42
-54
lines changed

CHANGELOG.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
11
Change Log
22
==========
3-
3+
Version 2.2.0 *(5 April 2024)*
4+
-------------------------------------------
45
**What's new**
56

7+
* **[Android Platform]**
8+
* Supports [CleverTap Android SDK v6.2.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-620-april-3-2024).
9+
10+
* **[iOS Platform]**
11+
* Supports [CleverTap iOS SDK v6.2.0](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/6.2.0).
12+
* Updates privacy manifests.
13+
14+
**API Changes**
15+
* Removes all Xiaomi related public methods as the Xiaomi SDK has been discontinued. Details [here](https://developer.clevertap.com/docs/discontinuation-of-xiaomi-push-service).
16+
* Changes the function definition of `setPushToken` to `setPushToken: function (token, type)` i.e it no more accepts `region` as a parameter.
17+
18+
**Bug Fixes**
19+
* **[Android Platform]**
20+
* Extends the push primer callback to notify permission denial when cancel button is clicked on `PromptForSettings` alert dialog.
21+
* Fixes a crash due to `NullPointerException` related to `deviceInfo.deviceId`.
22+
* Fixes an ANR related to `isMainProcess` check.
23+
* Fixes an ANR due to eager initialisation of `CtApi` triggered by DeviceId generation.
24+
* Fixes an android build issue related to `package name no found` for apps with ReactNative version less than 0.71.
25+
26+
* **[iOS Platform]**
27+
* Fixes a bug where client side in-apps were not discarded when rendering status is set to "discard".
28+
29+
630
Version 2.1.0 *(7 March 2024)*
731
-------------------------------------------
832
**What's new**

Example/App.js

-1
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,6 @@ pushFcmRegistrationId = () => {
11571157
// => https://developer.clevertap.com/docs/android#section-custom-android-push-notifications-handling
11581158
CleverTap.setPushToken('1000test000token000fcm', CleverTap.FCM);
11591159
//CleverTap.setPushToken("111056687894", CleverTap.HMS);//for Huawei push
1160-
CleverTap.setPushToken('1000test000token000xps', CleverTap.XPS, 'Europe'); //for Xiaomi push
11611160
//CleverTap.setPushToken("111056687894", CleverTap.BPS);//for Baidu push
11621161
}
11631162
};

Example/android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ dependencies {
218218

219219

220220
//clevertap
221-
implementation 'com.clevertap.android:clevertap-android-sdk:6.1.1'
221+
implementation 'com.clevertap.android:clevertap-android-sdk:6.2.0'
222222
implementation "com.clevertap.android:push-templates:1.2.3"
223223
implementation project(':clevertap-react-native')
224224

Example/android/app/src/main/java/com/reactnct/MainApplication.java

-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ public ReactNativeHost getReactNativeHost() {
7070
@Override
7171
public void onCreate() {
7272
CleverTapAPI.setDebugLevel(LogLevel.VERBOSE);
73-
// you can use below two xiaomi related methods from clevertap-react-native 0.9.0 onwards
74-
//CleverTapAPI.changeXiaomiCredentials("your xiaomi app id","your xiaomi app key")
75-
//CleverTapAPI.enableXiaomiPushOn(XIAOMI_MIUI_DEVICES)
7673
CleverTapAPI.setNotificationHandler((NotificationHandler) new PushTemplateNotificationHandler());
7774
CleverTapAPI.getDefaultInstance(getApplicationContext()).enableDeviceNetworkInfoReporting(true);
7875
registerActivityLifecycleCallbacks(this);

android/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ android {
2020
defaultConfig {
2121
minSdkVersion 19
2222
targetSdkVersion 34
23-
versionCode 210
24-
versionName "2.1.0"
23+
versionCode 220
24+
versionName "2.2.0"
2525
}
2626

2727
namespace 'com.clevertap.react'
@@ -40,7 +40,7 @@ dependencies {
4040
maven { url "$rootDir/../node_modules/react-native/android" }
4141
}
4242

43-
api 'com.clevertap.android:clevertap-android-sdk:6.1.1'
43+
api 'com.clevertap.android:clevertap-android-sdk:6.2.0'
4444
implementation 'com.android.installreferrer:installreferrer:2.2'
4545
//compile 'com.android.support:appcompat-v7:28.0.0'
4646
implementation 'com.facebook.react:react-native:+'

android/src/main/AndroidManifest.xml

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools">
1+
<manifest package="com.clevertap.react">
2+
<!--
3+
Package name has been added to support compatibility for RN versions less than 0.71.
4+
This gives warning for RN versions greater than or equal to 0.71 which can be ignored
5+
-->
36
<application>
4-
<service
5-
android:name="com.clevertap.android.sdk.pushnotification.amp.CTBackgroundJobService"
6-
android:enabled="false"
7-
android:exported="false"
8-
tools:ignore="MissingClass" />
97
</application>
108
</manifest>

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

-21
Original file line numberDiff line numberDiff line change
@@ -1353,27 +1353,6 @@ public void setPushTokenAsString(String token, String type) {
13531353
}
13541354
}
13551355

1356-
@ReactMethod
1357-
public void setPushTokenAsStringWithRegion(String token, String type, String region) {
1358-
Logger.v("setPushTokenAsString() called with: token = [" + token + "], type = [" + type + "], region = ["
1359-
+ region + "]");
1360-
1361-
CleverTapAPI clevertap = getCleverTapAPI();
1362-
if (clevertap == null || token == null || type == null || TextUtils.isEmpty(region)) {
1363-
return;
1364-
}
1365-
1366-
switch (type) {
1367-
case XPS:
1368-
clevertap.pushXiaomiRegistrationId(token, region, true);
1369-
break;
1370-
default:
1371-
Log.e(TAG, "Unknown push token type " + type);
1372-
break;
1373-
}
1374-
}
1375-
1376-
13771356
@ReactMethod
13781357
public void showInbox(ReadableMap styleConfig) {
13791358
CTInboxStyleConfig inboxStyleConfig = styleConfigFromReadableMap(styleConfig);

index.d.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@
7272
/**
7373
* Manually set the push token on the CleverTap user profile
7474
* @param {string} token - the device token
75-
* @param {string} type - for Android only, specifying the type of push service token. Values can be CleverTap.FCM for Firebase or CleverTap.XPS for Xiaomi or CleverTap.BPS for Baidu or CleverTap.HPS for Huawei,
76-
* @param {string} region - for xps only ,to specify the region
75+
* @param {string} type - for Android only, specifying the type of push service token. Values can be CleverTap.FCM for Firebase or CleverTap.BPS for Baidu or CleverTap.HPS for Huawei,
7776
*/
78-
export function setPushToken(token: string, type: string,region?:string): void;
77+
export function setPushToken(token: string, type: string): void;
7978

8079
/**
8180
* Create Notification Channel for Android O+
@@ -784,7 +783,6 @@ export function isPushPermissionGranted(callback: CallbackString): void;
784783
type CallbackString = (err: object, res: string) => void;
785784

786785
export const FCM: string;
787-
export const XPS: string;
788786
export const BPS: string;
789787
export const HPS: string;
790788
export const CleverTapProfileDidInitialize: string;

index.js

+5-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const EventEmitter = NativeModules.CleverTapReactEventEmitter ? new NativeEventE
99
* @param {int} libVersion - The updated library version. If current version is 1.1.0 then pass as 10100
1010
*/
1111
const libName = 'React-Native';
12-
const libVersion = 20100;
12+
const libVersion = 20200;
1313
CleverTapReact.setLibrary(libName,libVersion);
1414

1515
function defaultCallback(method, err, res) {
@@ -49,7 +49,6 @@ var CleverTap = {
4949
CleverTapInAppNotificationDismissed: CleverTapReact.CleverTapInAppNotificationDismissed,
5050
CleverTapInAppNotificationShowed: CleverTapReact.CleverTapInAppNotificationShowed,
5151
FCM: CleverTapReact.FCM,
52-
XPS: CleverTapReact.XPS,
5352
BPS: CleverTapReact.BPS,
5453
HPS: CleverTapReact.HPS,
5554
CleverTapInboxDidInitialize: CleverTapReact.CleverTapInboxDidInitialize,
@@ -128,17 +127,11 @@ var CleverTap = {
128127
/**
129128
* Manually set the push token on the CleverTap user profile
130129
* @param {string} token - the device token
131-
* @param {string} type - for Android only, specifying the type of push service token. Values can be CleverTap.FCM for Firebase or CleverTap.XPS for Xiaomi or CleverTap.BPS for Baidu or CleverTap.HPS for Huawei,
132-
* @param {string} region - for xps only ,to specify the region
130+
* @param {string} type - for Android only, specifying the type of push service token. Values can be CleverTap.FCM for Firebase or CleverTap.BPS for Baidu or CleverTap.HPS for Huawei,
133131
*/
134-
setPushToken: function (token, type, region = "") {
135-
console.log(`CleverTap RN | setPushToken | received : token: '${token}' | type:'${type}' | region:'${region}' `)
136-
if (type === CleverTap.XPS) {
137-
CleverTapReact.setPushTokenAsStringWithRegion(token, type, region);
138-
}
139-
else {
140-
CleverTapReact.setPushTokenAsString(token, type);
141-
}
132+
setPushToken: function (token, type) {
133+
console.log(`CleverTap RN | setPushToken | received : token: '${token}' | type:'${type}' `)
134+
CleverTapReact.setPushTokenAsString(token, type);
142135
},
143136

144137
/**

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "clevertap-react-native",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "CleverTap React Native SDK.",
55
"main": "index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)