react-native-notifyvisitors 4.6.2 → 4.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.
@@ -5,7 +5,7 @@ connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(8.9))
5
5
  connection.project.dir=
6
6
  eclipse.preferences.version=1
7
7
  gradle.user.home=
8
- java.home=/opt/homebrew/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home
8
+ java.home=/Users/siddharth/.sdkman/candidates/java/21.0.2-tem
9
9
  jvm.arguments=
10
10
  offline.mode=false
11
11
  override.workspace.settings=true
@@ -740,6 +740,38 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
740
740
  }
741
741
  }
742
742
 
743
+ // @ReactMethod
744
+ // public void setUserIdentifier(ReadableMap attributes, final Callback callback) {
745
+ // try {
746
+ // Log.i(TAG, "setUserIdentifier !!");
747
+ // JSONObject mAttributes = null;
748
+
749
+ // if (attributes != null) {
750
+ // HashMap<String, Object> temp = attributes.toHashMap();
751
+ // mAttributes = new JSONObject(temp);
752
+ // }
753
+
754
+ // if (mAttributes != null) {
755
+ // Log.i(TAG, "Attributes : " + mAttributes);
756
+ // } else {
757
+ // Log.i(TAG, "Attributes : null");
758
+ // }
759
+
760
+ // NotifyVisitorsApi.getInstance(reactContext).userIdentifier(mAttributes, new OnUserTrackListener() {
761
+ // @Override
762
+ // public void onResponse(JSONObject data) {
763
+ // if (data != null) {
764
+ // callback.invoke(data.toString());
765
+ // } else {
766
+ // callback.invoke("{}");
767
+ // }
768
+ // }
769
+ // });
770
+ // } catch (Exception e) {
771
+ // Log.i(TAG, "SET USER IDENTIFIER ERROR : " + e);
772
+ // }
773
+ // }
774
+
743
775
  @ReactMethod
744
776
  public void setUserIdentifier(ReadableMap attributes, final Callback callback) {
745
777
  try {
@@ -758,17 +790,40 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
758
790
  }
759
791
 
760
792
  NotifyVisitorsApi.getInstance(reactContext).userIdentifier(mAttributes, new OnUserTrackListener() {
793
+ private boolean isInvoked = false;
794
+
761
795
  @Override
762
796
  public void onResponse(JSONObject data) {
763
- if (data != null) {
764
- callback.invoke(data.toString());
797
+ synchronized (this) {
798
+ if (isInvoked) {
799
+ Log.w(TAG, "⚠️ onResponse called multiple times - ignoring");
800
+ return;
801
+ }
802
+ isInvoked = true;
803
+ }
804
+
805
+ final String result = (data != null) ? data.toString() : "{}";
806
+
807
+ // Add null check for reactContext
808
+ if (reactContext != null) {
809
+ reactContext.runOnUiQueueThread(new Runnable() {
810
+ @Override
811
+ public void run() {
812
+ try {
813
+ callback.invoke(result);
814
+ Log.i(TAG, "✅ Callback invoked successfully");
815
+ } catch (Exception e) {
816
+ Log.e(TAG, "❌ Error invoking callback: " + e. getMessage());
817
+ }
818
+ }
819
+ });
765
820
  } else {
766
- callback.invoke("{}");
767
- }
821
+ Log.e(TAG, "❌ ReactContext is null, cannot invoke callback");
822
+ }
768
823
  }
769
824
  });
770
825
  } catch (Exception e) {
771
- Log.i(TAG, "SET USER IDENTIFIER ERROR : " + e);
826
+ Log.e(TAG, "SET USER IDENTIFIER ERROR : " + e);
772
827
  }
773
828
  }
774
829
 
@@ -23,7 +23,7 @@ int nvCheckPushClickTimeCounter = 0;
23
23
 
24
24
  @implementation RNNotifyvisitors
25
25
 
26
- static NSString *const kNVPluginVersion = @"4.6.2";
26
+ static NSString *const kNVPluginVersion = @"4.6.3";
27
27
 
28
28
  - (dispatch_queue_t)methodQueue{
29
29
  return dispatch_get_main_queue();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-notifyvisitors",
3
- "version": "4.6.2",
3
+ "version": "4.6.3",
4
4
  "description": "React Native Notifyvisitors SDK for push notifications and surveys",
5
5
  "main": "index",
6
6
  "scripts": {