clevertap-react-native 1.0.2 → 1.0.3

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,10 @@
1
1
  Change Log
2
2
  ==========
3
3
 
4
+ Version 1.0.3 *(3rd May 2023)*
5
+ -------------------------------------------
6
+ - Fixes a bug where notification clicked callbacks were not working for killed state in iOS.
7
+
4
8
  Version 1.0.2 *(3rd April 2023)*
5
9
  -------------------------------------------
6
10
  - Supports [CleverTap iOS SDK v4.2.2](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-422-april-03-2023)
@@ -12,7 +16,6 @@ Version 1.0.1 *(8th March 2023)*
12
16
  - Supports [CleverTap Android Push Templates SDK v1.0.8](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTPUSHTEMPLATESCHANGELOG.md#version-108-march-8-2023)
13
17
  - Make sure you update all three above versions for compatibility and smooth working.
14
18
 
15
-
16
19
  Version 1.0.0 *(20 January 2023)*
17
20
  -------------------------------------------
18
21
  - Adds below new public APIs to support [CleverTap Android SDK v4.7.2](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-472-december-16-2022) and [CleverTap iOS SDK v4.2.0](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-420-december-13-2022)
@@ -20,6 +23,32 @@ Version 1.0.0 *(20 January 2023)*
20
23
  - Adds push permission callback method which returns true/false after user allow/deny the notification permission.
21
24
  - Refer [Push Primer doc](./docs/pushprimer.md) for more details.
22
25
 
26
+ Version 0.9.7 *(3rd May 2023)*
27
+ -------------------------------------------
28
+ - Fixes a bug where notification clicked callbacks were not working for killed state in iOS.
29
+ - [Android] Make sure the maximum deployment version is Android 12.
30
+
31
+ Version 0.9.6 *(3 April 2023)*
32
+ -------------------------------------------
33
+ - Supports [CleverTap Android SDK v4.6.9](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-468-march-22-2023)
34
+ - Supports [CleverTap iOS SDK v4.2.2](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-422-april-03-2023)
35
+ - **[Breaking Change]**: Renames the `itemIndex` field with the `contentPageIndex` field in the payload of the `CleverTap.CleverTapInboxMessageTapped` callback.
36
+ - **[Parity with iOS platform]**:
37
+ The `CleverTap.CleverTapInboxMessageTapped` callback now provides a different value for `contentPageIndex`(ex-`itemIndex`) compared to before. Previously, it used to indicate the position of the clicked item within the list container of the App Inbox. However, now it indicates the page index of the content, which ranges from 0 to the total number of pages for carousel templates. For non-carousel templates, the value is always 0, as they only have one page of content.
38
+ - **[Type Definitions support in typescript]**: Supports type definitions for the event names that are available for Javascript.
39
+
40
+ Version 0.9.5 *(27 March 2023)*
41
+ -------------------------------------------
42
+ - Supports [CleverTap Android SDK v4.6.8](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-468-march-22-2023)
43
+ - Supports [CleverTap iOS SDK v4.2.1](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-421-march-22-2023)
44
+ - 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)
45
+ - 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).
46
+ - Make sure you update all four above versions for compatibility and smooth working.
47
+ - **Note:** This release is being done for Android 12 targeted users.
48
+ - **[Android and iOS platforms]**:
49
+ 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.
50
+ - **[Android Platform] Behavioral change of `CleverTap.CleverTapInboxMessageTapped` listener**:
51
+ 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.
23
52
 
24
53
  Version 0.9.4 *(28 November 2022)*
25
54
  -------------------------------------------
package/docs/usage.md CHANGED
@@ -104,6 +104,27 @@ CleverTap.showInbox({'tabs':['Offers','Promotions'],'navBarTitle':'My App Inbox'
104
104
  'noMessageText':'No message(s)','noMessageTextColor':'#FF0000'});
105
105
  ```
106
106
 
107
+ #### App Inbox Item Click Callback
108
+
109
+ ```javascript
110
+ CleverTap.addListener(CleverTap.CleverTapInboxMessageTapped, (event) => {
111
+ console.log("App Inbox item: ", event.data);
112
+ //following contentPageIndex and buttonIndex fields are available from CleverTap React Native SDK v0.9.6 onwards and below v1.0.0
113
+ console.log("Content Page index: " + event.contentPageIndex);
114
+ console.log("Button index: " + event.buttonIndex);
115
+ });
116
+ ```
117
+
118
+ #### App Inbox Button Click Callback
119
+ ```javascript
120
+ CleverTap.addListener(CleverTap.CleverTapInboxMessageButtonTapped, (event) => {/*consume the payload*/});
121
+ ```
122
+
123
+ #### Dismiss the App Inbox
124
+ ```javascript
125
+ CleverTap.dismissInbox();
126
+ ```
127
+
107
128
  #### Get Total message count
108
129
 
109
130
  ```javascript
@@ -97,7 +97,6 @@ RCT_EXPORT_METHOD(getInitialUrl:(RCTResponseSenderBlock)callback) {
97
97
  }
98
98
  }
99
99
 
100
-
101
100
  #pragma mark - Push Notifications
102
101
 
103
102
  RCT_EXPORT_METHOD(registerForPush) {
@@ -10,5 +10,6 @@
10
10
  - (void)setDelegates:(CleverTap *)cleverTapInstance;
11
11
 
12
12
  @property NSString *launchDeepLink;
13
+ @property(nonatomic, strong) NSDictionary *pendingPushNotificationExtras;
13
14
 
14
15
  @end
@@ -3,6 +3,9 @@
3
3
 
4
4
  #import <UIKit/UIKit.h>
5
5
  #import <React/RCTLog.h>
6
+ #import <React/RCTBridge.h>
7
+ #import <React/RCTEventDispatcher.h>
8
+ #import <React/RCTRootView.h>
6
9
 
7
10
  #import "CleverTap+Inbox.h"
8
11
  #import "CleverTapUTMDetail.h"
@@ -32,9 +35,15 @@
32
35
  return sharedInstance;
33
36
  }
34
37
 
38
+
35
39
  - (instancetype)init {
36
40
  self = [super init];
37
41
  if (self) {
42
+
43
+ [[NSNotificationCenter defaultCenter] addObserver:self
44
+ selector:@selector(handleContentDidAppearNotification:)
45
+ name:RCTContentDidAppearNotification
46
+ object:nil];
38
47
  CleverTap *clevertap = [CleverTap sharedInstance];
39
48
  [self setDelegates:clevertap];
40
49
  }
@@ -52,11 +61,15 @@
52
61
  [cleverTapInstance setLibrary:@"React-Native"];
53
62
  }
54
63
 
64
+
55
65
  - (void)applicationDidLaunchWithOptions:(NSDictionary *)options {
56
66
  NSDictionary *notification = [options valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
57
- if (notification && notification[@"wzrk_dl"]) {
58
- self.launchDeepLink = notification[@"wzrk_dl"];
59
- RCTLogInfo(@"CleverTapReact: setting launch deeplink: %@", self.launchDeepLink);
67
+ if (notification){
68
+ self.pendingPushNotificationExtras = notification;
69
+ if (notification[@"wzrk_dl"]) {
70
+ self.launchDeepLink = notification[@"wzrk_dl"];
71
+ RCTLogInfo(@"CleverTapReact: setting launch deeplink: %@", self.launchDeepLink);
72
+ }
60
73
  }
61
74
  }
62
75
 
@@ -160,4 +173,15 @@
160
173
  [self postNotificationWithName:kCleverTapPushPermissionResponseReceived andBody:body];
161
174
  }
162
175
 
176
+ - (void)handleContentDidAppearNotification:(NSNotification *)notification {
177
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
178
+
179
+ NSMutableDictionary *pushNotificationExtras = [NSMutableDictionary new];
180
+ NSDictionary *customExtras = self.pendingPushNotificationExtras;
181
+ if (customExtras != nil) {
182
+ pushNotificationExtras[@"customExtras"] = customExtras;
183
+ [self postNotificationWithName:kCleverTapPushNotificationClicked andBody:pushNotificationExtras];
184
+ }
185
+ }
186
+
163
187
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clevertap-react-native",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "CleverTap React Native SDK.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",