react-native-userleap 2.18.6 → 2.18.8

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.
@@ -75,6 +75,6 @@ dependencies {
75
75
  if (findProject(':userleap-android-sdk') != null) {
76
76
  implementation project(':userleap-android-sdk')
77
77
  } else {
78
- implementation ("com.userleap:userleap-android-sdk:2.18.4") // update this version on android updates
78
+ implementation ("com.userleap:userleap-android-sdk:2.19.3") // update this version on android updates
79
79
  }
80
80
  }
@@ -25,6 +25,17 @@ import javax.annotation.Nullable;
25
25
  import kotlin.Unit;
26
26
  import kotlin.jvm.functions.Function1;
27
27
 
28
+ import android.util.Log;
29
+
30
+ import com.userleap.EventListener;
31
+ import com.userleap.EventName;
32
+ import com.userleap.SprigEvent;
33
+ import com.userleap.SprigLoggingLevel;
34
+ import com.userleap.UserLeap;
35
+
36
+ import kotlin.Unit;
37
+ import kotlin.jvm.functions.Function1;
38
+
28
39
  public class UserLeapModule extends ReactContextBaseJavaModule {
29
40
 
30
41
  private final ReactApplicationContext reactContext;
@@ -58,15 +69,37 @@ public class UserLeapModule extends ReactContextBaseJavaModule {
58
69
 
59
70
  @ReactMethod
60
71
  public void configure(String environment, ReadableMap configuration) {
61
- UserLeap.INSTANCE.configure(reactContext, environment, stringifyMap(configuration), getFragmentActivity());
62
- }
63
72
 
64
- @ReactMethod
65
- public void presentSurvey() {
66
- FragmentActivity fragmentActivity = getFragmentActivity();
67
- if (fragmentActivity != null) {
68
- UserLeap.INSTANCE.presentSurvey(fragmentActivity);
69
- }
73
+ UserLeap.INSTANCE.addEventListener(EventName.LOGGING_EVENT, new EventListener() {
74
+ @Override
75
+ public void onEvent(SprigEvent event) {
76
+
77
+ String tag = "SprigLoggingEvent";
78
+
79
+ switch (event.getLogLevel()) {
80
+ case INFO:
81
+ Log.i(tag, event.getLogMessage());
82
+ break;
83
+ case DEBUG:
84
+ Log.d(tag, event.getLogMessage());
85
+ break;
86
+ case WARNING:
87
+ Log.w(tag, event.getLogMessage());
88
+ break;
89
+ case ERROR:
90
+ case CRITICAL:
91
+ Log.e(tag, event.getLogMessage());
92
+ break;
93
+ }
94
+ }
95
+ });
96
+
97
+ UserLeap.INSTANCE.configure(
98
+ reactContext,
99
+ environment,
100
+ stringifyMap(configuration),
101
+ getFragmentActivity()
102
+ );
70
103
  }
71
104
 
72
105
  @ReactMethod
@@ -161,6 +194,11 @@ public class UserLeapModule extends ReactContextBaseJavaModule {
161
194
  UserLeap.INSTANCE.trackAndPresent(event, userId, partnerAnonymousId, getFragmentActivity());
162
195
  }
163
196
 
197
+ @ReactMethod
198
+ public void presentSurvey() {
199
+ UserLeap.INSTANCE.presentSurvey(null);
200
+ }
201
+
164
202
  private @Nullable
165
203
  FragmentActivity getFragmentActivity() {
166
204
  Activity activity = getCurrentActivity();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-userleap",
3
- "version": "2.18.6",
3
+ "version": "2.18.8",
4
4
  "description": "React Native module for UserLeap",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -19,5 +19,5 @@ Pod::Spec.new do |s|
19
19
  s.requires_arc = true
20
20
 
21
21
  s.dependency "React"
22
- s.dependency "UserLeapKit", "4.24.7"
22
+ s.dependency "UserLeapKit", "4.25.1"
23
23
  end