reactnative-plugin-appice 1.7.44 → 1.7.46

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.
File without changes
@@ -97,7 +97,7 @@ dependencies {
97
97
  annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.3.1"
98
98
 
99
99
  //appice
100
- implementation "appice.io.android:sdk:2.6.39"
100
+ implementation "appice.io.android:sdk:2.6.44"
101
101
 
102
102
  //glide
103
103
  implementation "com.github.bumptech.glide:glide:4.11.0"
@@ -952,6 +952,7 @@ public class AppIceReactPluginModule extends ReactContextBaseJavaModule {
952
952
  constants.put(EnumConstants.APPICE_PUSH_NOTIFICATION_CLICKED.getConstants(), EnumConstants.APPICE_PUSH_NOTIFICATION_CLICKED.getValue());
953
953
  constants.put(EnumConstants.APPICE_PUSH_NOTIFICATION_ACTION_BUTTON_CLICKED.getConstants(), EnumConstants.APPICE_PUSH_NOTIFICATION_ACTION_BUTTON_CLICKED.getValue());
954
954
  constants.put(EnumConstants.APPICE_INAPP_NOTIFICATION_CLICKED.getConstants(), EnumConstants.APPICE_INAPP_NOTIFICATION_CLICKED.getValue());
955
+ constants.put(EnumConstants.APPICE_HTML_INAPP_NOTIFICATION_CLICKED.getConstants(), EnumConstants.APPICE_HTML_INAPP_NOTIFICATION_CLICKED.getValue());
955
956
  constants.put(EnumConstants.FIRST_SEEN.getConstants(), EnumConstants.FIRST_SEEN.getValue());
956
957
  constants.put(EnumConstants.LAST_SEEN.getConstants(), EnumConstants.LAST_SEEN.getValue());
957
958
  constants.put(EnumConstants.TOP_N_PRODUCTS_VIEWED.getConstants(), EnumConstants.TOP_N_PRODUCTS_VIEWED.getValue());
@@ -1,5 +1,7 @@
1
1
  package com.appice.react;
2
2
 
3
+ import static com.appice.react.AppICEUtils.printLog;
4
+
3
5
  import android.content.BroadcastReceiver;
4
6
  import android.content.Context;
5
7
  import android.content.Intent;
@@ -10,6 +12,8 @@ import com.facebook.react.bridge.WritableMap;
10
12
 
11
13
  import org.json.JSONObject;
12
14
 
15
+ import semusi.context.utility.Utility;
16
+
13
17
  public class CampaignCampsReceiver extends BroadcastReceiver {
14
18
  private static final String TAG = "CampaignCampsReceiver";
15
19
  public CampaignCampsReceiver(){
@@ -20,7 +24,7 @@ public class CampaignCampsReceiver extends BroadcastReceiver {
20
24
  try {
21
25
  sendCallback(intent.getExtras(), context);
22
26
  } catch (Exception e) {
23
- AppICEUtils.printLog(TAG,e.getMessage());
27
+ printLog(TAG,e.getMessage());
24
28
  }
25
29
  }
26
30
 
@@ -29,8 +33,11 @@ public class CampaignCampsReceiver extends BroadcastReceiver {
29
33
 
30
34
  String cdata = extra.getString("cdata");
31
35
  String ai_content = extra.getString("ai_content");
36
+ String campaignStr = extra.getString("campaign");
32
37
  boolean category = extra.getBoolean("ai_inapp");
38
+ boolean isHTMLInApp = extra.getBoolean("html_ai_inapp");
33
39
 
40
+ printLog("inapp flow test |","sendCallback |ai_content "+ai_content+"| category "+category);
34
41
  if (category) {
35
42
  if (cdata != null && cdata.length() > 0) {
36
43
  WritableMap params = Arguments.createMap();
@@ -38,6 +45,13 @@ public class CampaignCampsReceiver extends BroadcastReceiver {
38
45
  AppIceReactPluginModule.sendEvent(EnumConstants.APPICE_INAPP_NOTIFICATION_CLICKED.getValue(), params);
39
46
  }
40
47
  }
48
+ if (isHTMLInApp){
49
+ if (Utility.isValidObject(campaignStr)) {
50
+ WritableMap params = Arguments.createMap();
51
+ params.putString(EnumConstants.APPICE_HTML_INAPP_NOTIFICATION_CLICKED.getValue(), campaignStr);
52
+ AppIceReactPluginModule.sendEvent(EnumConstants.APPICE_HTML_INAPP_NOTIFICATION_CLICKED.getValue(), params);
53
+ }
54
+ }
41
55
 
42
56
  if (ai_content != null && ai_content.length()>0){
43
57
  JSONObject pushContent = new JSONObject(ai_content);
@@ -50,7 +64,7 @@ public class CampaignCampsReceiver extends BroadcastReceiver {
50
64
  }
51
65
  }
52
66
  } catch (Exception e) {
53
- AppICEUtils.printLog(TAG,e.getMessage());
67
+ printLog(TAG,e.getMessage());
54
68
  }
55
69
  }
56
70
  }
@@ -37,6 +37,7 @@ public enum EnumConstants {
37
37
  //IN-APP
38
38
  //============================
39
39
  APPICE_INAPP_NOTIFICATION_CLICKED("AppICEInAppClicked"),
40
+ APPICE_HTML_INAPP_NOTIFICATION_CLICKED("AppICEHTMLInAppClicked"),
40
41
 
41
42
  //============================
42
43
  //INBOX
@@ -166,6 +167,10 @@ public enum EnumConstants {
166
167
  return StringConstants.APPICE_INAPP_NOTIFICATION_CLICKED;
167
168
  }
168
169
 
170
+ case APPICE_HTML_INAPP_NOTIFICATION_CLICKED:{
171
+ return StringConstants.APPICE_HTML_INAPP_NOTIFICATION_CLICKED;
172
+ }
173
+
169
174
  case INBOX_MESSAGE:{
170
175
  return StringConstants.INBOX_MESSAGE;
171
176
  }
@@ -10,6 +10,7 @@ public interface StringConstants{
10
10
  String APPICE_PUSH_NOTIFICATION_CLICKED = "AppICEPushNotificationClicked";
11
11
  String APPICE_PUSH_NOTIFICATION_ACTION_BUTTON_CLICKED = "AppICEPushNotificationActionButtonClicked";
12
12
  String APPICE_INAPP_NOTIFICATION_CLICKED = "AppICEInAppClicked";
13
+ String APPICE_HTML_INAPP_NOTIFICATION_CLICKED = "AppICEHTMLInAppClicked";
13
14
  String INBOX_MESSAGE = "message";
14
15
  String INBOX_TITLE = "title";
15
16
  String INBOX_MESSAGE_STATUS = "messageStatus";
package/index.js CHANGED
@@ -47,6 +47,7 @@ var AppICEReact = {
47
47
  // IN-APP
48
48
  //==========================
49
49
  AppICEInAppClicked: AppIceReactPlugin.AppICEInAppClicked,
50
+ AppICEHTMLInAppClicked: AppIceReactPlugin.AppICEHTMLInAppClicked,
50
51
 
51
52
  //========================
52
53
  // APP-INBOX
@@ -36,7 +36,7 @@ RCT_EXPORT_MODULE();
36
36
 
37
37
  - (NSArray<NSString *> *)supportedEvents
38
38
  {
39
- return @[kAppICEPushNotificationClicked, kAppICEInAppClicked, kAppICEPushNotificationActionButtonClicked];
39
+ return @[kAppICEPushNotificationClicked, kAppICEInAppClicked, kAppICEPushNotificationActionButtonClicked,kAppICEHTMLInAppClicked];
40
40
  }
41
41
 
42
42
 
@@ -57,6 +57,11 @@ RCT_EXPORT_MODULE();
57
57
  name:kAppICEPushNotificationActionButtonClicked
58
58
  object:nil];
59
59
 
60
+ [[NSNotificationCenter defaultCenter] addObserver:self
61
+ selector:@selector(InAppHTMLCallback:)
62
+ name:kAppICEHTMLInAppClicked
63
+ object:nil];
64
+
60
65
  }
61
66
 
62
67
  - (void)stopObserving {
@@ -86,6 +91,17 @@ RCT_EXPORT_MODULE();
86
91
  [self sendEventWithName:kAppICEInAppClicked body:eventDict];
87
92
  }
88
93
 
94
+ //InAppHTMLCallback
95
+ -(void)InAppHTMLCallback:(NSNotification *)event{
96
+ RCTLog(@"from InAppHTMLCallback %@",event);
97
+ NSError * err;
98
+ NSData * jsonUserInfo = [NSJSONSerialization dataWithJSONObject:event.userInfo options:0 error:&err];
99
+ NSMutableDictionary * eventDict = [[NSMutableDictionary alloc]init];
100
+ [eventDict setObject:[[NSString alloc] initWithData:jsonUserInfo encoding:NSUTF8StringEncoding] forKey:kAppICEHTMLInAppClicked];
101
+ RCTLog(@"eventDict %@",eventDict);
102
+ [self sendEventWithName:kAppICEHTMLInAppClicked body:eventDict];
103
+ }
104
+
89
105
  - (void)didReceiveHandlePush:(NSNotification *)event {
90
106
  // Forward the handlePush event (which contains campaign data) to JS
91
107
  [self sendEventWithName:kAppICEPushNotificationActionButtonClicked body:event.userInfo];
@@ -3,6 +3,8 @@
3
3
  static NSString *const kAppICEPushNotificationClicked = @"AppICEPushNotificationClicked";
4
4
  static NSString *const kAppICEInAppClicked = @"AppICEInAppClicked";
5
5
  static NSString *const kAppICEPushNotificationActionButtonClicked = @"AppICEPushNotificationActionButtonClicked";
6
+ static NSString *const kAppICEHTMLInAppClicked = @"AppICEHTMLInAppClicked";
7
+
6
8
 
7
9
  static NSString *const kn = @"APPICE_USER_NAME";
8
10
  static NSString *const kem = @"APPICE_USER_EMAIL";
@@ -40,6 +40,7 @@ RCT_EXPORT_MODULE()
40
40
  kAppICEPushNotificationClicked : kAppICEPushNotificationClicked,
41
41
  kAppICEInAppClicked : kAppICEInAppClicked,
42
42
  kAppICEPushNotificationActionButtonClicked : kAppICEPushNotificationActionButtonClicked,
43
+ kAppICEHTMLInAppClicked:kAppICEHTMLInAppClicked,
43
44
  kn : NAME,
44
45
  kem : EMAIL,
45
46
  kph : PHONE,
@@ -122,6 +123,7 @@ RCT_EXPORT_METHOD(startContext:(NSString *)appID
122
123
  [[NSUserDefaults standardUserDefaults] removeObjectForKey:kappICEToken];
123
124
  }
124
125
  [self setClickCallback];
126
+ [self setHTMLInAppClickListener];
125
127
  }
126
128
 
127
129
  /**
@@ -291,6 +293,24 @@ RCT_EXPORT_METHOD(inAppClicked:(NSDictionary*)userInfo)
291
293
  }];
292
294
 
293
295
  }
296
+
297
+ /**
298
+
299
+ Registers a listener for HTML In-App campaign click events.
300
+ This method listens for HTML In-App click actions from the AppICE SDK.
301
+
302
+ * Convert campaign object into dictionary format
303
+ * Post notification with campaign data
304
+
305
+ */
306
+ - (void)setHTMLInAppClickListener
307
+ {
308
+ [[appICE sharedInstance] handleHTMLInAppClickListener:^(Campaign * _Nullable campaign) {
309
+ NSDictionary *cData = campaign ? [campaign toDictionary] : @{};
310
+ RCTLog(@"***** HTML INapp click *** %@", cData);
311
+ [[NSNotificationCenter defaultCenter] postNotificationName:kAppICEHTMLInAppClicked object:nil userInfo:cData];
312
+ }];
313
+ }
294
314
  RCT_EXPORT_METHOD(setInternalId:(NSString*) internalId)
295
315
  {
296
316
  [[appICE sharedInstance] setInternalId:internalId];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactnative-plugin-appice",
3
- "version": "1.7.44",
3
+ "version": "1.7.46",
4
4
  "description": "appICE React Native SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -23,7 +23,7 @@ Pod::Spec.new do |s|
23
23
  s.requires_arc = true
24
24
 
25
25
  s.dependency "React"
26
- s.dependency "AppICE-IOS-SDK", "1.8.22"
26
+ s.dependency "AppICE-IOS-SDK", "1.8.27"
27
27
  # ...
28
28
  # s.dependency "..."
29
29
  end