clevertap-react-native 1.2.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,33 @@
1
1
  Change Log
2
2
  ==========
3
3
 
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
+
4
31
  Version 1.2.1 *(25 October 2023)*
5
32
  -------------------------------------------
6
33
  **What's new**
File without changes
@@ -0,0 +1,2 @@
1
+ #Fri Feb 02 17:10:58 IST 2024
2
+ gradle.version=6.1.1
File without changes
@@ -21,8 +21,8 @@ android {
21
21
  defaultConfig {
22
22
  minSdkVersion 19
23
23
  targetSdkVersion 33
24
- versionCode 121
25
- versionName "1.2.1"
24
+ versionCode 200
25
+ versionName "2.0.0"
26
26
  }
27
27
  buildTypes {
28
28
  release {
@@ -39,7 +39,7 @@ dependencies {
39
39
  maven { url "$rootDir/../node_modules/react-native/android" }
40
40
  }
41
41
 
42
- api 'com.clevertap.android:clevertap-android-sdk:5.2.1'
42
+ api 'com.clevertap.android:clevertap-android-sdk:6.0.0'
43
43
  implementation 'com.android.installreferrer:installreferrer:2.2'
44
44
  //compile 'com.android.support:appcompat-v7:28.0.0'
45
45
  implementation 'com.facebook.react:react-native:+'
@@ -41,6 +41,7 @@ import com.clevertap.android.sdk.variables.Var;
41
41
  import com.clevertap.android.sdk.variables.callbacks.FetchVariablesCallback;
42
42
  import com.clevertap.android.sdk.variables.callbacks.VariableCallback;
43
43
  import com.clevertap.android.sdk.variables.callbacks.VariablesChangedCallback;
44
+ import com.clevertap.android.sdk.inapp.callbacks.FetchInAppsCallback;
44
45
  import com.facebook.react.bridge.Arguments;
45
46
  import com.facebook.react.bridge.Callback;
46
47
  import com.facebook.react.bridge.ReactApplicationContext;
@@ -1547,6 +1548,30 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
1547
1548
  }
1548
1549
  }
1549
1550
 
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
+
1550
1575
  /************************************************
1551
1576
  * Product Experience Remote Config methods ends
1552
1577
  ************************************************/
@@ -18,6 +18,6 @@ Pod::Spec.new do |s|
18
18
  s.preserve_paths = 'LICENSE.md', 'README.md', 'package.json', 'index.js'
19
19
  s.source_files = 'ios/CleverTapReact/*.{h,m}'
20
20
 
21
- s.dependency 'CleverTap-iOS-SDK', '5.2.1'
21
+ s.dependency 'CleverTap-iOS-SDK', '6.0.0'
22
22
  s.dependency 'React-Core'
23
23
  end
package/index.d.ts CHANGED
@@ -756,6 +756,21 @@ export function isPushPermissionGranted(callback: CallbackString): void;
756
756
  */
757
757
  export function onValueChanged(name: string, handler: Function): void;
758
758
 
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
+
759
774
  /*******************
760
775
  * Developer Options
761
776
  ******************/
package/index.js CHANGED
@@ -9,7 +9,7 @@ const EventEmitter = NativeModules.CleverTapReactEventEmitter ? new NativeEventE
9
9
  * @param {int} libVersion - The updated library version. If current version is 1.1.0 then pass as 10100
10
10
  */
11
11
  const libName = 'React-Native';
12
- const libVersion = 10201;
12
+ const libVersion = 20000;
13
13
  CleverTapReact.setLibrary(libName,libVersion);
14
14
 
15
15
  function defaultCallback(method, err, res) {
@@ -949,6 +949,24 @@ var CleverTap = {
949
949
  onValueChanged: function (name, handler) {
950
950
  CleverTapReact.onValueChanged(name);
951
951
  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);
952
970
  }
953
971
  };
954
972
 
@@ -634,11 +634,16 @@ RCT_EXPORT_METHOD(initializeInbox) {
634
634
 
635
635
  RCT_EXPORT_METHOD(showInbox:(NSDictionary*)styleConfig) {
636
636
  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
+
637
644
  CleverTapInboxViewController *inboxController = [[self cleverTapInstance] newInboxViewControllerWithConfig:[self _dictToInboxStyleConfig:styleConfig? styleConfig : nil] andDelegate:(id <CleverTapInboxViewControllerDelegate>)self];
638
645
  if (inboxController) {
639
646
  UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:inboxController];
640
- UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
641
- UIViewController *mainViewController = keyWindow.rootViewController;
642
647
  [mainViewController presentViewController:navigationController animated:YES completion:nil];
643
648
  }
644
649
  }
@@ -852,6 +857,20 @@ RCT_EXPORT_METHOD(resumeInAppNotifications) {
852
857
  [[self cleverTapInstance] resumeInAppNotifications];
853
858
  }
854
859
 
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
+
855
874
  #pragma mark - Push Permission
856
875
 
857
876
  - (CTLocalInApp*)_localInAppConfigFromReadableMap: (NSDictionary *)json {
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "clevertap-react-native",
3
- "version": "1.2.1",
3
+ "version": "2.0.0",
4
4
  "description": "CleverTap React Native SDK.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
- "postinstall": "node install.js",
10
9
  "lint": "./node_modules/.bin/eslint index.js */**.js",
11
10
  "lint-fix": "./node_modules/.bin/eslint --fix index.js */**.js"
12
11
  },
@@ -32,9 +31,6 @@
32
31
  "react-native",
33
32
  "segmentation"
34
33
  ],
35
- "dependencies": {
36
- "extract-zip": "^1.6.6"
37
- },
38
34
  "peerDependencies": {
39
35
  "react-native": ">=0.63.3"
40
36
  },
package/install.js DELETED
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs')
4
- const path = require('path')
5
- const extract = require('extract-zip')
6
-
7
- const sdkPath = path.join(__dirname, 'ios/CleverTapReact/');
8
- const zipFile = sdkPath+'CleverTapSDK.framework.zip';
9
- const errMsg = "error unzipping CleverTapSDK.framework.zip in " + sdkPath + " please unzip manually";
10
-
11
- fs.access(zipFile, (err) => {
12
- if (!err) {
13
- extract(zipFile, {dir: sdkPath}, function (err) {
14
- if (!err) {
15
- fs.unlinkSync(zipFile);
16
- } else {
17
- console.log(err);
18
- console.error(errMsg);
19
- }
20
- });
21
- } else {
22
- console.error(err);
23
- }
24
- });
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "self:">
6
- </FileRef>
7
- </Workspace>
@@ -1,8 +0,0 @@
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>
@@ -1,14 +0,0 @@
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>SchemeUserState</key>
6
- <dict>
7
- <key>CleverTapReact.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>