react-native-gleapsdk 6.4.5-beta.1 → 6.4.6
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/android/build.gradle
CHANGED
|
@@ -56,5 +56,5 @@ dependencies {
|
|
|
56
56
|
//noinspection GradleDynamicVersion
|
|
57
57
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
58
58
|
// https://mvnrepository.com/artifact/io.gleap/gleap-android-sdk
|
|
59
|
-
implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '6.4.
|
|
59
|
+
implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '6.4.12'
|
|
60
60
|
}
|
|
@@ -8,8 +8,10 @@ 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;
|
|
11
12
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
12
13
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
14
|
+
import com.facebook.react.bridge.ReactContext;
|
|
13
15
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
14
16
|
import com.facebook.react.bridge.ReactMethod;
|
|
15
17
|
import com.facebook.react.bridge.ReadableArray;
|
|
@@ -26,6 +28,7 @@ import java.io.FileOutputStream;
|
|
|
26
28
|
import java.io.OutputStream;
|
|
27
29
|
import java.util.ArrayList;
|
|
28
30
|
import java.util.Base64;
|
|
31
|
+
import java.util.logging.Logger;
|
|
29
32
|
import java.util.regex.Matcher;
|
|
30
33
|
import java.util.regex.Pattern;
|
|
31
34
|
|
|
@@ -47,16 +50,18 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
47
50
|
private boolean isSilentBugReport = false;
|
|
48
51
|
private boolean invalidated = false;
|
|
49
52
|
|
|
50
|
-
public GleapsdkModule(ReactApplicationContext
|
|
51
|
-
super(
|
|
53
|
+
public GleapsdkModule(ReactApplicationContext context) {
|
|
54
|
+
super(context);
|
|
52
55
|
Gleap.getInstance().setGetActivityCallback(new GetActivityCallback() {
|
|
53
56
|
@Override
|
|
54
57
|
public Activity getActivity() {
|
|
55
|
-
return
|
|
58
|
+
return context.getCurrentActivity();
|
|
56
59
|
}
|
|
57
60
|
});
|
|
61
|
+
|
|
58
62
|
}
|
|
59
63
|
|
|
64
|
+
|
|
60
65
|
@Override
|
|
61
66
|
@NonNull
|
|
62
67
|
public String getName() {
|
|
@@ -70,13 +75,14 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
70
75
|
*/
|
|
71
76
|
@ReactMethod
|
|
72
77
|
public void initialize(String sdkKey) {
|
|
73
|
-
|
|
78
|
+
try {
|
|
79
|
+
getActivitySafe().runOnUiThread(
|
|
74
80
|
new Runnable() {
|
|
75
81
|
@Override
|
|
76
82
|
public void run() {
|
|
77
83
|
try {
|
|
78
84
|
Activity activity = getReactApplicationContext()
|
|
79
|
-
|
|
85
|
+
.getCurrentActivity();
|
|
80
86
|
if (activity != null && !invalidated) {
|
|
81
87
|
Gleap.getInstance().setApplicationType(APPLICATIONTYPE.REACTNATIVE);
|
|
82
88
|
Gleap.getInstance().setFeedbackWillBeSentCallback(new FeedbackWillBeSentCallback() {
|
|
@@ -84,7 +90,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
84
90
|
public void flowInvoced() {
|
|
85
91
|
if (!invalidated) {
|
|
86
92
|
getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
87
|
-
|
|
93
|
+
.emit("feedbackWillBeSent", null);
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
96
|
});
|
|
@@ -95,7 +101,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
95
101
|
public void configLoaded(JSONObject jsonObject) {
|
|
96
102
|
if (!invalidated) {
|
|
97
103
|
getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
98
|
-
|
|
104
|
+
.emit("configLoaded", jsonObject.toString());
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
});
|
|
@@ -111,7 +117,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
111
117
|
}
|
|
112
118
|
if (!invalidated) {
|
|
113
119
|
getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
114
|
-
|
|
120
|
+
.emit("customActionTriggered", obj.toString());
|
|
115
121
|
}
|
|
116
122
|
}
|
|
117
123
|
});
|
|
@@ -120,15 +126,15 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
120
126
|
@Override
|
|
121
127
|
public void close(JSONObject jsonObject) {
|
|
122
128
|
getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
123
|
-
|
|
129
|
+
.emit("feedbackSent", jsonObject.toString());
|
|
124
130
|
new java.util.Timer().schedule(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
new java.util.TimerTask() {
|
|
132
|
+
@Override
|
|
133
|
+
public void run() {
|
|
134
|
+
showDevMenu();
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
500);
|
|
132
138
|
}
|
|
133
139
|
});
|
|
134
140
|
|
|
@@ -136,13 +142,13 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
136
142
|
@Override
|
|
137
143
|
public void close() {
|
|
138
144
|
new java.util.Timer().schedule(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
new java.util.TimerTask() {
|
|
146
|
+
@Override
|
|
147
|
+
public void run() {
|
|
148
|
+
showDevMenu();
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
500);
|
|
146
152
|
}
|
|
147
153
|
});
|
|
148
154
|
}
|
|
@@ -151,6 +157,9 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
151
157
|
}
|
|
152
158
|
}
|
|
153
159
|
});
|
|
160
|
+
} catch (NoUiThreadException e) {
|
|
161
|
+
System.err.println(e.getMessage());
|
|
162
|
+
}
|
|
154
163
|
}
|
|
155
164
|
|
|
156
165
|
@ReactMethod
|
|
@@ -168,7 +177,8 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
168
177
|
*/
|
|
169
178
|
@ReactMethod
|
|
170
179
|
public void open() {
|
|
171
|
-
|
|
180
|
+
try {
|
|
181
|
+
getActivitySafe().runOnUiThread(
|
|
172
182
|
new Runnable() {
|
|
173
183
|
@Override
|
|
174
184
|
public void run() {
|
|
@@ -178,17 +188,17 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
178
188
|
@Override
|
|
179
189
|
public void close() {
|
|
180
190
|
new java.util.Timer().schedule(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
191
|
+
new java.util.TimerTask() {
|
|
192
|
+
@Override
|
|
193
|
+
public void run() {
|
|
194
|
+
if (!isSilentBugReport) {
|
|
195
|
+
showDevMenu();
|
|
196
|
+
} else {
|
|
197
|
+
isSilentBugReport = false;
|
|
189
198
|
}
|
|
190
|
-
}
|
|
191
|
-
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
500);
|
|
192
202
|
}
|
|
193
203
|
});
|
|
194
204
|
} catch (Exception e) {
|
|
@@ -196,14 +206,18 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
196
206
|
}
|
|
197
207
|
}
|
|
198
208
|
});
|
|
209
|
+
} catch (NoUiThreadException e) {
|
|
210
|
+
System.err.println(e.getMessage());
|
|
211
|
+
}
|
|
199
212
|
}
|
|
200
213
|
|
|
201
214
|
/**
|
|
202
215
|
* Start bug report manually by calling this function.
|
|
203
216
|
*/
|
|
204
217
|
@ReactMethod
|
|
205
|
-
public void startFeedbackFlow(String feedbackFlow)
|
|
206
|
-
|
|
218
|
+
public void startFeedbackFlow(String feedbackFlow){
|
|
219
|
+
try {
|
|
220
|
+
getActivitySafe().runOnUiThread(
|
|
207
221
|
new Runnable() {
|
|
208
222
|
@Override
|
|
209
223
|
public void run() {
|
|
@@ -213,17 +227,17 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
213
227
|
@Override
|
|
214
228
|
public void close() {
|
|
215
229
|
new java.util.Timer().schedule(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
230
|
+
new java.util.TimerTask() {
|
|
231
|
+
@Override
|
|
232
|
+
public void run() {
|
|
233
|
+
if (!isSilentBugReport) {
|
|
234
|
+
showDevMenu();
|
|
235
|
+
} else {
|
|
236
|
+
isSilentBugReport = false;
|
|
224
237
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
500);
|
|
227
241
|
}
|
|
228
242
|
});
|
|
229
243
|
} catch (Exception e) {
|
|
@@ -231,6 +245,9 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
231
245
|
}
|
|
232
246
|
}
|
|
233
247
|
});
|
|
248
|
+
} catch (NoUiThreadException e) {
|
|
249
|
+
System.err.println(e.getMessage());
|
|
250
|
+
}
|
|
234
251
|
}
|
|
235
252
|
|
|
236
253
|
/**
|
|
@@ -238,9 +255,10 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
238
255
|
*/
|
|
239
256
|
@ReactMethod
|
|
240
257
|
public void sendSilentBugReport(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
258
|
+
String description,
|
|
259
|
+
String priority) {
|
|
260
|
+
try {
|
|
261
|
+
getActivitySafe().runOnUiThread(
|
|
244
262
|
new Runnable() {
|
|
245
263
|
@Override
|
|
246
264
|
public void run() {
|
|
@@ -255,6 +273,9 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
255
273
|
Gleap.getInstance().sendSilentBugReport(description, severity);
|
|
256
274
|
}
|
|
257
275
|
});
|
|
276
|
+
} catch (NoUiThreadException e) {
|
|
277
|
+
System.err.println(e.getMessage());
|
|
278
|
+
}
|
|
258
279
|
}
|
|
259
280
|
|
|
260
281
|
/**
|
|
@@ -262,10 +283,11 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
262
283
|
*/
|
|
263
284
|
@ReactMethod
|
|
264
285
|
public void sendSilentBugReportWithType(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
286
|
+
String description,
|
|
287
|
+
String priority,
|
|
288
|
+
String type) {
|
|
289
|
+
try {
|
|
290
|
+
getActivitySafe().runOnUiThread(
|
|
269
291
|
new Runnable() {
|
|
270
292
|
@Override
|
|
271
293
|
public void run() {
|
|
@@ -280,6 +302,9 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
280
302
|
Gleap.getInstance().sendSilentBugReport(description, severity, type);
|
|
281
303
|
}
|
|
282
304
|
});
|
|
305
|
+
} catch (NoUiThreadException e) {
|
|
306
|
+
System.err.println(e.getMessage());
|
|
307
|
+
}
|
|
283
308
|
}
|
|
284
309
|
|
|
285
310
|
@ReactMethod
|
|
@@ -293,7 +318,8 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
293
318
|
|
|
294
319
|
@ReactMethod
|
|
295
320
|
public void identify(String userid, ReadableMap data) {
|
|
296
|
-
|
|
321
|
+
try {
|
|
322
|
+
getActivitySafe().runOnUiThread(
|
|
297
323
|
new Runnable() {
|
|
298
324
|
@Override
|
|
299
325
|
public void run() {
|
|
@@ -312,9 +338,15 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
312
338
|
e.printStackTrace();
|
|
313
339
|
}
|
|
314
340
|
GleapUserProperties gleapUserSession = new GleapUserProperties(name, email);
|
|
341
|
+
if(Gleap.getInstance() == null) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
315
344
|
Gleap.getInstance().identifyUser(userid, gleapUserSession);
|
|
316
345
|
}
|
|
317
346
|
});
|
|
347
|
+
} catch (NoUiThreadException e) {
|
|
348
|
+
System.err.println(e.getMessage());
|
|
349
|
+
}
|
|
318
350
|
}
|
|
319
351
|
|
|
320
352
|
@ReactMethod
|
|
@@ -333,6 +365,9 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
333
365
|
public void attachCustomData(ReadableMap customData) {
|
|
334
366
|
try {
|
|
335
367
|
JSONObject jsonObject = GleapUtil.convertMapToJson(customData);
|
|
368
|
+
if(Gleap.getInstance() == null) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
336
371
|
Gleap.getInstance().appendCustomData(jsonObject);
|
|
337
372
|
} catch (Exception e) {
|
|
338
373
|
System.out.println(e);
|
|
@@ -426,7 +461,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
426
461
|
}
|
|
427
462
|
}
|
|
428
463
|
Gleap.getInstance().setActivationMethods(
|
|
429
|
-
|
|
464
|
+
internalActivationMethods.toArray(new GleapActivationMethod[internalActivationMethods.size()]));
|
|
430
465
|
}
|
|
431
466
|
|
|
432
467
|
/**
|
|
@@ -454,8 +489,8 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
454
489
|
request = (JSONObject) currentRequest.get("request");
|
|
455
490
|
}
|
|
456
491
|
Gleap.getInstance().logNetwork(currentRequest.getString("url"),
|
|
457
|
-
|
|
458
|
-
|
|
492
|
+
RequestType.valueOf(currentRequest.getString("type")), response.getInt("status"),
|
|
493
|
+
currentRequest.getInt("duration"), request, response);
|
|
459
494
|
}
|
|
460
495
|
|
|
461
496
|
} catch (Exception ex) {
|
|
@@ -572,7 +607,7 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
572
607
|
|
|
573
608
|
private boolean checkAllowedEndings(String fileName) {
|
|
574
609
|
String[] fileType = fileName.split("\\.");
|
|
575
|
-
String[] allowedTypes = {
|
|
610
|
+
String[] allowedTypes = {"jpeg", "svg", "png", "mp4", "webp", "xml", "plain", "xml", "json"};
|
|
576
611
|
if (fileType.length <= 1) {
|
|
577
612
|
return false;
|
|
578
613
|
}
|
|
@@ -590,23 +625,24 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
590
625
|
* Show dev menu after shaking the phone.
|
|
591
626
|
*/
|
|
592
627
|
private void showDevMenu() {
|
|
593
|
-
|
|
628
|
+
try {
|
|
629
|
+
getActivitySafe().runOnUiThread(
|
|
594
630
|
new Runnable() {
|
|
595
631
|
@Override
|
|
596
632
|
public void run() {
|
|
597
633
|
final ReactApplication application = (ReactApplication) getReactApplicationContext()
|
|
598
|
-
|
|
599
|
-
|
|
634
|
+
.getCurrentActivity()
|
|
635
|
+
.getApplication();
|
|
600
636
|
Handler mainHandler = new Handler(GleapsdkModule.this.getReactApplicationContext().getMainLooper());
|
|
601
637
|
Runnable myRunnable = new Runnable() {
|
|
602
638
|
@Override
|
|
603
639
|
public void run() {
|
|
604
640
|
try {
|
|
605
641
|
application
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
642
|
+
.getReactNativeHost()
|
|
643
|
+
.getReactInstanceManager()
|
|
644
|
+
.getDevSupportManager()
|
|
645
|
+
.showDevOptionsDialog();
|
|
610
646
|
} catch (Exception e) {
|
|
611
647
|
e.printStackTrace();
|
|
612
648
|
}
|
|
@@ -615,6 +651,9 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
615
651
|
mainHandler.post(myRunnable);
|
|
616
652
|
}
|
|
617
653
|
});
|
|
654
|
+
} catch (NoUiThreadException e) {
|
|
655
|
+
System.err.println(e.getMessage());
|
|
656
|
+
}
|
|
618
657
|
}
|
|
619
658
|
|
|
620
659
|
@Override
|
|
@@ -640,4 +679,12 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
640
679
|
invalidated = true;
|
|
641
680
|
super.invalidate();
|
|
642
681
|
}
|
|
682
|
+
|
|
683
|
+
private Activity getActivitySafe() throws NoUiThreadException {
|
|
684
|
+
Activity activity = getCurrentActivity();
|
|
685
|
+
if(activity == null) {
|
|
686
|
+
throw new NoUiThreadException();
|
|
687
|
+
}
|
|
688
|
+
return activity;
|
|
689
|
+
}
|
|
643
690
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gleapsdk",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.6",
|
|
4
4
|
"description": "Know exactly why and how a bug happened. Get reports with screenshots, live action replays and all of the important metadata every time.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|