reactnative-plugin-appice 1.6.2 → 1.6.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.
@@ -375,7 +375,16 @@ public class AppIceReactPluginModule extends ReactContextBaseJavaModule {
375
375
  Context context = getReactApplicationContext();
376
376
  callback.invoke(ContextSdk.getInternalId(context));
377
377
  }
378
-
378
+ /**
379
+ * To get the user_id from sdk.
380
+ *
381
+ * @callback will have the string
382
+ */
383
+ @ReactMethod
384
+ public void getUserId(Callback callback){
385
+ Context context = getReactApplicationContext();
386
+ callback.invoke(ContextSdk.getUserId(context));
387
+ }
379
388
 
380
389
  public static void sendEvent(String eventName, @Nullable WritableMap params) {
381
390
  try {
package/example/App.js CHANGED
@@ -83,6 +83,12 @@ addAppICEAPIListeners();
83
83
  color="#841584"
84
84
 
85
85
  />
86
+ <Button
87
+ onPress={getUserId}
88
+ title="getUserId"
89
+ color="#841584"
90
+
91
+ />
86
92
  </View>
87
93
  )
88
94
 
@@ -143,6 +149,12 @@ const setLanguage = () => {
143
149
  };
144
150
  const sendView = () => {
145
151
  AppICE.tagEvent("HomeScreen", {});
146
- }
152
+ };
153
+
154
+ const getUserId = () => {
155
+ AppICE.getUserId((userIds: any[]) => {
156
+ console.log('User IDs:', userIds);
157
+ });
158
+ };
147
159
 
148
160
  export default HelloWorldApp;
@@ -16,7 +16,7 @@
16
16
  "install": "^0.13.0",
17
17
  "react": "18.0.0",
18
18
  "react-native": "0.69.4",
19
- "reactnative-plugin-appice": "^1.6.2"
19
+ "reactnative-plugin-appice": "^1.6.3"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@babel/core": "^7.12.9",
package/index.js CHANGED
@@ -112,6 +112,10 @@ var AppICEReact = {
112
112
  AppIceReactPlugin.setUser(profile);
113
113
  },
114
114
 
115
+ //===============================================
116
+ // User id setting
117
+ //===============================================
118
+
115
119
  /**
116
120
  * Set unique user id
117
121
  * @param {object} values - array of userids
@@ -120,6 +124,14 @@ var AppICEReact = {
120
124
  AppIceReactPlugin.setUserId(values);
121
125
  },
122
126
 
127
+ /**
128
+ * Getuser id
129
+ * @param {object} values - array of userids
130
+ */
131
+ getUserId: function(callback){
132
+ callWithCallback ('getUserId', null, callback);
133
+ },
134
+
123
135
  getCustomDataFromPayload: function (object) {
124
136
  let userObj = JSON.parse(object, (key, value) => {
125
137
  return value;
@@ -102,6 +102,29 @@ RCT_EXPORT_METHOD(setUserId:(NSArray*)userIdArray)
102
102
  [[appICE sharedInstance] setUserId:userIdArray];
103
103
  }
104
104
 
105
+ /**
106
+ * Call the native method to getUserId
107
+ * Check if the getUserIdArray is not nil and the callback function is provided
108
+ * else Handle the case when getUserIdArray is nil
109
+ * Invoke the callback with an array containing NSNull to represent nil
110
+ */
111
+
112
+ RCT_EXPORT_METHOD(getUserId:(RCTResponseSenderBlock)callback)
113
+ {
114
+
115
+ NSMutableArray *getUserIdArray = [[appICE sharedInstance] getUserId];
116
+ RCTLog(@"getUserIdArray %@", getUserIdArray);
117
+
118
+ if (getUserIdArray && getUserIdArray.count > 0 && callback) {
119
+ callback(@[getUserIdArray]);
120
+ } else {
121
+ if (callback) {
122
+ callback(@[[NSNull null]]);
123
+ }
124
+ }
125
+
126
+ }
127
+
105
128
  RCT_EXPORT_METHOD(pushNotificationClicked:(NSDictionary*)userInfo)
106
129
  {
107
130
  [[appICE sharedInstance] pushNotificationClickedEvent:userInfo];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactnative-plugin-appice",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "appICE React Native SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -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>AppIceReactPlugin.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </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>Pods-AppIceReactPlugin.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>1</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>