react-native-notifyvisitors 4.6.2 → 4.7.0
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=/
|
|
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
|
package/android/build.gradle
CHANGED
|
@@ -35,7 +35,7 @@ android {
|
|
|
35
35
|
dependencies {
|
|
36
36
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
37
37
|
implementation 'com.facebook.react:react-native:+'
|
|
38
|
-
implementation('com.notifyvisitors.notifyvisitors:notifyvisitors:v5.
|
|
38
|
+
implementation('com.notifyvisitors.notifyvisitors:notifyvisitors:v5.7.2')
|
|
39
39
|
implementation("com.notifyvisitors.nudges:notifyvisitors-nudges:v0.0.8")
|
|
40
40
|
implementation platform('com.google.firebase:firebase-bom:33.16.0')
|
|
41
41
|
implementation ('com.google.firebase:firebase-messaging')
|
|
@@ -50,7 +50,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
|
|
|
50
50
|
|
|
51
51
|
private final ReactApplicationContext reactContext;
|
|
52
52
|
private static final String TAG = "RN-NotifyVisitors";
|
|
53
|
-
private static final String PLUGIN_VERSION = "4.
|
|
53
|
+
private static final String PLUGIN_VERSION = "4.7.0";
|
|
54
54
|
|
|
55
55
|
private String PUSH_BANNER_CLICK_EVENT = "nv_push_banner_click";
|
|
56
56
|
private String CHAT_BOT_BUTTON_CLICK = "nv_chat_bot_button_click";
|
|
@@ -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
|
-
|
|
764
|
-
|
|
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
|
-
|
|
767
|
-
}
|
|
821
|
+
Log.e(TAG, "❌ ReactContext is null, cannot invoke callback");
|
|
822
|
+
}
|
|
768
823
|
}
|
|
769
824
|
});
|
|
770
825
|
} catch (Exception e) {
|
|
771
|
-
Log.
|
|
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.
|
|
26
|
+
static NSString *const kNVPluginVersion = @"4.7.0";
|
|
27
27
|
|
|
28
28
|
- (dispatch_queue_t)methodQueue{
|
|
29
29
|
return dispatch_get_main_queue();
|