react-native-gleapsdk 6.4.3 → 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 +1 -2
- package/android/src/main/java/com/reactnativegleapsdk/GleapsdkModule.java +284 -187
- package/android/src/main/java/com/reactnativegleapsdk/NoUiThreadException.java +7 -0
- package/ios/Gleapsdk.m +16 -2
- package/ios/Gleapsdk.xcodeproj/project.xcworkspace/xcuserdata/lukasboehler.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/lib/commonjs/index.js +38 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/networklogger.js +1 -3
- package/lib/commonjs/networklogger.js.map +1 -1
- package/lib/module/index.js +38 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/networklogger.js +1 -3
- package/lib/module/networklogger.js.map +1 -1
- package/lib/typescript/index.d.ts +2 -0
- package/package.json +1 -1
- package/react-native-gleapsdk.podspec +1 -1
- package/src/index.tsx +44 -11
- package/src/networklogger.ts +1 -2
package/android/build.gradle
CHANGED
|
@@ -56,6 +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.
|
|
60
|
-
|
|
59
|
+
implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '6.4.12'
|
|
61
60
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package com.reactnativegleapsdk;
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
import android.app.Activity;
|
|
5
4
|
import android.os.Build;
|
|
6
5
|
import android.os.Handler;
|
|
@@ -9,8 +8,10 @@ import androidx.annotation.NonNull;
|
|
|
9
8
|
import androidx.annotation.RequiresApi;
|
|
10
9
|
|
|
11
10
|
import com.facebook.react.ReactApplication;
|
|
11
|
+
import com.facebook.react.ReactInstanceManager;
|
|
12
12
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
13
13
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
14
|
+
import com.facebook.react.bridge.ReactContext;
|
|
14
15
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
15
16
|
import com.facebook.react.bridge.ReactMethod;
|
|
16
17
|
import com.facebook.react.bridge.ReadableArray;
|
|
@@ -27,6 +28,7 @@ import java.io.FileOutputStream;
|
|
|
27
28
|
import java.io.OutputStream;
|
|
28
29
|
import java.util.ArrayList;
|
|
29
30
|
import java.util.Base64;
|
|
31
|
+
import java.util.logging.Logger;
|
|
30
32
|
import java.util.regex.Matcher;
|
|
31
33
|
import java.util.regex.Pattern;
|
|
32
34
|
|
|
@@ -34,7 +36,9 @@ import io.gleap.APPLICATIONTYPE;
|
|
|
34
36
|
import io.gleap.ConfigLoadedCallback;
|
|
35
37
|
import io.gleap.CustomActionCallback;
|
|
36
38
|
import io.gleap.FeedbackSentCallback;
|
|
39
|
+
import io.gleap.FeedbackSentWithDataCallback;
|
|
37
40
|
import io.gleap.FeedbackWillBeSentCallback;
|
|
41
|
+
import io.gleap.GetActivityCallback;
|
|
38
42
|
import io.gleap.Gleap;
|
|
39
43
|
import io.gleap.GleapActivationMethod;
|
|
40
44
|
import io.gleap.GleapUserProperties;
|
|
@@ -46,10 +50,18 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
46
50
|
private boolean isSilentBugReport = false;
|
|
47
51
|
private boolean invalidated = false;
|
|
48
52
|
|
|
49
|
-
public GleapsdkModule(ReactApplicationContext
|
|
50
|
-
super(
|
|
53
|
+
public GleapsdkModule(ReactApplicationContext context) {
|
|
54
|
+
super(context);
|
|
55
|
+
Gleap.getInstance().setGetActivityCallback(new GetActivityCallback() {
|
|
56
|
+
@Override
|
|
57
|
+
public Activity getActivity() {
|
|
58
|
+
return context.getCurrentActivity();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
51
62
|
}
|
|
52
63
|
|
|
64
|
+
|
|
53
65
|
@Override
|
|
54
66
|
@NonNull
|
|
55
67
|
public String getName() {
|
|
@@ -63,70 +75,91 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
63
75
|
*/
|
|
64
76
|
@ReactMethod
|
|
65
77
|
public void initialize(String sdkKey) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
try {
|
|
79
|
+
getActivitySafe().runOnUiThread(
|
|
80
|
+
new Runnable() {
|
|
81
|
+
@Override
|
|
82
|
+
public void run() {
|
|
83
|
+
try {
|
|
84
|
+
Activity activity = getReactApplicationContext()
|
|
85
|
+
.getCurrentActivity();
|
|
86
|
+
if (activity != null && !invalidated) {
|
|
87
|
+
Gleap.getInstance().setApplicationType(APPLICATIONTYPE.REACTNATIVE);
|
|
88
|
+
Gleap.getInstance().setFeedbackWillBeSentCallback(new FeedbackWillBeSentCallback() {
|
|
89
|
+
@Override
|
|
90
|
+
public void flowInvoced() {
|
|
91
|
+
if (!invalidated) {
|
|
92
|
+
getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
93
|
+
.emit("feedbackWillBeSent", null);
|
|
94
|
+
}
|
|
80
95
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
Gleap.initialize(sdkKey, activity.getApplication());
|
|
99
|
+
Gleap.getInstance().setConfigLoadedCallback(new ConfigLoadedCallback() {
|
|
100
|
+
@Override
|
|
101
|
+
public void configLoaded(JSONObject jsonObject) {
|
|
102
|
+
if (!invalidated) {
|
|
103
|
+
getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
104
|
+
.emit("configLoaded", jsonObject.toString());
|
|
105
|
+
}
|
|
90
106
|
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
Gleap.getInstance().registerCustomAction(new CustomActionCallback() {
|
|
110
|
+
@Override
|
|
111
|
+
public void invoke(String message) {
|
|
112
|
+
JSONObject obj = new JSONObject();
|
|
113
|
+
try {
|
|
114
|
+
obj.put("name", message);
|
|
115
|
+
} catch (JSONException e) {
|
|
116
|
+
e.printStackTrace();
|
|
117
|
+
}
|
|
118
|
+
if (!invalidated) {
|
|
119
|
+
getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
120
|
+
.emit("customActionTriggered", obj.toString());
|
|
121
|
+
}
|
|
102
122
|
}
|
|
103
|
-
|
|
104
|
-
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
Gleap.getInstance().setFeedbackSentWithDataCallback(new FeedbackSentWithDataCallback() {
|
|
126
|
+
@Override
|
|
127
|
+
public void close(JSONObject jsonObject) {
|
|
128
|
+
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);
|
|
105
138
|
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
} catch (Exception ex) {
|
|
156
|
+
System.out.println(ex);
|
|
123
157
|
}
|
|
124
|
-
} catch (Exception ex) {
|
|
125
|
-
System.out.println(ex);
|
|
126
158
|
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
159
|
+
});
|
|
160
|
+
} catch (NoUiThreadException e) {
|
|
161
|
+
System.err.println(e.getMessage());
|
|
162
|
+
}
|
|
130
163
|
}
|
|
131
164
|
|
|
132
165
|
@ReactMethod
|
|
@@ -144,71 +177,77 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
144
177
|
*/
|
|
145
178
|
@ReactMethod
|
|
146
179
|
public void open() {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
new java.util.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
180
|
+
try {
|
|
181
|
+
getActivitySafe().runOnUiThread(
|
|
182
|
+
new Runnable() {
|
|
183
|
+
@Override
|
|
184
|
+
public void run() {
|
|
185
|
+
try {
|
|
186
|
+
Gleap.getInstance().startFeedbackFlow();
|
|
187
|
+
Gleap.getInstance().setFeedbackSentCallback(new FeedbackSentCallback() {
|
|
188
|
+
@Override
|
|
189
|
+
public void close() {
|
|
190
|
+
new java.util.Timer().schedule(
|
|
191
|
+
new java.util.TimerTask() {
|
|
192
|
+
@Override
|
|
193
|
+
public void run() {
|
|
194
|
+
if (!isSilentBugReport) {
|
|
195
|
+
showDevMenu();
|
|
196
|
+
} else {
|
|
197
|
+
isSilentBugReport = false;
|
|
198
|
+
}
|
|
164
199
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
System.out.println(e);
|
|
200
|
+
},
|
|
201
|
+
500);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
} catch (Exception e) {
|
|
205
|
+
System.out.println(e);
|
|
206
|
+
}
|
|
173
207
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
208
|
+
});
|
|
209
|
+
} catch (NoUiThreadException e) {
|
|
210
|
+
System.err.println(e.getMessage());
|
|
211
|
+
}
|
|
176
212
|
}
|
|
177
213
|
|
|
178
214
|
/**
|
|
179
215
|
* Start bug report manually by calling this function.
|
|
180
216
|
*/
|
|
181
217
|
@ReactMethod
|
|
182
|
-
public void startFeedbackFlow(String feedbackFlow)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
new java.util.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
218
|
+
public void startFeedbackFlow(String feedbackFlow){
|
|
219
|
+
try {
|
|
220
|
+
getActivitySafe().runOnUiThread(
|
|
221
|
+
new Runnable() {
|
|
222
|
+
@Override
|
|
223
|
+
public void run() {
|
|
224
|
+
try {
|
|
225
|
+
Gleap.getInstance().startFeedbackFlow(feedbackFlow);
|
|
226
|
+
Gleap.getInstance().setFeedbackSentCallback(new FeedbackSentCallback() {
|
|
227
|
+
@Override
|
|
228
|
+
public void close() {
|
|
229
|
+
new java.util.Timer().schedule(
|
|
230
|
+
new java.util.TimerTask() {
|
|
231
|
+
@Override
|
|
232
|
+
public void run() {
|
|
233
|
+
if (!isSilentBugReport) {
|
|
234
|
+
showDevMenu();
|
|
235
|
+
} else {
|
|
236
|
+
isSilentBugReport = false;
|
|
237
|
+
}
|
|
200
238
|
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
System.out.println(e);
|
|
239
|
+
},
|
|
240
|
+
500);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
} catch (Exception e) {
|
|
244
|
+
System.out.println(e);
|
|
245
|
+
}
|
|
209
246
|
}
|
|
210
|
-
}
|
|
211
|
-
|
|
247
|
+
});
|
|
248
|
+
} catch (NoUiThreadException e) {
|
|
249
|
+
System.err.println(e.getMessage());
|
|
250
|
+
}
|
|
212
251
|
}
|
|
213
252
|
|
|
214
253
|
/**
|
|
@@ -217,23 +256,55 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
217
256
|
@ReactMethod
|
|
218
257
|
public void sendSilentBugReport(
|
|
219
258
|
String description,
|
|
220
|
-
String priority
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
259
|
+
String priority) {
|
|
260
|
+
try {
|
|
261
|
+
getActivitySafe().runOnUiThread(
|
|
262
|
+
new Runnable() {
|
|
263
|
+
@Override
|
|
264
|
+
public void run() {
|
|
265
|
+
isSilentBugReport = true;
|
|
266
|
+
Gleap.SEVERITY severity = Gleap.SEVERITY.LOW;
|
|
267
|
+
if (priority == "MEDIUM") {
|
|
268
|
+
severity = Gleap.SEVERITY.MEDIUM;
|
|
269
|
+
}
|
|
270
|
+
if (priority == "HIGH") {
|
|
271
|
+
severity = Gleap.SEVERITY.HIGH;
|
|
272
|
+
}
|
|
273
|
+
Gleap.getInstance().sendSilentBugReport(description, severity);
|
|
230
274
|
}
|
|
231
|
-
|
|
232
|
-
|
|
275
|
+
});
|
|
276
|
+
} catch (NoUiThreadException e) {
|
|
277
|
+
System.err.println(e.getMessage());
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Manually start a silent bug reporting workflow.
|
|
283
|
+
*/
|
|
284
|
+
@ReactMethod
|
|
285
|
+
public void sendSilentBugReportWithType(
|
|
286
|
+
String description,
|
|
287
|
+
String priority,
|
|
288
|
+
String type) {
|
|
289
|
+
try {
|
|
290
|
+
getActivitySafe().runOnUiThread(
|
|
291
|
+
new Runnable() {
|
|
292
|
+
@Override
|
|
293
|
+
public void run() {
|
|
294
|
+
isSilentBugReport = true;
|
|
295
|
+
Gleap.SEVERITY severity = Gleap.SEVERITY.LOW;
|
|
296
|
+
if (priority == "MEDIUM") {
|
|
297
|
+
severity = Gleap.SEVERITY.MEDIUM;
|
|
298
|
+
}
|
|
299
|
+
if (priority == "HIGH") {
|
|
300
|
+
severity = Gleap.SEVERITY.HIGH;
|
|
301
|
+
}
|
|
302
|
+
Gleap.getInstance().sendSilentBugReport(description, severity, type);
|
|
233
303
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
304
|
+
});
|
|
305
|
+
} catch (NoUiThreadException e) {
|
|
306
|
+
System.err.println(e.getMessage());
|
|
307
|
+
}
|
|
237
308
|
}
|
|
238
309
|
|
|
239
310
|
@ReactMethod
|
|
@@ -242,32 +313,40 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
242
313
|
}
|
|
243
314
|
|
|
244
315
|
@ReactMethod
|
|
245
|
-
public void enableDebugConsoleLog() {
|
|
316
|
+
public void enableDebugConsoleLog() {
|
|
317
|
+
}
|
|
246
318
|
|
|
247
319
|
@ReactMethod
|
|
248
320
|
public void identify(String userid, ReadableMap data) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
321
|
+
try {
|
|
322
|
+
getActivitySafe().runOnUiThread(
|
|
323
|
+
new Runnable() {
|
|
324
|
+
@Override
|
|
325
|
+
public void run() {
|
|
326
|
+
JSONObject jsonObject = null;
|
|
327
|
+
String name = "";
|
|
328
|
+
String email = "";
|
|
329
|
+
try {
|
|
330
|
+
jsonObject = GleapUtil.convertMapToJson(data);
|
|
331
|
+
if (jsonObject.has("name")) {
|
|
332
|
+
name = jsonObject.getString("name");
|
|
333
|
+
}
|
|
334
|
+
if (jsonObject.has("email")) {
|
|
335
|
+
email = jsonObject.getString("email");
|
|
336
|
+
}
|
|
337
|
+
} catch (JSONException e) {
|
|
338
|
+
e.printStackTrace();
|
|
260
339
|
}
|
|
261
|
-
|
|
262
|
-
|
|
340
|
+
GleapUserProperties gleapUserSession = new GleapUserProperties(name, email);
|
|
341
|
+
if(Gleap.getInstance() == null) {
|
|
342
|
+
return;
|
|
263
343
|
}
|
|
264
|
-
|
|
265
|
-
e.printStackTrace();
|
|
344
|
+
Gleap.getInstance().identifyUser(userid, gleapUserSession);
|
|
266
345
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
346
|
+
});
|
|
347
|
+
} catch (NoUiThreadException e) {
|
|
348
|
+
System.err.println(e.getMessage());
|
|
349
|
+
}
|
|
271
350
|
}
|
|
272
351
|
|
|
273
352
|
@ReactMethod
|
|
@@ -276,7 +355,8 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
276
355
|
}
|
|
277
356
|
|
|
278
357
|
/**
|
|
279
|
-
* Attaches custom data, which can be viewed in the BugBattle dashboard. New
|
|
358
|
+
* Attaches custom data, which can be viewed in the BugBattle dashboard. New
|
|
359
|
+
* data will be merged with existing custom data.
|
|
280
360
|
*
|
|
281
361
|
* @param customData The data to attach to a bug report.
|
|
282
362
|
* @author BugBattle
|
|
@@ -285,6 +365,9 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
285
365
|
public void attachCustomData(ReadableMap customData) {
|
|
286
366
|
try {
|
|
287
367
|
JSONObject jsonObject = GleapUtil.convertMapToJson(customData);
|
|
368
|
+
if(Gleap.getInstance() == null) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
288
371
|
Gleap.getInstance().appendCustomData(jsonObject);
|
|
289
372
|
} catch (Exception e) {
|
|
290
373
|
System.out.println(e);
|
|
@@ -321,7 +404,8 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
321
404
|
}
|
|
322
405
|
|
|
323
406
|
/**
|
|
324
|
-
* Attaches custom data, which can be viewed in the Gleap dashboard. New data
|
|
407
|
+
* Attaches custom data, which can be viewed in the Gleap dashboard. New data
|
|
408
|
+
* will be merged with existing custom data.
|
|
325
409
|
*
|
|
326
410
|
* @param customData The data to attach to a bug report.
|
|
327
411
|
* @author Gleap
|
|
@@ -348,7 +432,6 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
348
432
|
Gleap.getInstance().setCustomData(key, value);
|
|
349
433
|
}
|
|
350
434
|
|
|
351
|
-
|
|
352
435
|
/**
|
|
353
436
|
* Removes one key from existing custom data.
|
|
354
437
|
*
|
|
@@ -360,7 +443,6 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
360
443
|
Gleap.getInstance().removeCustomDataForKey(key);
|
|
361
444
|
}
|
|
362
445
|
|
|
363
|
-
|
|
364
446
|
/**
|
|
365
447
|
* Sets an array of activation methods.
|
|
366
448
|
*
|
|
@@ -378,10 +460,10 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
378
460
|
internalActivationMethods.add(GleapActivationMethod.SCREENSHOT);
|
|
379
461
|
}
|
|
380
462
|
}
|
|
381
|
-
Gleap.getInstance().setActivationMethods(
|
|
463
|
+
Gleap.getInstance().setActivationMethods(
|
|
464
|
+
internalActivationMethods.toArray(new GleapActivationMethod[internalActivationMethods.size()]));
|
|
382
465
|
}
|
|
383
466
|
|
|
384
|
-
|
|
385
467
|
/**
|
|
386
468
|
* Clears all custom data.
|
|
387
469
|
*/
|
|
@@ -406,7 +488,9 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
406
488
|
if (currentRequest.has("request")) {
|
|
407
489
|
request = (JSONObject) currentRequest.get("request");
|
|
408
490
|
}
|
|
409
|
-
Gleap.getInstance().logNetwork(currentRequest.getString("url"),
|
|
491
|
+
Gleap.getInstance().logNetwork(currentRequest.getString("url"),
|
|
492
|
+
RequestType.valueOf(currentRequest.getString("type")), response.getInt("status"),
|
|
493
|
+
currentRequest.getInt("duration"), request, response);
|
|
410
494
|
}
|
|
411
495
|
|
|
412
496
|
} catch (Exception ex) {
|
|
@@ -443,7 +527,6 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
443
527
|
}
|
|
444
528
|
}
|
|
445
529
|
|
|
446
|
-
|
|
447
530
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
448
531
|
@ReactMethod
|
|
449
532
|
/**
|
|
@@ -518,7 +601,6 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
518
601
|
@ReactMethod
|
|
519
602
|
public void registerConfigLoadedAction(ConfigLoadedCallback configLoadedCallback) {
|
|
520
603
|
Gleap.getInstance().setConfigLoadedCallback(configLoadedCallback);
|
|
521
|
-
|
|
522
604
|
}
|
|
523
605
|
|
|
524
606
|
;
|
|
@@ -543,41 +625,48 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
543
625
|
* Show dev menu after shaking the phone.
|
|
544
626
|
*/
|
|
545
627
|
private void showDevMenu() {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
e
|
|
628
|
+
try {
|
|
629
|
+
getActivitySafe().runOnUiThread(
|
|
630
|
+
new Runnable() {
|
|
631
|
+
@Override
|
|
632
|
+
public void run() {
|
|
633
|
+
final ReactApplication application = (ReactApplication) getReactApplicationContext()
|
|
634
|
+
.getCurrentActivity()
|
|
635
|
+
.getApplication();
|
|
636
|
+
Handler mainHandler = new Handler(GleapsdkModule.this.getReactApplicationContext().getMainLooper());
|
|
637
|
+
Runnable myRunnable = new Runnable() {
|
|
638
|
+
@Override
|
|
639
|
+
public void run() {
|
|
640
|
+
try {
|
|
641
|
+
application
|
|
642
|
+
.getReactNativeHost()
|
|
643
|
+
.getReactInstanceManager()
|
|
644
|
+
.getDevSupportManager()
|
|
645
|
+
.showDevOptionsDialog();
|
|
646
|
+
} catch (Exception e) {
|
|
647
|
+
e.printStackTrace();
|
|
648
|
+
}
|
|
565
649
|
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
|
|
650
|
+
};
|
|
651
|
+
mainHandler.post(myRunnable);
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
} catch (NoUiThreadException e) {
|
|
655
|
+
System.err.println(e.getMessage());
|
|
656
|
+
}
|
|
571
657
|
}
|
|
572
658
|
|
|
573
659
|
@Override
|
|
574
|
-
public void onHostResume() {
|
|
660
|
+
public void onHostResume() {
|
|
661
|
+
}
|
|
575
662
|
|
|
576
663
|
@Override
|
|
577
|
-
public void onHostPause() {
|
|
664
|
+
public void onHostPause() {
|
|
665
|
+
}
|
|
578
666
|
|
|
579
667
|
@Override
|
|
580
|
-
public void onHostDestroy() {
|
|
668
|
+
public void onHostDestroy() {
|
|
669
|
+
}
|
|
581
670
|
|
|
582
671
|
@Override
|
|
583
672
|
public void onCatalystInstanceDestroy() {
|
|
@@ -590,4 +679,12 @@ public class GleapsdkModule extends ReactContextBaseJavaModule implements Lifecy
|
|
|
590
679
|
invalidated = true;
|
|
591
680
|
super.invalidate();
|
|
592
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
|
+
}
|
|
593
690
|
}
|