Skip to content

Commit e9459aa

Browse files
Anush-ShandAishwaryaNannaaraphiel-nf
authored
Release v2.0.0 (#373)
* Update ct-ios-sdk to v5.2.2 * task(SDK-3646) - Adds android support for ct-sdk v6.0.0 * refactor: remove unneeded `post-install` script * - Update ct-ios-sdk to 6.0.0 - Refactor showInbox method * task(SDK-3646) - Updates libVersion * Example app update * Error fix * Revoked Account ID change * task(SDK-3646) - Adds CHANGELOG.md for v2.0.0 * - Update Changelog for 2.0.0 from iOS side * Reverted token * Updated branch in Package.json * Branch update in Package.json * Deleting package-lock file * Task/sdk 3646/support ct v6.0.0 (#371) * task(SDK-3646) - Adds android support for ct-sdk v6.0.0 * task(SDK-3646) - Updates libVersion * task(SDK-3646) - Adds CHANGELOG.md for v2.0.0 * docs(SDK-3646) - Fixes indentation in Changelog.md * choreSDK-3646) - Updates pushtemplates dependency for Example app --------- Co-authored-by: Aishwarya Nanna <[email protected]> Co-authored-by: Armon Raphiel <[email protected]> Co-authored-by: AishwaryaNanna <[email protected]>
1 parent 7c7af62 commit e9459aa

File tree

14 files changed

+157
-43
lines changed

14 files changed

+157
-43
lines changed

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
Change Log
22
==========
33

4+
Version 2.0.0 *(15 February 2024)*
5+
-------------------------------------------
6+
**What's new**
7+
* **[Android Platform]**
8+
* Supports [CleverTap Android SDK v6.0.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-600-january-15-2024).
9+
10+
* **[iOS Platform]**
11+
* Supports [CleverTap iOS SDK v6.0.0](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/6.0.0).
12+
13+
* **[Android and iOS Platform]**
14+
* Adds support for client-side in-apps.
15+
* Adds new API `clearInAppResources(boolean)` to delete images and gifs which are preloaded for inapps in cs mode
16+
* Adds new API `fetchInApps()` to explicitly fetch InApps from the server
17+
18+
**Bug Fixes**
19+
* **[Android Platform]**
20+
* Fixes a bug where JavaScript was not working for custom-html InApp header/footer templates.
21+
* Fixes an NPE related to AppInbox APIs.
22+
* Fixes a ClassCastException in defineVariable API of Product Experiences.
23+
* Fixes a resource name conflict with the firebase library in fcm_fallback_notification_channel_label
24+
* Fixes a StrictMode Violation spawning from ctVariables.init().
25+
* Removes use of lossy conversions leading to an issue in PushTemplates.
26+
* Handles an edge case related to migration of encryption level when local db is out of memory
27+
28+
* **[iOS Platform]**
29+
* Fixes a bug where some in-apps were not being dismissed.
30+
431
Version 1.2.1 *(25 October 2023)*
532
-------------------------------------------
633
**What's new**

Example/App.js

+20
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,17 @@ class Expandable_ListView extends Component {
480480
console.log('onValueChanged: ', variable);
481481
});
482482
break;
483+
case 87:
484+
CleverTap.fetchInApps((err, success) => {
485+
console.log('fetchInApps result: ', success);
486+
});
487+
break;
488+
case 88:
489+
CleverTap.clearInAppResources(false);
490+
break;
491+
case 89:
492+
CleverTap.clearInAppResources(true);
493+
break;
483494
}
484495
}
485496

@@ -597,6 +608,15 @@ export default class App extends Component {
597608
}
598609
],
599610
},
611+
{
612+
expanded: false,
613+
category_Name: 'Client Side InApps',
614+
sub_Category: [
615+
{id: 87, name: 'Fetch Client Side InApps'},
616+
{id: 88, name: 'Clear All InApp Resources'},
617+
{id: 89, name: 'Clear Expired Only InApp Resources'}
618+
],
619+
},
600620
{
601621
expanded: false,
602622
category_Name: 'User Properties',

Example/android/app/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,15 @@ dependencies {
211211
implementation 'com.google.android.gms:play-services-base:18.2.0'
212212
implementation 'com.google.firebase:firebase-messaging:23.0.6'
213213
implementation 'com.google.android.material:material:1.4.0' //Mandatory for App Inbox
214-
implementation 'com.google.android.exoplayer:exoplayer:2.17.1' //Optional for Audio/Video
215-
implementation 'com.google.android.exoplayer:exoplayer-hls:2.17.1' //Optional for Audio/Video
216-
implementation 'com.google.android.exoplayer:exoplayer-ui:2.17.1' //Optional for Audio/Video
214+
implementation 'com.google.android.exoplayer:exoplayer:2.19.1' //Optional for Audio/Video
215+
implementation 'com.google.android.exoplayer:exoplayer-hls:2.19.1' //Optional for Audio/Video
216+
implementation 'com.google.android.exoplayer:exoplayer-ui:2.19.1' //Optional for Audio/Video
217217
//implementation 'com.google.android.gms:play-services-ads:19.0.1'
218218

219219

220220
//clevertap
221-
implementation 'com.clevertap.android:clevertap-android-sdk:5.2.1'
222-
implementation "com.clevertap.android:push-templates:1.0.9"
221+
implementation 'com.clevertap.android:clevertap-android-sdk:6.0.0'
222+
implementation "com.clevertap.android:push-templates:1.2.2"
223223
implementation project(':clevertap-react-native')
224224

225225

Example/ios/Example.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@
498498
/* Begin PBXShellScriptBuildPhase section */
499499
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
500500
isa = PBXShellScriptBuildPhase;
501-
buildActionMask = 2147483647;
501+
buildActionMask = 12;
502502
files = (
503503
);
504504
inputPaths = (
@@ -508,7 +508,7 @@
508508
);
509509
runOnlyForDeploymentPostprocessing = 0;
510510
shellPath = /bin/sh;
511-
shellScript = "if [[ -s \"$HOME/.nvm/nvm.sh\" ]]; then\n. \"$HOME/.nvm/nvm.sh\"\nelif [[ -x \"$(command -v brew)\" && -s \"$(brew --prefix nvm)/nvm.sh\" ]]; then\n. \"$(brew --prefix nvm)/nvm.sh\"\nfi\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
511+
shellScript = "if [[ -s \"$HOME/.nvm/nvm.sh\" ]]; then\n. \"$HOME/.nvm/nvm.sh\"\nelif [[ -x \"$(command -v brew)\" && -s \"$(brew --prefix nvm)/nvm.sh\" ]]; then\n. \"$(brew --prefix nvm)/nvm.sh\"\nfi\n\nexport NODE_BINARY=/Users/aishwarya.nanna/.nvm/versions/node/v18.0.0/bin/node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
512512
};
513513
0EFB3D8FAA2BBF06F665EFA1 /* [CP] Check Pods Manifest.lock */ = {
514514
isa = PBXShellScriptBuildPhase;

Example/ios/Example.xcworkspace/contents.xcworkspacedata

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

android/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ android {
2121
defaultConfig {
2222
minSdkVersion 19
2323
targetSdkVersion 33
24-
versionCode 121
25-
versionName "1.2.1"
24+
versionCode 200
25+
versionName "2.0.0"
2626
}
2727
buildTypes {
2828
release {
@@ -39,7 +39,7 @@ dependencies {
3939
maven { url "$rootDir/../node_modules/react-native/android" }
4040
}
4141

42-
api 'com.clevertap.android:clevertap-android-sdk:5.2.1'
42+
api 'com.clevertap.android:clevertap-android-sdk:6.0.0'
4343
implementation 'com.android.installreferrer:installreferrer:2.2'
4444
//compile 'com.android.support:appcompat-v7:28.0.0'
4545
implementation 'com.facebook.react:react-native:+'

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

+25
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import com.clevertap.android.sdk.variables.callbacks.FetchVariablesCallback;
4242
import com.clevertap.android.sdk.variables.callbacks.VariableCallback;
4343
import com.clevertap.android.sdk.variables.callbacks.VariablesChangedCallback;
44+
import com.clevertap.android.sdk.inapp.callbacks.FetchInAppsCallback;
4445
import com.facebook.react.bridge.Arguments;
4546
import com.facebook.react.bridge.Callback;
4647
import com.facebook.react.bridge.ReactApplicationContext;
@@ -1547,6 +1548,30 @@ public void variablesChanged() {
15471548
}
15481549
}
15491550

1551+
@ReactMethod
1552+
public void clearInAppResources(final boolean expiredOnly) {
1553+
CleverTapAPI cleverTap = getCleverTapAPI();
1554+
if (cleverTap != null) {
1555+
cleverTap.clearInAppResources(expiredOnly);
1556+
}
1557+
}
1558+
1559+
@ReactMethod
1560+
public void fetchInApps(final Callback callback) {
1561+
CleverTapAPI cleverTap = getCleverTapAPI();
1562+
if (cleverTap != null) {
1563+
cleverTap.fetchInApps(new FetchInAppsCallback() {
1564+
@Override
1565+
public void onInAppsFetched(final boolean isSuccess) {
1566+
callbackWithErrorAndResult(callback, null, isSuccess);
1567+
}
1568+
});
1569+
} else {
1570+
String error = ErrorMessages.CLEVERTAP_NOT_INITIALIZED.getErrorMessage();
1571+
callbackWithErrorAndResult(callback, error, null);
1572+
}
1573+
}
1574+
15501575
/************************************************
15511576
* Product Experience Remote Config methods ends
15521577
************************************************/

clevertap-react-native.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ Pod::Spec.new do |s|
1818
s.preserve_paths = 'LICENSE.md', 'README.md', 'package.json', 'index.js'
1919
s.source_files = 'ios/CleverTapReact/*.{h,m}'
2020

21-
s.dependency 'CleverTap-iOS-SDK', '5.2.1'
21+
s.dependency 'CleverTap-iOS-SDK', '6.0.0'
2222
s.dependency 'React-Core'
2323
end

index.d.ts

+15
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,21 @@ export function isPushPermissionGranted(callback: CallbackString): void;
756756
*/
757757
export function onValueChanged(name: string, handler: Function): void;
758758

759+
760+
/**
761+
* Fetches In Apps from server.
762+
*
763+
* @param {function(err, res)} callback a callback with a boolean flag whether the fetching was successful
764+
*/
765+
export function fetchInApps(callback: Callback): void;
766+
767+
/**
768+
* Deletes all images and gifs which are preloaded for inapps in cs mode
769+
*
770+
* @param {boolean} expiredOnly to clear only assets which will not be needed further for inapps
771+
*/
772+
export function clearInAppResources(expiredOnly: boolean): void;
773+
759774
/*******************
760775
* Developer Options
761776
******************/

index.js

+19-1
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 = 10201;
12+
const libVersion = 20000;
1313
CleverTapReact.setLibrary(libName,libVersion);
1414

1515
function defaultCallback(method, err, res) {
@@ -949,6 +949,24 @@ var CleverTap = {
949949
onValueChanged: function (name, handler) {
950950
CleverTapReact.onValueChanged(name);
951951
this.addListener(CleverTapReact.CleverTapOnValueChanged, handler);
952+
},
953+
954+
/**
955+
* Fetches In Apps from server.
956+
*
957+
* @param callback {function(err, res)} a callback with a boolean flag whether the update was successful
958+
*/
959+
fetchInApps: function (callback) {
960+
callWithCallback('fetchInApps', null, callback);
961+
},
962+
963+
/**
964+
* Deletes all images and gifs which are preloaded for inapps in cs mode
965+
*
966+
* @param {boolean} expiredOnly to clear only assets which will not be needed further for inapps
967+
*/
968+
clearInAppResources: function(expiredOnly) {
969+
CleverTapReact.clearInAppResources(expiredOnly);
952970
}
953971
};
954972

install.js

-24
This file was deleted.

ios/CleverTapReact/CleverTapReact.m

+21-2
Original file line numberDiff line numberDiff line change
@@ -634,11 +634,16 @@ - (NSMutableDictionary *)getVariableValues {
634634

635635
RCT_EXPORT_METHOD(showInbox:(NSDictionary*)styleConfig) {
636636
RCTLogInfo(@"[CleverTap Show Inbox]");
637+
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
638+
UIViewController *mainViewController = keyWindow.rootViewController;
639+
if (mainViewController.presentedViewController) {
640+
RCTLogInfo(@"CleverTap : Could not present App Inbox because a view controller is already being presented.");
641+
return;
642+
}
643+
637644
CleverTapInboxViewController *inboxController = [[self cleverTapInstance] newInboxViewControllerWithConfig:[self _dictToInboxStyleConfig:styleConfig? styleConfig : nil] andDelegate:(id <CleverTapInboxViewControllerDelegate>)self];
638645
if (inboxController) {
639646
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:inboxController];
640-
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
641-
UIViewController *mainViewController = keyWindow.rootViewController;
642647
[mainViewController presentViewController:navigationController animated:YES completion:nil];
643648
}
644649
}
@@ -852,6 +857,20 @@ - (void)messageDidSelect:(CleverTapInboxMessage *_Nonnull)message atIndex:(int)i
852857
[[self cleverTapInstance] resumeInAppNotifications];
853858
}
854859

860+
#pragma mark - InApp Controls
861+
862+
RCT_EXPORT_METHOD(fetchInApps:(RCTResponseSenderBlock)callback) {
863+
RCTLogInfo(@"[CleverTap fetchInApps]");
864+
[[self cleverTapInstance]fetchInApps:^(BOOL success) {
865+
[self returnResult:@(success) withCallback:callback andError:nil];
866+
}];
867+
}
868+
869+
RCT_EXPORT_METHOD(clearInAppResources:(BOOL)expiredOnly) {
870+
RCTLogInfo(@"[CleverTap clearInAppResources");
871+
[[self cleverTapInstance] clearInAppResources: expiredOnly];
872+
}
873+
855874
#pragma mark - Push Permission
856875

857876
- (CTLocalInApp*)_localInAppConfigFromReadableMap: (NSDictionary *)json {

package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"name": "clevertap-react-native",
3-
"version": "1.2.1",
3+
"version": "2.0.0",
44
"description": "CleverTap React Native SDK.",
55
"main": "index.js",
66
"types": "index.d.ts",
77
"scripts": {
88
"test": "echo \"Error: no test specified\" && exit 1",
9-
"postinstall": "node install.js",
109
"lint": "./node_modules/.bin/eslint index.js */**.js",
1110
"lint-fix": "./node_modules/.bin/eslint --fix index.js */**.js"
1211
},
@@ -32,9 +31,6 @@
3231
"react-native",
3332
"segmentation"
3433
],
35-
"dependencies": {
36-
"extract-zip": "^1.6.6"
37-
},
3834
"peerDependencies": {
3935
"react-native": ">=0.63.3"
4036
},

0 commit comments

Comments
 (0)