react-native-gleapsdk 6.4.8 → 7.0.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.
@@ -54,7 +54,6 @@ repositories {
54
54
 
55
55
  dependencies {
56
56
  //noinspection GradleDynamicVersion
57
- implementation "com.facebook.react:react-native:+" // From node_modules
58
- // https://mvnrepository.com/artifact/io.gleap/gleap-android-sdk
59
- implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '6.4.12'
57
+ implementation "com.facebook.react:react-native:+"
58
+ implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '7.0.10'
60
59
  }
@@ -8,10 +8,8 @@ import androidx.annotation.NonNull;
8
8
  import androidx.annotation.RequiresApi;
9
9
 
10
10
  import com.facebook.react.ReactApplication;
11
- import com.facebook.react.ReactInstanceManager;
12
11
  import com.facebook.react.bridge.LifecycleEventListener;
13
12
  import com.facebook.react.bridge.ReactApplicationContext;
14
- import com.facebook.react.bridge.ReactContext;
15
13
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
16
14
  import com.facebook.react.bridge.ReactMethod;
17
15
  import com.facebook.react.bridge.ReadableArray;
@@ -33,16 +31,20 @@ import java.util.regex.Matcher;
33
31
  import java.util.regex.Pattern;
34
32
 
35
33
  import io.gleap.APPLICATIONTYPE;
36
- import io.gleap.ConfigLoadedCallback;
37
- import io.gleap.CustomActionCallback;
38
- import io.gleap.FeedbackSentCallback;
39
- import io.gleap.FeedbackSentWithDataCallback;
40
- import io.gleap.FeedbackWillBeSentCallback;
41
- import io.gleap.GetActivityCallback;
42
34
  import io.gleap.Gleap;
43
35
  import io.gleap.GleapActivationMethod;
44
36
  import io.gleap.GleapUserProperties;
37
+ import io.gleap.PrefillHelper;
45
38
  import io.gleap.RequestType;
39
+ import io.gleap.UserSessionController;
40
+ import io.gleap.callbacks.ConfigLoadedCallback;
41
+ import io.gleap.callbacks.CustomActionCallback;
42
+ import io.gleap.callbacks.FeedbackFlowStartedCallback;
43
+ import io.gleap.callbacks.FeedbackSendingFailedCallback;
44
+ import io.gleap.callbacks.FeedbackSentCallback;
45
+ import io.gleap.callbacks.GetActivityCallback;
46
+ import io.gleap.callbacks.WidgetClosedCallback;
47
+ import io.gleap.callbacks.WidgetOpenedCallback;
46
48
 
47
49
  @ReactModule(name = GleapsdkModule.NAME)
48
50
  public class GleapsdkModule extends ReactContextBaseJavaModule implements LifecycleEventListener {
@@ -85,17 +87,24 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
85
87
  .getCurrentActivity();
86
88
  if (activity != null && !invalidated) {
87
89
  Gleap.getInstance().setApplicationType(APPLICATIONTYPE.REACTNATIVE);
88
- Gleap.getInstance().setFeedbackWillBeSentCallback(new FeedbackWillBeSentCallback() {
90
+ Gleap.initialize(sdkKey, activity.getApplication());
91
+
92
+ Gleap.getInstance().setWidgetOpenedCallback(new WidgetOpenedCallback() {
89
93
  @Override
90
- public void flowInvoced() {
91
- if (!invalidated) {
92
- getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
93
- .emit("feedbackWillBeSent", null);
94
- }
94
+ public void invoke() {
95
+ getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
96
+ .emit("widgetOpened", null);
97
+ }
98
+ });
99
+
100
+ Gleap.getInstance().setWidgetClosedCallback(new WidgetClosedCallback() {
101
+ @Override
102
+ public void invoke() {
103
+ getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
104
+ .emit("widgetClosed", null);
95
105
  }
96
106
  });
97
107
 
98
- Gleap.initialize(sdkKey, activity.getApplication());
99
108
  Gleap.getInstance().setConfigLoadedCallback(new ConfigLoadedCallback() {
100
109
  @Override
101
110
  public void configLoaded(JSONObject jsonObject) {
@@ -106,6 +115,22 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
106
115
  }
107
116
  });
108
117
 
118
+ Gleap.getInstance().setFeedbackSentCallback(new FeedbackSentCallback() {
119
+ @Override
120
+ public void invoke(String message) {
121
+ getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
122
+ .emit("feedbackSent", message);
123
+ }
124
+ });
125
+
126
+ Gleap.getInstance().setFeedbackSendingFailedCallback(new FeedbackSendingFailedCallback() {
127
+ @Override
128
+ public void invoke(String message) {
129
+ getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
130
+ .emit("feedbackSendingFailed", message);
131
+ }
132
+ });
133
+
109
134
  Gleap.getInstance().registerCustomAction(new CustomActionCallback() {
110
135
  @Override
111
136
  public void invoke(String message) {
@@ -122,33 +147,11 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
122
147
  }
123
148
  });
124
149
 
125
- Gleap.getInstance().setFeedbackSentWithDataCallback(new FeedbackSentWithDataCallback() {
150
+ Gleap.getInstance().setFeedbackFlowStartedCallback(new FeedbackFlowStartedCallback() {
126
151
  @Override
127
- public void close(JSONObject jsonObject) {
152
+ public void invoke(String message) {
128
153
  getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
129
- .emit("feedbackSent", jsonObject.toString());
130
- new java.util.Timer().schedule(
131
- new java.util.TimerTask() {
132
- @Override
133
- public void run() {
134
- showDevMenu();
135
- }
136
- },
137
- 500);
138
- }
139
- });
140
-
141
- Gleap.getInstance().setFeedbackSentCallback(new FeedbackSentCallback() {
142
- @Override
143
- public void close() {
144
- new java.util.Timer().schedule(
145
- new java.util.TimerTask() {
146
- @Override
147
- public void run() {
148
- showDevMenu();
149
- }
150
- },
151
- 500);
154
+ .emit("feedbackFlowStarted", message);
152
155
  }
153
156
  });
154
157
  }
@@ -183,10 +186,10 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
183
186
  @Override
184
187
  public void run() {
185
188
  try {
186
- Gleap.getInstance().startFeedbackFlow();
189
+ Gleap.getInstance().open();
187
190
  Gleap.getInstance().setFeedbackSentCallback(new FeedbackSentCallback() {
188
191
  @Override
189
- public void close() {
192
+ public void invoke(String message) {
190
193
  new java.util.Timer().schedule(
191
194
  new java.util.TimerTask() {
192
195
  @Override
@@ -211,21 +214,53 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
211
214
  }
212
215
  }
213
216
 
217
+ @ReactMethod
218
+ public void close() {
219
+ try {
220
+ getActivitySafe().runOnUiThread(
221
+ new Runnable() {
222
+ @Override
223
+ public void run() {
224
+ try {
225
+ Gleap.getInstance().close();
226
+ }catch (Exception ex) {}
227
+ }
228
+ });
229
+ } catch (NoUiThreadException e) {
230
+ System.err.println(e.getMessage());
231
+ }
232
+ }
233
+
234
+ @ReactMethod
235
+ public void isOpened() {
236
+ try {
237
+ getActivitySafe().runOnUiThread(
238
+ new Runnable() {
239
+ @Override
240
+ public void run() {
241
+ Gleap.getInstance().isOpened();
242
+ }
243
+ });
244
+ } catch (NoUiThreadException e) {
245
+ System.err.println(e.getMessage());
246
+ }
247
+ }
248
+
214
249
  /**
215
250
  * Start bug report manually by calling this function.
216
251
  */
217
252
  @ReactMethod
218
- public void startFeedbackFlow(String feedbackFlow){
253
+ public void startFeedbackFlow(String feedbackFlow, boolean showBackButton) {
219
254
  try {
220
255
  getActivitySafe().runOnUiThread(
221
256
  new Runnable() {
222
257
  @Override
223
258
  public void run() {
224
259
  try {
225
- Gleap.getInstance().startFeedbackFlow(feedbackFlow);
260
+ Gleap.getInstance().startFeedbackFlow(feedbackFlow, showBackButton);
226
261
  Gleap.getInstance().setFeedbackSentCallback(new FeedbackSentCallback() {
227
262
  @Override
228
- public void close() {
263
+ public void invoke(String message) {
229
264
  new java.util.Timer().schedule(
230
265
  new java.util.TimerTask() {
231
266
  @Override
@@ -254,7 +289,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
254
289
  * Manually start a silent bug reporting workflow.
255
290
  */
256
291
  @ReactMethod
257
- public void sendSilentBugReport(
292
+ public void sendSilentCrashReport(
258
293
  String description,
259
294
  String priority) {
260
295
  try {
@@ -270,7 +305,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
270
305
  if (priority == "HIGH") {
271
306
  severity = Gleap.SEVERITY.HIGH;
272
307
  }
273
- Gleap.getInstance().sendSilentBugReport(description, severity);
308
+ Gleap.getInstance().sendSilentCrashReport(description, severity);
274
309
  }
275
310
  });
276
311
  } catch (NoUiThreadException e) {
@@ -282,15 +317,21 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
282
317
  * Manually start a silent bug reporting workflow.
283
318
  */
284
319
  @ReactMethod
285
- public void sendSilentBugReportWithType(
320
+ public void sendSilentCrashReportWithExcludeData(
286
321
  String description,
287
322
  String priority,
288
- String type) {
323
+ ReadableMap data) {
289
324
  try {
290
325
  getActivitySafe().runOnUiThread(
291
326
  new Runnable() {
292
327
  @Override
293
328
  public void run() {
329
+ JSONObject jsonObject = new JSONObject();
330
+ try {
331
+ jsonObject = GleapUtil.convertMapToJson(data);
332
+ } catch (Exception ex) {
333
+ }
334
+
294
335
  isSilentBugReport = true;
295
336
  Gleap.SEVERITY severity = Gleap.SEVERITY.LOW;
296
337
  if (priority == "MEDIUM") {
@@ -299,7 +340,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
299
340
  if (priority == "HIGH") {
300
341
  severity = Gleap.SEVERITY.HIGH;
301
342
  }
302
- Gleap.getInstance().sendSilentBugReport(description, severity, type);
343
+ Gleap.getInstance().sendSilentCrashReport(description, severity, jsonObject);
303
344
  }
304
345
  });
305
346
  } catch (NoUiThreadException e) {
@@ -307,6 +348,28 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
307
348
  }
308
349
  }
309
350
 
351
+ @ReactMethod
352
+ public void preFillForm(
353
+ ReadableMap data) {
354
+ try {
355
+ getActivitySafe().runOnUiThread(
356
+ new Runnable() {
357
+ @Override
358
+ public void run() {
359
+ JSONObject jsonObject = new JSONObject();
360
+ try {
361
+ jsonObject = GleapUtil.convertMapToJson(data);
362
+ } catch (Exception ex) {
363
+ }
364
+ PrefillHelper.getInstancen().setPrefillData(jsonObject);
365
+ }
366
+ });
367
+ } catch (NoUiThreadException e) {
368
+ System.err.println(e.getMessage());
369
+ }
370
+ }
371
+
372
+
310
373
  @ReactMethod
311
374
  public void setLanguage(String language) {
312
375
  Gleap.getInstance().setLanguage(language);
@@ -314,6 +377,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
314
377
 
315
378
  @ReactMethod
316
379
  public void enableDebugConsoleLog() {
380
+
317
381
  }
318
382
 
319
383
  @ReactMethod
@@ -338,7 +402,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
338
402
  e.printStackTrace();
339
403
  }
340
404
  GleapUserProperties gleapUserSession = new GleapUserProperties(name, email);
341
- if(Gleap.getInstance() == null) {
405
+ if (Gleap.getInstance() == null) {
342
406
  return;
343
407
  }
344
408
  Gleap.getInstance().identifyUser(userid, gleapUserSession);
@@ -349,9 +413,56 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
349
413
  }
350
414
  }
351
415
 
416
+ @ReactMethod
417
+ public void identifyWithUserHash(String userid, ReadableMap data, String hash) {
418
+ try {
419
+ getActivitySafe().runOnUiThread(
420
+ new Runnable() {
421
+ @Override
422
+ public void run() {
423
+ JSONObject jsonObject = null;
424
+ String name = "";
425
+ String email = "";
426
+ try {
427
+ jsonObject = GleapUtil.convertMapToJson(data);
428
+ if (jsonObject.has("name")) {
429
+ name = jsonObject.getString("name");
430
+ }
431
+ if (jsonObject.has("email")) {
432
+ email = jsonObject.getString("email");
433
+ }
434
+ } catch (JSONException e) {
435
+ e.printStackTrace();
436
+ }
437
+ GleapUserProperties gleapUserSession = new GleapUserProperties(name, email);
438
+ gleapUserSession.setHash(hash);
439
+ if (Gleap.getInstance() == null) {
440
+ return;
441
+ }
442
+
443
+ if (UserSessionController.getInstance() != null) {
444
+ Gleap.getInstance().identifyUser(userid, gleapUserSession);
445
+ }
446
+ }
447
+ });
448
+ } catch (NoUiThreadException e) {
449
+ System.err.println(e.getMessage());
450
+ }
451
+ }
452
+
352
453
  @ReactMethod
353
454
  public void clearIdentity() {
354
- Gleap.getInstance().clearIdentity();
455
+ try {
456
+ getActivitySafe().runOnUiThread(
457
+ new Runnable() {
458
+ @Override
459
+ public void run() {
460
+ Gleap.getInstance().clearIdentity();
461
+ }
462
+ });
463
+ } catch (NoUiThreadException e) {
464
+ System.err.println(e.getMessage());
465
+ }
355
466
  }
356
467
 
357
468
  /**
@@ -365,10 +476,10 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
365
476
  public void attachCustomData(ReadableMap customData) {
366
477
  try {
367
478
  JSONObject jsonObject = GleapUtil.convertMapToJson(customData);
368
- if(Gleap.getInstance() == null) {
479
+ if (Gleap.getInstance() == null) {
369
480
  return;
370
481
  }
371
- Gleap.getInstance().appendCustomData(jsonObject);
482
+ Gleap.getInstance().attachCustomData(jsonObject);
372
483
  } catch (Exception e) {
373
484
  System.out.println(e);
374
485
  }
@@ -390,31 +501,15 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
390
501
  }
391
502
 
392
503
  /**
393
- * Used for dedicated server. Set the url, where the widget is loaded from.
504
+ * Frame url
505
+ * 330,.
394
506
  *
395
- * @param widgetUrl Url to the dedicated server.
507
+ * @param frameUrl Url to the dedicated server.
396
508
  */
397
509
  @ReactMethod
398
- public void setWidgetUrl(String widgetUrl) {
510
+ public void setFrameUrl(String frameUrl) {
399
511
  try {
400
- Gleap.getInstance().setApiUrl(widgetUrl);
401
- } catch (Exception e) {
402
- System.out.println(e);
403
- }
404
- }
405
-
406
- /**
407
- * Attaches custom data, which can be viewed in the Gleap dashboard. New data
408
- * will be merged with existing custom data.
409
- *
410
- * @param customData The data to attach to a bug report.
411
- * @author Gleap
412
- */
413
- @ReactMethod
414
- public void appendCustomData(ReadableMap customData) {
415
- try {
416
- JSONObject jsonObject = GleapUtil.convertMapToJson(customData);
417
- Gleap.getInstance().appendCustomData(jsonObject);
512
+ Gleap.getInstance().setFrameUrl(frameUrl);
418
513
  } catch (Exception e) {
419
514
  System.out.println(e);
420
515
  }
@@ -460,8 +555,10 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
460
555
  internalActivationMethods.add(GleapActivationMethod.SCREENSHOT);
461
556
  }
462
557
  }
463
- Gleap.getInstance().setActivationMethods(
464
- internalActivationMethods.toArray(new GleapActivationMethod[internalActivationMethods.size()]));
558
+ if(Gleap.getInstance() != null) {
559
+ Gleap.getInstance().setActivationMethods(
560
+ internalActivationMethods.toArray(new GleapActivationMethod[internalActivationMethods.size()]));
561
+ }
465
562
  }
466
563
 
467
564
  /**
@@ -682,7 +779,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
682
779
 
683
780
  private Activity getActivitySafe() throws NoUiThreadException {
684
781
  Activity activity = getCurrentActivity();
685
- if(activity == null) {
782
+ if (activity == null) {
686
783
  throw new NoUiThreadException();
687
784
  }
688
785
  return activity;
package/ios/Gleapsdk.m CHANGED
@@ -59,12 +59,12 @@ RCT_EXPORT_METHOD(initialize:(NSString *)token)
59
59
  object:nil
60
60
  queue:mainQueue
61
61
  usingBlock:^(NSNotification *note) {
62
- if ([[Gleap sharedInstance] isActivationMethodActive: SCREENSHOT]) {
63
- [Gleap startFeedbackFlow];
62
+ if ([Gleap isActivationMethodActive: SCREENSHOT]) {
63
+ [Gleap open];
64
64
  }
65
65
  }];
66
66
 
67
- if ([Gleap sharedInstance].activationMethods.count == 0) {
67
+ if ([Gleap getActivationMethods].count == 0) {
68
68
  NSMutableArray *activationMethods = [[NSMutableArray alloc] init];
69
69
  if ([config objectForKey: @"activationMethodShake"] != nil && [[config objectForKey: @"activationMethodShake"] boolValue] == YES) {
70
70
  [activationMethods addObject: @(SHAKE)];
@@ -73,7 +73,7 @@ RCT_EXPORT_METHOD(initialize:(NSString *)token)
73
73
  [activationMethods addObject: @(SCREENSHOT)];
74
74
  }
75
75
 
76
- [[Gleap sharedInstance] setActivationMethods: activationMethods];
76
+ [Gleap setActivationMethods: activationMethods];
77
77
  }
78
78
 
79
79
  if (_hasListeners) {
@@ -83,20 +83,26 @@ RCT_EXPORT_METHOD(initialize:(NSString *)token)
83
83
 
84
84
  - (void)motionEnded:(NSNotification *)notification
85
85
  {
86
- if ([[Gleap sharedInstance] isActivationMethodActive: SHAKE]) {
87
- [Gleap startFeedbackFlow];
86
+ if ([Gleap isActivationMethodActive: SHAKE]) {
87
+ [Gleap open];
88
88
  }
89
89
  }
90
90
 
91
- - (void)feedbackWillBeSent {
91
+ - (void)feedbackSendingFailed {
92
92
  if (_hasListeners) {
93
- [self sendEventWithName:@"feedbackWillBeSent" body:@{}];
93
+ [self sendEventWithName:@"feedbackSendingFailed" body:@{}];
94
94
  }
95
95
  }
96
96
 
97
- - (void)feedbackSendingFailed {
97
+ - (void)widgetOpened {
98
98
  if (_hasListeners) {
99
- [self sendEventWithName:@"feedbackSendingFailed" body:@{}];
99
+ [self sendEventWithName:@"widgetOpened" body:@{}];
100
+ }
101
+ }
102
+
103
+ - (void)widgetClosed {
104
+ if (_hasListeners) {
105
+ [self sendEventWithName:@"widgetClosed" body:@{}];
100
106
  }
101
107
  }
102
108
 
@@ -114,6 +120,12 @@ RCT_EXPORT_METHOD(initialize:(NSString *)token)
114
120
  }
115
121
  }
116
122
 
123
+ - (void)feedbackFlowStarted:(NSDictionary *)feedbackAction {
124
+ if (_hasListeners) {
125
+ [self sendEventWithName:@"feedbackFlowStarted" body: feedbackAction];
126
+ }
127
+ }
128
+
117
129
  - (void)startObserving
118
130
  {
119
131
  _hasListeners = YES;
@@ -125,45 +137,46 @@ RCT_EXPORT_METHOD(initialize:(NSString *)token)
125
137
  }
126
138
 
127
139
  - (NSArray<NSString *> *)supportedEvents {
128
- return @[@"feedbackSent", @"feedbackWillBeSent", @"feedbackSendingFailed", @"configLoaded", @"customActionTriggered"];
140
+ return @[@"feedbackSent", @"feedbackSendingFailed", @"configLoaded", @"customActionTriggered", @"feedbackFlowStarted", @"widgetOpened", @"widgetClosed"];
129
141
  }
130
142
 
131
- RCT_EXPORT_METHOD(sendSilentBugReport:(NSString *)description andSeverity:(NSString *)priority)
143
+ RCT_EXPORT_METHOD(sendSilentCrashReport:(NSString *)description andSeverity:(NSString *)severity)
132
144
  {
133
145
  dispatch_async(dispatch_get_main_queue(), ^{
134
146
  GleapBugSeverity prio = MEDIUM;
135
- if ([priority isEqualToString: @"LOW"]) {
147
+ if ([severity isEqualToString: @"LOW"]) {
136
148
  prio = LOW;
137
149
  }
138
- if ([priority isEqualToString: @"HIGH"]) {
150
+ if ([severity isEqualToString: @"HIGH"]) {
139
151
  prio = HIGH;
140
152
  }
141
- [Gleap sendSilentBugReportWith: description andSeverity: prio];
153
+
154
+ [Gleap sendSilentCrashReportWith: description andSeverity: prio andDataExclusion: nil andCompletion:^(bool success) {}];
142
155
  });
143
156
  }
144
157
 
145
- RCT_EXPORT_METHOD(sendSilentBugReportWithType:(NSString *)description andSeverity:(NSString *)priority andType:(NSString *)type)
158
+ RCT_EXPORT_METHOD(sendSilentCrashReportWithExcludeData:(NSString *)description andSeverity:(NSString *)severity andExcludeData:(NSDictionary *)excludeData)
146
159
  {
147
160
  dispatch_async(dispatch_get_main_queue(), ^{
148
161
  GleapBugSeverity prio = MEDIUM;
149
- if ([priority isEqualToString: @"LOW"]) {
162
+ if ([severity isEqualToString: @"LOW"]) {
150
163
  prio = LOW;
151
164
  }
152
- if ([priority isEqualToString: @"HIGH"]) {
165
+ if ([severity isEqualToString: @"HIGH"]) {
153
166
  prio = HIGH;
154
167
  }
155
- [Gleap sendSilentBugReportWith: description andSeverity: prio andType: type];
168
+
169
+ [Gleap sendSilentCrashReportWith: description andSeverity: prio andDataExclusion: excludeData andCompletion:^(bool success) {}];
156
170
  });
157
171
  }
158
172
 
159
173
  RCT_EXPORT_METHOD(attachNetworkLog:(NSArray *)networkLogs)
160
174
  {
161
175
  dispatch_async(dispatch_get_main_queue(), ^{
162
- [Gleap attachData: @{ @"networkLogs": networkLogs }];
176
+ [Gleap attachExternalData: @{ @"networkLogs": networkLogs }];
163
177
  });
164
178
  }
165
179
 
166
-
167
180
  RCT_EXPORT_METHOD(setActivationMethods:(NSArray *)activationMethods)
168
181
  {
169
182
  dispatch_async(dispatch_get_main_queue(), ^{
@@ -181,10 +194,10 @@ RCT_EXPORT_METHOD(setActivationMethods:(NSArray *)activationMethods)
181
194
  });
182
195
  }
183
196
 
184
- RCT_EXPORT_METHOD(startFeedbackFlow:(NSString *)feedbackFlow)
197
+ RCT_EXPORT_METHOD(startFeedbackFlow:(NSString *)feedbackFlow andShowBackButton:(BOOL)showBackButton)
185
198
  {
186
199
  dispatch_async(dispatch_get_main_queue(), ^{
187
- [Gleap startFeedbackFlow: feedbackFlow];
200
+ [Gleap startFeedbackFlow: feedbackFlow showBackButton: showBackButton];
188
201
  });
189
202
  }
190
203
 
@@ -216,6 +229,21 @@ RCT_EXPORT_METHOD(clearIdentity)
216
229
  });
217
230
  }
218
231
 
232
+ RCT_EXPORT_METHOD(identifyWithUserHash:(NSString *)userId withUserProperties: (NSDictionary *)userProperties andUserHash:(NSString *)userHash)
233
+ {
234
+ dispatch_async(dispatch_get_main_queue(), ^{
235
+ GleapUserProperty *userProperty = [[GleapUserProperty alloc] init];
236
+ if (userProperties != nil && [userProperties objectForKey: @"name"] != nil) {
237
+ userProperty.name = [userProperties objectForKey: @"name"];
238
+ }
239
+ if (userProperties != nil && [userProperties objectForKey: @"email"] != nil) {
240
+ userProperty.email = [userProperties objectForKey: @"email"];
241
+ }
242
+
243
+ [Gleap identifyUserWith: userId andData: userProperty andUserHash: userHash];
244
+ });
245
+ }
246
+
219
247
  RCT_EXPORT_METHOD(identify:(NSString *)userId withUserProperties: (NSDictionary *)userProperties)
220
248
  {
221
249
  dispatch_async(dispatch_get_main_queue(), ^{
@@ -231,6 +259,13 @@ RCT_EXPORT_METHOD(identify:(NSString *)userId withUserProperties: (NSDictionary
231
259
  });
232
260
  }
233
261
 
262
+ RCT_EXPORT_METHOD(preFillForm:(NSDictionary *)formData)
263
+ {
264
+ dispatch_async(dispatch_get_main_queue(), ^{
265
+ [Gleap preFillForm: formData];
266
+ });
267
+ }
268
+
234
269
  RCT_EXPORT_METHOD(attachCustomData:(NSDictionary *)customData)
235
270
  {
236
271
  dispatch_async(dispatch_get_main_queue(), ^{
@@ -266,10 +301,10 @@ RCT_EXPORT_METHOD(setApiUrl: (NSString *)apiUrl)
266
301
  });
267
302
  }
268
303
 
269
- RCT_EXPORT_METHOD(setWidgetUrl: (NSString *)apiUrl)
304
+ RCT_EXPORT_METHOD(setFrameUrl: (NSString *)frameUrl)
270
305
  {
271
306
  dispatch_async(dispatch_get_main_queue(), ^{
272
- [Gleap setWidgetUrl: apiUrl];
307
+ [Gleap setFrameUrl: frameUrl];
273
308
  });
274
309
  }
275
310
 
@@ -23,9 +23,26 @@ const GleapSdk = _reactNative.NativeModules.Gleapsdk ? _reactNative.NativeModule
23
23
  });
24
24
 
25
25
  if (GleapSdk && !GleapSdk.touched) {
26
- const networkLogger = new _networklogger.default();
26
+ const networkLogger = new _networklogger.default(); // Push the network log to the native SDK.
27
27
 
28
28
  GleapSdk.startNetworkLogging = () => {
29
+ // Set the callback.
30
+ networkLogger.setUpdatedCallback(() => {
31
+ if (!networkLogger) {
32
+ return;
33
+ }
34
+
35
+ const requests = networkLogger.getRequests();
36
+
37
+ if (requests && GleapSdk && typeof GleapSdk.attachNetworkLog !== 'undefined') {
38
+ if (_reactNative.Platform.OS === 'android') {
39
+ GleapSdk.attachNetworkLog(JSON.stringify(requests));
40
+ } else {
41
+ GleapSdk.attachNetworkLog(JSON.parse(JSON.stringify(requests)));
42
+ }
43
+ }
44
+ }); // Start the logger.
45
+
29
46
  networkLogger.start();
30
47
  };
31
48
 
@@ -69,27 +86,24 @@ if (GleapSdk && !GleapSdk.touched) {
69
86
  notifyCallback('configLoaded', configJSON);
70
87
  } catch (exp) {}
71
88
  });
72
- gleapEmitter.addListener('feedbackWillBeSent', () => {
73
- // Push the network log to the native SDK.
74
- const requests = networkLogger.getRequests();
75
-
76
- if (_reactNative.Platform.OS === 'android') {
77
- GleapSdk.attachNetworkLog(JSON.stringify(requests));
78
- } else {
79
- GleapSdk.attachNetworkLog(JSON.parse(JSON.stringify(requests)));
80
- }
81
-
82
- notifyCallback('feedbackWillBeSent');
83
- });
84
89
  gleapEmitter.addListener('feedbackSent', data => {
85
90
  try {
86
91
  const dataJSON = data instanceof Object ? data : JSON.parse(data);
87
92
  notifyCallback('feedbackSent', dataJSON);
88
93
  } catch (exp) {}
89
94
  });
95
+ gleapEmitter.addListener('feedbackFlowStarted', feedbackAction => {
96
+ notifyCallback('feedbackFlowStarted', feedbackAction);
97
+ });
90
98
  gleapEmitter.addListener('feedbackSendingFailed', () => {
91
99
  notifyCallback('feedbackSendingFailed');
92
100
  });
101
+ gleapEmitter.addListener('widgetOpened', () => {
102
+ notifyCallback('widgetOpened');
103
+ });
104
+ gleapEmitter.addListener('widgetClosed', () => {
105
+ notifyCallback('widgetClosed');
106
+ });
93
107
 
94
108
  function isJsonString(str) {
95
109
  try {