react-native-in-app-debugger 1.0.41 → 1.0.43
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/Api.jsx +7 -2
- package/index.jsx +36 -2
- package/package.json +1 -1
package/Api.jsx
CHANGED
|
@@ -140,7 +140,7 @@ export default (props) => {
|
|
|
140
140
|
style={{ padding: 5, backgroundColor: "white", borderRadius: 5 }}
|
|
141
141
|
onPress={() =>
|
|
142
142
|
Alert.alert("Are you sure", "You want to clear all blacklists", [
|
|
143
|
-
{ text: "Clear", onPress: () => props.setBlacklists(
|
|
143
|
+
{ text: "Clear", onPress: () => props.setBlacklists(), style: "cancel" },
|
|
144
144
|
{ text: "Cancel" },
|
|
145
145
|
])
|
|
146
146
|
}
|
|
@@ -240,7 +240,12 @@ export default (props) => {
|
|
|
240
240
|
</TouchableOpacity>
|
|
241
241
|
)}
|
|
242
242
|
<TouchableOpacity
|
|
243
|
-
onPress={() =>
|
|
243
|
+
onPress={() => {
|
|
244
|
+
Alert.alert("Are you sure", `You want to blacklist: \n\n(${item.request.method}) ${item.request.url} \n\nwhere all history logs for this API will be removed and all future request for this API will not be recorded?`, [
|
|
245
|
+
{ text: "Blacklist", onPress: () => props.setBlacklists({method: item.request.method, url: item.request.url}), style: "cancel" },
|
|
246
|
+
{ text: "Cancel" },
|
|
247
|
+
])
|
|
248
|
+
}}
|
|
244
249
|
style={styles.actionButton}
|
|
245
250
|
>
|
|
246
251
|
<Text style={{ color: "black", fontSize: 10 }}>Blacklist</Text>
|
package/index.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
4
|
StyleSheet,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Dimensions,
|
|
9
9
|
} from "react-native";
|
|
10
10
|
import Text from "./Text";
|
|
11
|
+
|
|
11
12
|
let DeviceInfo;
|
|
12
13
|
try {
|
|
13
14
|
DeviceInfo = require("react-native-device-info");
|
|
@@ -15,6 +16,13 @@ try {
|
|
|
15
16
|
// console.error("Error importing DeviceInfo:", error);
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
let LocalStorage;
|
|
20
|
+
try {
|
|
21
|
+
LocalStorage = require("@react-native-async-storage/async-storage/src").default;
|
|
22
|
+
} catch (error) {
|
|
23
|
+
// console.error("Error importing LocalStorage:", error);
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
import useAnimation from "./useAnimation";
|
|
19
27
|
import Variables from "./Variables";
|
|
20
28
|
import Api from "./Api";
|
|
@@ -50,7 +58,33 @@ export default ({
|
|
|
50
58
|
labels = [],
|
|
51
59
|
interceptResponse
|
|
52
60
|
}) => {
|
|
53
|
-
const [blacklists,
|
|
61
|
+
const [blacklists, setB] = useState([]);
|
|
62
|
+
|
|
63
|
+
const setBlacklists = d => {
|
|
64
|
+
if (!d) {
|
|
65
|
+
setB([]);
|
|
66
|
+
LocalStorage?.removeItem('in-app-debugger-blacklist');
|
|
67
|
+
} else {
|
|
68
|
+
setB(v => {
|
|
69
|
+
const newValue = Array.isArray(d) ? d : [...v, d];
|
|
70
|
+
LocalStorage?.setItem('in-app-debugger-blacklist', JSON.stringify(newValue));
|
|
71
|
+
return newValue;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (LocalStorage) {
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
LocalStorage.getItem('in-app-debugger-blacklist').then(d => {
|
|
80
|
+
if (d) {
|
|
81
|
+
setBlacklists(JSON.parse(d));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}, 4000);
|
|
85
|
+
},[]);
|
|
86
|
+
}
|
|
87
|
+
|
|
54
88
|
const { apis, clear } = useApiInterceptor(maxNumOfApiToStore, blacklists, interceptResponse);
|
|
55
89
|
|
|
56
90
|
const [tab, setTab] = useState("api");
|
package/package.json
CHANGED