clevertap-react-native 0.9.4 → 0.9.5

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,5 +1,17 @@
1
1
  Change Log
2
2
  ==========
3
+ Version 0.9.5 *(27 March 2023)*
4
+ -------------------------------------------
5
+ - Supports [CleverTap Android SDK v4.6.8](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-468-march-22-2023)
6
+ - Supports [CleverTap iOS SDK v4.2.1](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-421-march-22-2023)
7
+ - Supports [CleverTap Android RenderMax SDK v1.0.3](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTRENDERMAXCHANGELOG.md#version-103-march-6-2023)
8
+ - Supports [CleverTap Push Templates SDK v1.0.5.1](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTPUSHTEMPLATESCHANGELOG.md#version-1051-march-15-2023).
9
+ - Make sure you update all four above versions for compatibility and smooth working.
10
+ - **Note:** This release is being done for Android 12 targeted users.
11
+ - **[Android and iOS Platforms]**:
12
+ Adds `itemIndex` and `buttonIndex` arguments to the payload sent via App Inbox Message tapped listener: `CleverTap.CleverTapInboxMessageTapped`. The `itemIndex` corresponds the index of the item clicked in the list whereas the `buttonIndex` for the App Inbox button clicked (0, 1, or 2). A value of -1 in `buttonIndex` indicates the App Inbox item is clicked.
13
+ - **[Android Platform] Behavioral change of `CleverTap.CleverTapInboxMessageTapped` listener**:
14
+ Previously, the callback was raised when the App Inbox item is clicked. Now, it is also raised when the App Inbox button is clicked. It matches the behavior in iOS platform.
3
15
 
4
16
  Version 0.9.4 *(28 November 2022)*
5
17
  -------------------------------------------
@@ -21,8 +21,8 @@ android {
21
21
  defaultConfig {
22
22
  minSdkVersion 16
23
23
  targetSdkVersion 31
24
- versionCode 93
25
- versionName "0.9.3"
24
+ versionCode 95
25
+ versionName "0.9.5"
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:4.6.6'
42
+ api 'com.clevertap.android:clevertap-android-sdk:4.6.8'
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:+'
@@ -729,14 +729,17 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
729
729
  sendEvent(CLEVERTAP_ON_INBOX_BUTTON_CLICK, getWritableMapFromMap(payload));
730
730
 
731
731
  }
732
+
732
733
  @Override
733
- public void onInboxItemClicked(CTInboxMessage message){
734
+ public void onInboxItemClicked(CTInboxMessage message, int itemIndex, int buttonIndex) {
734
735
  WritableMap params = Arguments.createMap();
735
736
  JSONObject data = message.getData();
736
737
  if (data != null) {
737
738
  params.putString("data", data.toString());
738
739
  }
739
- sendEvent(CLEVERTAP_ON_INBOX_MESSAGE_CLICK,params);
740
+ params.putInt("itemIndex", itemIndex);
741
+ params.putInt("buttonIndex", buttonIndex);
742
+ sendEvent(CLEVERTAP_ON_INBOX_MESSAGE_CLICK, params);
740
743
  }
741
744
 
742
745
  //Product Config Callback
@@ -1264,6 +1267,14 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
1264
1267
  }
1265
1268
  }
1266
1269
 
1270
+ @ReactMethod
1271
+ public void dismissInbox() {
1272
+ CleverTapAPI cleverTap = getCleverTapAPI();
1273
+ if (cleverTap != null) {
1274
+ cleverTap.dismissAppInbox();
1275
+ }
1276
+ }
1277
+
1267
1278
  // Increment/Decrement Operator
1268
1279
 
1269
1280
  @ReactMethod
@@ -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', '4.1.5'
21
+ s.dependency 'CleverTap-iOS-SDK', '4.2.1'
22
22
  s.dependency 'React-Core'
23
23
  end
package/docs/install.md CHANGED
@@ -86,7 +86,9 @@ dependencies {
86
86
 
87
87
 
88
88
  //clevertap
89
- implementation 'com.clevertap.android:clevertap-android-sdk:4.6.6'
89
+ implementation 'com.clevertap.android:clevertap-android-sdk:4.6.8'
90
+ implementation "com.clevertap.android:push-templates:1.0.5.1" //Optional for push templates SDK support
91
+ implementation "com.clevertap.android:clevertap-rendermax-sdk:1.0.3" //Optional for renderMax SDK support
90
92
 
91
93
 
92
94
  // other libs
package/docs/usage.md CHANGED
@@ -104,6 +104,11 @@ CleverTap.showInbox({'tabs':['Offers','Promotions'],'navBarTitle':'My App Inbox'
104
104
  'noMessageText':'No message(s)','noMessageTextColor':'#FF0000'});
105
105
  ```
106
106
 
107
+ #### Dismiss the App Inbox
108
+ ```javascript
109
+ CleverTap.dismissInbox();
110
+ ```
111
+
107
112
  #### Get Total message count
108
113
 
109
114
  ```javascript
package/index.d.ts CHANGED
@@ -430,6 +430,11 @@
430
430
  * @param styleConfig : any or empty object
431
431
  */
432
432
  export function showInbox(styleConfig: any): void;
433
+
434
+ /**
435
+ * Call this method to dismiss the App Inbox
436
+ */
437
+ export function dismissInbox(): void;
433
438
 
434
439
  /**
435
440
  * Call this method to get all inbox messages
package/index.js CHANGED
@@ -45,7 +45,7 @@ var CleverTap = {
45
45
  CleverTapInboxDidInitialize: CleverTapReact.CleverTapInboxDidInitialize,
46
46
  CleverTapInboxMessagesDidUpdate: CleverTapReact.CleverTapInboxMessagesDidUpdate,
47
47
  CleverTapInboxMessageButtonTapped: CleverTapReact.CleverTapInboxMessageButtonTapped,
48
- CleverTapInboxMessageTapped:CleverTapReact.CleverTapInboxMessageTapped,
48
+ CleverTapInboxMessageTapped: CleverTapReact.CleverTapInboxMessageTapped,
49
49
  CleverTapDisplayUnitsLoaded: CleverTapReact.CleverTapDisplayUnitsLoaded,
50
50
  CleverTapInAppNotificationButtonTapped: CleverTapReact.CleverTapInAppNotificationButtonTapped,
51
51
  CleverTapFeatureFlagsDidUpdate: CleverTapReact.CleverTapFeatureFlagsDidUpdate,
@@ -525,6 +525,13 @@ var CleverTap = {
525
525
  CleverTapReact.showInbox(styleConfig);
526
526
  },
527
527
 
528
+ /**
529
+ * Method to dismiss the App Inbox
530
+ */
531
+ dismissInbox: function () {
532
+ CleverTapReact.dismissInbox();
533
+ },
534
+
528
535
  /**
529
536
  * Get the total number of Inbox Messages
530
537
  * @param {function(err, res)} callback that returns a res of count of inbox messages or -1
@@ -539,6 +539,11 @@ RCT_EXPORT_METHOD(deleteInboxMessageForId:(NSString*)messageId) {
539
539
  [[self cleverTapInstance] deleteInboxMessageForID:messageId];
540
540
  }
541
541
 
542
+ RCT_EXPORT_METHOD(dismissInbox) {
543
+ RCTLogInfo(@"[CleverTap dismissAppInbox]");
544
+ [[self cleverTapInstance] dismissAppInbox];
545
+ }
546
+
542
547
  RCT_EXPORT_METHOD(initializeInbox) {
543
548
  RCTLogInfo(@"[CleverTap Inbox Initialize]");
544
549
  [[self cleverTapInstance] initializeInboxWithCallback:^(BOOL success) {
@@ -640,13 +645,11 @@ RCT_EXPORT_METHOD(showInbox:(NSDictionary*)styleConfig) {
640
645
  - (void)messageDidSelect:(CleverTapInboxMessage *_Nonnull)message atIndex:(int)index withButtonIndex:(int)buttonIndex {
641
646
  NSMutableDictionary *body = [NSMutableDictionary new];
642
647
  if ([message json] != nil) {
643
- NSError *error;
644
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:[message json]
645
- options:0
646
- error:&error];
647
- NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
648
- body[@"data"] = jsonString;
648
+ body[@"data"] = [NSMutableDictionary dictionaryWithDictionary:[message json]];
649
649
  }
650
+ body[@"itemIndex"] = @(index);
651
+ body[@"buttonIndex"] = @(buttonIndex);
652
+
650
653
  [[NSNotificationCenter defaultCenter] postNotificationName:kCleverTapInboxMessageTapped object:nil userInfo:body];
651
654
  }
652
655
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clevertap-react-native",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "CleverTap React Native SDK.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
File without changes
@@ -1,2 +0,0 @@
1
- #Wed Sep 28 11:39:15 IST 2022
2
- gradle.version=6.1.1
File without changes