react-native-gleapsdk 6.4.6 → 7.0.1
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.
- package/LICENSE +2 -20
- package/android/build.gradle +2 -3
- package/android/src/main/java/com/reactnativegleapsdk/GleapsdkModule.java +175 -78
- package/ios/Gleapsdk.m +68 -31
- package/ios/Gleapsdk.xcodeproj/project.xcworkspace/xcuserdata/lukasboehler.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/lib/commonjs/index.js +27 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/networklogger.js +43 -6
- package/lib/commonjs/networklogger.js.map +1 -1
- package/lib/module/index.js +27 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/networklogger.js +43 -6
- package/lib/module/networklogger.js.map +1 -1
- package/lib/typescript/index.d.ts +22 -7
- package/lib/typescript/networklogger.d.ts +6 -1
- package/package.json +1 -1
- package/react-native-gleapsdk.podspec +1 -1
- package/src/index.tsx +67 -32
- package/src/networklogger.ts +42 -10
package/LICENSE
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
Copyright (C) 2020 by Gleap GmbH. Permission is hereby granted to use this framework as is, modification are not allowed. All rights reserved.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
3
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. FURTHER RESELLING OF THE SDK OR IT'S CODE IS ONLY GRANTED WITH A WRITTEN PERMISSION BY GLEAP GMBH.
|
package/android/build.gradle
CHANGED
|
@@ -54,7 +54,6 @@ repositories {
|
|
|
54
54
|
|
|
55
55
|
dependencies {
|
|
56
56
|
//noinspection GradleDynamicVersion
|
|
57
|
-
implementation "com.facebook.react:react-native:+"
|
|
58
|
-
|
|
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.12'
|
|
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.
|
|
90
|
+
Gleap.initialize(sdkKey, activity.getApplication());
|
|
91
|
+
|
|
92
|
+
Gleap.getInstance().setWidgetOpenedCallback(new WidgetOpenedCallback() {
|
|
89
93
|
@Override
|
|
90
|
-
public void
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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().
|
|
150
|
+
Gleap.getInstance().setFeedbackFlowStartedCallback(new FeedbackFlowStartedCallback() {
|
|
126
151
|
@Override
|
|
127
|
-
public void
|
|
152
|
+
public void invoke(String message) {
|
|
128
153
|
getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
129
|
-
.emit("
|
|
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().
|
|
189
|
+
Gleap.getInstance().open();
|
|
187
190
|
Gleap.getInstance().setFeedbackSentCallback(new FeedbackSentCallback() {
|
|
188
191
|
@Override
|
|
189
|
-
public void
|
|
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
|
|
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
|
|
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().
|
|
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
|
|
320
|
+
public void sendSilentCrashReportWithExcludeData(
|
|
286
321
|
String description,
|
|
287
322
|
String priority,
|
|
288
|
-
|
|
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().
|
|
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
|
-
|
|
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().
|
|
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
|
-
*
|
|
504
|
+
* Frame url
|
|
505
|
+
* 330,.
|
|
394
506
|
*
|
|
395
|
-
* @param
|
|
507
|
+
* @param frameUrl Url to the dedicated server.
|
|
396
508
|
*/
|
|
397
509
|
@ReactMethod
|
|
398
|
-
public void
|
|
510
|
+
public void setFrameUrl(String frameUrl) {
|
|
399
511
|
try {
|
|
400
|
-
Gleap.getInstance().
|
|
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()
|
|
464
|
-
|
|
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,21 +59,23 @@ RCT_EXPORT_METHOD(initialize:(NSString *)token)
|
|
|
59
59
|
object:nil
|
|
60
60
|
queue:mainQueue
|
|
61
61
|
usingBlock:^(NSNotification *note) {
|
|
62
|
-
if ([
|
|
63
|
-
[Gleap
|
|
62
|
+
if ([Gleap isActivationMethodActive: SCREENSHOT]) {
|
|
63
|
+
[Gleap open];
|
|
64
64
|
}
|
|
65
65
|
}];
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
[
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
[
|
|
67
|
+
if ([Gleap getActivationMethods].count == 0) {
|
|
68
|
+
NSMutableArray *activationMethods = [[NSMutableArray alloc] init];
|
|
69
|
+
if ([config objectForKey: @"activationMethodShake"] != nil && [[config objectForKey: @"activationMethodShake"] boolValue] == YES) {
|
|
70
|
+
[activationMethods addObject: @(SHAKE)];
|
|
71
|
+
}
|
|
72
|
+
if ([config objectForKey: @"activationMethodScreenshotGesture"] != nil && [[config objectForKey: @"activationMethodScreenshotGesture"] boolValue] == YES) {
|
|
73
|
+
[activationMethods addObject: @(SCREENSHOT)];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[Gleap setActivationMethods: activationMethods];
|
|
73
77
|
}
|
|
74
78
|
|
|
75
|
-
[[Gleap sharedInstance] setActivationMethods: activationMethods];
|
|
76
|
-
|
|
77
79
|
if (_hasListeners) {
|
|
78
80
|
[self sendEventWithName:@"configLoaded" body: config];
|
|
79
81
|
}
|
|
@@ -81,20 +83,26 @@ RCT_EXPORT_METHOD(initialize:(NSString *)token)
|
|
|
81
83
|
|
|
82
84
|
- (void)motionEnded:(NSNotification *)notification
|
|
83
85
|
{
|
|
84
|
-
if ([
|
|
85
|
-
[Gleap
|
|
86
|
+
if ([Gleap isActivationMethodActive: SHAKE]) {
|
|
87
|
+
[Gleap open];
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
- (void)
|
|
91
|
+
- (void)feedbackSendingFailed {
|
|
90
92
|
if (_hasListeners) {
|
|
91
|
-
[self sendEventWithName:@"
|
|
93
|
+
[self sendEventWithName:@"feedbackSendingFailed" body:@{}];
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
- (void)
|
|
97
|
+
- (void)widgetOpened {
|
|
96
98
|
if (_hasListeners) {
|
|
97
|
-
[self sendEventWithName:@"
|
|
99
|
+
[self sendEventWithName:@"widgetOpened" body:@{}];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
- (void)widgetClosed {
|
|
104
|
+
if (_hasListeners) {
|
|
105
|
+
[self sendEventWithName:@"widgetClosed" body:@{}];
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
|
|
@@ -112,6 +120,12 @@ RCT_EXPORT_METHOD(initialize:(NSString *)token)
|
|
|
112
120
|
}
|
|
113
121
|
}
|
|
114
122
|
|
|
123
|
+
- (void)feedbackFlowStarted:(NSDictionary *)feedbackAction {
|
|
124
|
+
if (_hasListeners) {
|
|
125
|
+
[self sendEventWithName:@"feedbackFlowStarted" body: feedbackAction];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
115
129
|
- (void)startObserving
|
|
116
130
|
{
|
|
117
131
|
_hasListeners = YES;
|
|
@@ -123,45 +137,46 @@ RCT_EXPORT_METHOD(initialize:(NSString *)token)
|
|
|
123
137
|
}
|
|
124
138
|
|
|
125
139
|
- (NSArray<NSString *> *)supportedEvents {
|
|
126
|
-
return @[@"feedbackSent", @"
|
|
140
|
+
return @[@"feedbackSent", @"feedbackSendingFailed", @"configLoaded", @"customActionTriggered", @"feedbackFlowStarted", @"widgetOpened", @"widgetClosed"];
|
|
127
141
|
}
|
|
128
142
|
|
|
129
|
-
RCT_EXPORT_METHOD(
|
|
143
|
+
RCT_EXPORT_METHOD(sendSilentCrashReport:(NSString *)description andSeverity:(NSString *)severity)
|
|
130
144
|
{
|
|
131
145
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
132
146
|
GleapBugSeverity prio = MEDIUM;
|
|
133
|
-
if ([
|
|
147
|
+
if ([severity isEqualToString: @"LOW"]) {
|
|
134
148
|
prio = LOW;
|
|
135
149
|
}
|
|
136
|
-
if ([
|
|
150
|
+
if ([severity isEqualToString: @"HIGH"]) {
|
|
137
151
|
prio = HIGH;
|
|
138
152
|
}
|
|
139
|
-
|
|
153
|
+
|
|
154
|
+
[Gleap sendSilentCrashReportWith: description andSeverity: prio andDataExclusion: nil andCompletion:^(bool success) {}];
|
|
140
155
|
});
|
|
141
156
|
}
|
|
142
157
|
|
|
143
|
-
RCT_EXPORT_METHOD(
|
|
158
|
+
RCT_EXPORT_METHOD(sendSilentCrashReportWithExcludeData:(NSString *)description andSeverity:(NSString *)severity andExcludeData:(NSDictionary *)excludeData)
|
|
144
159
|
{
|
|
145
160
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
146
161
|
GleapBugSeverity prio = MEDIUM;
|
|
147
|
-
if ([
|
|
162
|
+
if ([severity isEqualToString: @"LOW"]) {
|
|
148
163
|
prio = LOW;
|
|
149
164
|
}
|
|
150
|
-
if ([
|
|
165
|
+
if ([severity isEqualToString: @"HIGH"]) {
|
|
151
166
|
prio = HIGH;
|
|
152
167
|
}
|
|
153
|
-
|
|
168
|
+
|
|
169
|
+
[Gleap sendSilentCrashReportWith: description andSeverity: prio andDataExclusion: excludeData andCompletion:^(bool success) {}];
|
|
154
170
|
});
|
|
155
171
|
}
|
|
156
172
|
|
|
157
173
|
RCT_EXPORT_METHOD(attachNetworkLog:(NSArray *)networkLogs)
|
|
158
174
|
{
|
|
159
175
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
160
|
-
[Gleap
|
|
176
|
+
[Gleap attachExternalData: @{ @"networkLogs": networkLogs }];
|
|
161
177
|
});
|
|
162
178
|
}
|
|
163
179
|
|
|
164
|
-
|
|
165
180
|
RCT_EXPORT_METHOD(setActivationMethods:(NSArray *)activationMethods)
|
|
166
181
|
{
|
|
167
182
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -179,10 +194,10 @@ RCT_EXPORT_METHOD(setActivationMethods:(NSArray *)activationMethods)
|
|
|
179
194
|
});
|
|
180
195
|
}
|
|
181
196
|
|
|
182
|
-
RCT_EXPORT_METHOD(startFeedbackFlow:(NSString *)feedbackFlow)
|
|
197
|
+
RCT_EXPORT_METHOD(startFeedbackFlow:(NSString *)feedbackFlow andShowBackButton:(BOOL)showBackButton)
|
|
183
198
|
{
|
|
184
199
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
185
|
-
[Gleap startFeedbackFlow: feedbackFlow];
|
|
200
|
+
[Gleap startFeedbackFlow: feedbackFlow showBackButton: showBackButton];
|
|
186
201
|
});
|
|
187
202
|
}
|
|
188
203
|
|
|
@@ -214,6 +229,21 @@ RCT_EXPORT_METHOD(clearIdentity)
|
|
|
214
229
|
});
|
|
215
230
|
}
|
|
216
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
|
+
|
|
217
247
|
RCT_EXPORT_METHOD(identify:(NSString *)userId withUserProperties: (NSDictionary *)userProperties)
|
|
218
248
|
{
|
|
219
249
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -229,6 +259,13 @@ RCT_EXPORT_METHOD(identify:(NSString *)userId withUserProperties: (NSDictionary
|
|
|
229
259
|
});
|
|
230
260
|
}
|
|
231
261
|
|
|
262
|
+
RCT_EXPORT_METHOD(preFillForm:(NSDictionary *)formData)
|
|
263
|
+
{
|
|
264
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
265
|
+
[Gleap preFillForm: formData];
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
232
269
|
RCT_EXPORT_METHOD(attachCustomData:(NSDictionary *)customData)
|
|
233
270
|
{
|
|
234
271
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -264,10 +301,10 @@ RCT_EXPORT_METHOD(setApiUrl: (NSString *)apiUrl)
|
|
|
264
301
|
});
|
|
265
302
|
}
|
|
266
303
|
|
|
267
|
-
RCT_EXPORT_METHOD(
|
|
304
|
+
RCT_EXPORT_METHOD(setFrameUrl: (NSString *)frameUrl)
|
|
268
305
|
{
|
|
269
306
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
270
|
-
[Gleap
|
|
307
|
+
[Gleap setFrameUrl: frameUrl];
|
|
271
308
|
});
|
|
272
309
|
}
|
|
273
310
|
|