Skip to content

Commit

Permalink
Release v2.0.0 (#373)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
4 people authored Feb 15, 2024
1 parent 7c7af62 commit e9459aa
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 43 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
Change Log
==========

Version 2.0.0 *(15 February 2024)*
-------------------------------------------
**What's new**
* **[Android Platform]**
* Supports [CleverTap Android SDK v6.0.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-600-january-15-2024).

* **[iOS Platform]**
* Supports [CleverTap iOS SDK v6.0.0](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/6.0.0).

* **[Android and iOS Platform]**
* Adds support for client-side in-apps.
* Adds new API `clearInAppResources(boolean)` to delete images and gifs which are preloaded for inapps in cs mode
* Adds new API `fetchInApps()` to explicitly fetch InApps from the server

**Bug Fixes**
* **[Android Platform]**
* Fixes a bug where JavaScript was not working for custom-html InApp header/footer templates.
* Fixes an NPE related to AppInbox APIs.
* Fixes a ClassCastException in defineVariable API of Product Experiences.
* Fixes a resource name conflict with the firebase library in fcm_fallback_notification_channel_label
* Fixes a StrictMode Violation spawning from ctVariables.init().
* Removes use of lossy conversions leading to an issue in PushTemplates.
* Handles an edge case related to migration of encryption level when local db is out of memory

* **[iOS Platform]**
* Fixes a bug where some in-apps were not being dismissed.

Version 1.2.1 *(25 October 2023)*
-------------------------------------------
**What's new**
Expand Down
20 changes: 20 additions & 0 deletions Example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,17 @@ class Expandable_ListView extends Component {
console.log('onValueChanged: ', variable);
});
break;
case 87:
CleverTap.fetchInApps((err, success) => {
console.log('fetchInApps result: ', success);
});
break;
case 88:
CleverTap.clearInAppResources(false);
break;
case 89:
CleverTap.clearInAppResources(true);
break;
}
}

Expand Down Expand Up @@ -597,6 +608,15 @@ export default class App extends Component {
}
],
},
{
expanded: false,
category_Name: 'Client Side InApps',
sub_Category: [
{id: 87, name: 'Fetch Client Side InApps'},
{id: 88, name: 'Clear All InApp Resources'},
{id: 89, name: 'Clear Expired Only InApp Resources'}
],
},
{
expanded: false,
category_Name: 'User Properties',
Expand Down
10 changes: 5 additions & 5 deletions Example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,15 @@ dependencies {
implementation 'com.google.android.gms:play-services-base:18.2.0'
implementation 'com.google.firebase:firebase-messaging:23.0.6'
implementation 'com.google.android.material:material:1.4.0' //Mandatory for App Inbox
implementation 'com.google.android.exoplayer:exoplayer:2.17.1' //Optional for Audio/Video
implementation 'com.google.android.exoplayer:exoplayer-hls:2.17.1' //Optional for Audio/Video
implementation 'com.google.android.exoplayer:exoplayer-ui:2.17.1' //Optional for Audio/Video
implementation 'com.google.android.exoplayer:exoplayer:2.19.1' //Optional for Audio/Video
implementation 'com.google.android.exoplayer:exoplayer-hls:2.19.1' //Optional for Audio/Video
implementation 'com.google.android.exoplayer:exoplayer-ui:2.19.1' //Optional for Audio/Video
//implementation 'com.google.android.gms:play-services-ads:19.0.1'


//clevertap
implementation 'com.clevertap.android:clevertap-android-sdk:5.2.1'
implementation "com.clevertap.android:push-templates:1.0.9"
implementation 'com.clevertap.android:clevertap-android-sdk:6.0.0'
implementation "com.clevertap.android:push-templates:1.2.2"
implementation project(':clevertap-react-native')


Expand Down
4 changes: 2 additions & 2 deletions Example/ios/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@
/* Begin PBXShellScriptBuildPhase section */
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
buildActionMask = 12;
files = (
);
inputPaths = (
Expand All @@ -508,7 +508,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
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";
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";
};
0EFB3D8FAA2BBF06F665EFA1 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
10 changes: 10 additions & 0 deletions Example/ios/Example.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 33
versionCode 121
versionName "1.2.1"
versionCode 200
versionName "2.0.0"
}
buildTypes {
release {
Expand All @@ -39,7 +39,7 @@ dependencies {
maven { url "$rootDir/../node_modules/react-native/android" }
}

api 'com.clevertap.android:clevertap-android-sdk:5.2.1'
api 'com.clevertap.android:clevertap-android-sdk:6.0.0'
implementation 'com.android.installreferrer:installreferrer:2.2'
//compile 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.facebook.react:react-native:+'
Expand Down
25 changes: 25 additions & 0 deletions android/src/main/java/com/clevertap/react/CleverTapModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.clevertap.android.sdk.variables.callbacks.FetchVariablesCallback;
import com.clevertap.android.sdk.variables.callbacks.VariableCallback;
import com.clevertap.android.sdk.variables.callbacks.VariablesChangedCallback;
import com.clevertap.android.sdk.inapp.callbacks.FetchInAppsCallback;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
Expand Down Expand Up @@ -1547,6 +1548,30 @@ public void variablesChanged() {
}
}

@ReactMethod
public void clearInAppResources(final boolean expiredOnly) {
CleverTapAPI cleverTap = getCleverTapAPI();
if (cleverTap != null) {
cleverTap.clearInAppResources(expiredOnly);
}
}

@ReactMethod
public void fetchInApps(final Callback callback) {
CleverTapAPI cleverTap = getCleverTapAPI();
if (cleverTap != null) {
cleverTap.fetchInApps(new FetchInAppsCallback() {
@Override
public void onInAppsFetched(final boolean isSuccess) {
callbackWithErrorAndResult(callback, null, isSuccess);
}
});
} else {
String error = ErrorMessages.CLEVERTAP_NOT_INITIALIZED.getErrorMessage();
callbackWithErrorAndResult(callback, error, null);
}
}

/************************************************
* Product Experience Remote Config methods ends
************************************************/
Expand Down
2 changes: 1 addition & 1 deletion clevertap-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Pod::Spec.new do |s|
s.preserve_paths = 'LICENSE.md', 'README.md', 'package.json', 'index.js'
s.source_files = 'ios/CleverTapReact/*.{h,m}'

s.dependency 'CleverTap-iOS-SDK', '5.2.1'
s.dependency 'CleverTap-iOS-SDK', '6.0.0'
s.dependency 'React-Core'
end
15 changes: 15 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,21 @@ export function isPushPermissionGranted(callback: CallbackString): void;
*/
export function onValueChanged(name: string, handler: Function): void;


/**
* Fetches In Apps from server.
*
* @param {function(err, res)} callback a callback with a boolean flag whether the fetching was successful
*/
export function fetchInApps(callback: Callback): void;

/**
* Deletes all images and gifs which are preloaded for inapps in cs mode
*
* @param {boolean} expiredOnly to clear only assets which will not be needed further for inapps
*/
export function clearInAppResources(expiredOnly: boolean): void;

/*******************
* Developer Options
******************/
Expand Down
20 changes: 19 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const EventEmitter = NativeModules.CleverTapReactEventEmitter ? new NativeEventE
* @param {int} libVersion - The updated library version. If current version is 1.1.0 then pass as 10100
*/
const libName = 'React-Native';
const libVersion = 10201;
const libVersion = 20000;
CleverTapReact.setLibrary(libName,libVersion);

function defaultCallback(method, err, res) {
Expand Down Expand Up @@ -949,6 +949,24 @@ var CleverTap = {
onValueChanged: function (name, handler) {
CleverTapReact.onValueChanged(name);
this.addListener(CleverTapReact.CleverTapOnValueChanged, handler);
},

/**
* Fetches In Apps from server.
*
* @param callback {function(err, res)} a callback with a boolean flag whether the update was successful
*/
fetchInApps: function (callback) {
callWithCallback('fetchInApps', null, callback);
},

/**
* Deletes all images and gifs which are preloaded for inapps in cs mode
*
* @param {boolean} expiredOnly to clear only assets which will not be needed further for inapps
*/
clearInAppResources: function(expiredOnly) {
CleverTapReact.clearInAppResources(expiredOnly);
}
};

Expand Down
24 changes: 0 additions & 24 deletions install.js

This file was deleted.

23 changes: 21 additions & 2 deletions ios/CleverTapReact/CleverTapReact.m
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,16 @@ - (NSMutableDictionary *)getVariableValues {

RCT_EXPORT_METHOD(showInbox:(NSDictionary*)styleConfig) {
RCTLogInfo(@"[CleverTap Show Inbox]");
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
UIViewController *mainViewController = keyWindow.rootViewController;
if (mainViewController.presentedViewController) {
RCTLogInfo(@"CleverTap : Could not present App Inbox because a view controller is already being presented.");
return;
}

CleverTapInboxViewController *inboxController = [[self cleverTapInstance] newInboxViewControllerWithConfig:[self _dictToInboxStyleConfig:styleConfig? styleConfig : nil] andDelegate:(id <CleverTapInboxViewControllerDelegate>)self];
if (inboxController) {
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:inboxController];
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
UIViewController *mainViewController = keyWindow.rootViewController;
[mainViewController presentViewController:navigationController animated:YES completion:nil];
}
}
Expand Down Expand Up @@ -852,6 +857,20 @@ - (void)messageDidSelect:(CleverTapInboxMessage *_Nonnull)message atIndex:(int)i
[[self cleverTapInstance] resumeInAppNotifications];
}

#pragma mark - InApp Controls

RCT_EXPORT_METHOD(fetchInApps:(RCTResponseSenderBlock)callback) {
RCTLogInfo(@"[CleverTap fetchInApps]");
[[self cleverTapInstance]fetchInApps:^(BOOL success) {
[self returnResult:@(success) withCallback:callback andError:nil];
}];
}

RCT_EXPORT_METHOD(clearInAppResources:(BOOL)expiredOnly) {
RCTLogInfo(@"[CleverTap clearInAppResources");
[[self cleverTapInstance] clearInAppResources: expiredOnly];
}

#pragma mark - Push Permission

- (CTLocalInApp*)_localInAppConfigFromReadableMap: (NSDictionary *)json {
Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "clevertap-react-native",
"version": "1.2.1",
"version": "2.0.0",
"description": "CleverTap React Native SDK.",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "node install.js",
"lint": "./node_modules/.bin/eslint index.js */**.js",
"lint-fix": "./node_modules/.bin/eslint --fix index.js */**.js"
},
Expand All @@ -32,9 +31,6 @@
"react-native",
"segmentation"
],
"dependencies": {
"extract-zip": "^1.6.6"
},
"peerDependencies": {
"react-native": ">=0.63.3"
},
Expand Down

0 comments on commit e9459aa

Please sign in to comment.