react-native-in-app-debugger 1.0.76 → 1.0.78
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/Deeplink.tsx +66 -0
- package/Libs.jsx +3 -1
- package/index.jsx +7 -2
- package/package.json +1 -1
package/Deeplink.tsx
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { Linking, Text, TextInput, TouchableOpacity, View } from "react-native";
|
|
3
|
+
|
|
4
|
+
let LocalStorage;
|
|
5
|
+
try {
|
|
6
|
+
LocalStorage =
|
|
7
|
+
require("@react-native-async-storage/async-storage/src").default;
|
|
8
|
+
} catch (error) {
|
|
9
|
+
// console.error("Error importing LocalStorage:", error);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default ({ deeplinkPrefix, onClose }) => {
|
|
13
|
+
const [text, setText] = React.useState("");
|
|
14
|
+
const [history, setHistory] = React.useState([]);
|
|
15
|
+
|
|
16
|
+
const go = (t) => {
|
|
17
|
+
const newHistory = [t, ...history.filter((h) => h !== t)].slice(0, 3);
|
|
18
|
+
setHistory(newHistory);
|
|
19
|
+
LocalStorage?.setItem(
|
|
20
|
+
"in-app-debugger-deeplink-list",
|
|
21
|
+
JSON.stringify(newHistory)
|
|
22
|
+
);
|
|
23
|
+
onClose();
|
|
24
|
+
Linking.openURL(deeplinkPrefix + t);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
LocalStorage?.getItem("in-app-debugger-deeplink-list").then((d) => {
|
|
29
|
+
if (d) {
|
|
30
|
+
setHistory(JSON.parse(d));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}, []);
|
|
34
|
+
return (
|
|
35
|
+
<View style={{ marginBottom: 10 }}>
|
|
36
|
+
<View style={{ flexDirection: "row", alignItems: "center", margin: 10 }}>
|
|
37
|
+
<Text style={{ color: "white" }}>{deeplinkPrefix}</Text>
|
|
38
|
+
<TextInput
|
|
39
|
+
value={text}
|
|
40
|
+
autoCapitalize="none"
|
|
41
|
+
autoCorrect={false}
|
|
42
|
+
autoComplete="off"
|
|
43
|
+
onChangeText={setText}
|
|
44
|
+
style={{
|
|
45
|
+
flex: 1,
|
|
46
|
+
backgroundColor: "#555",
|
|
47
|
+
marginRight: 10,
|
|
48
|
+
padding: 3,
|
|
49
|
+
borderRadius: 3,
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
<TouchableOpacity
|
|
53
|
+
style={{ padding: 7, borderRadius: 4, backgroundColor: "white" }}
|
|
54
|
+
onPress={() => go(text)}
|
|
55
|
+
>
|
|
56
|
+
<Text style={{ color: "black", fontSize: 9 }}>Go</Text>
|
|
57
|
+
</TouchableOpacity>
|
|
58
|
+
</View>
|
|
59
|
+
{history.map((h) => (
|
|
60
|
+
<TouchableOpacity style={{ margin: 6 }} onPress={() => go(h)}>
|
|
61
|
+
<Text style={{ color: "grey", textAlign: "right" }}>{h}</Text>
|
|
62
|
+
</TouchableOpacity>
|
|
63
|
+
))}
|
|
64
|
+
</View>
|
|
65
|
+
);
|
|
66
|
+
};
|
package/Libs.jsx
CHANGED
|
@@ -9,17 +9,19 @@ import Text from "./Text";
|
|
|
9
9
|
import Highlight from "./Highlight";
|
|
10
10
|
import packageJson from "../../package.json";
|
|
11
11
|
import realDeps from "./parentDependencies.js";
|
|
12
|
+
import Deeplink from "./Deeplink";
|
|
12
13
|
|
|
13
14
|
const libs = Object.entries(packageJson.dependencies).reduce(
|
|
14
15
|
(arr, [name, version]) => [...arr, { name, version }],
|
|
15
16
|
[]
|
|
16
17
|
);
|
|
17
18
|
|
|
18
|
-
export default () => {
|
|
19
|
+
export default (p) => {
|
|
19
20
|
const [filter, setFilter] = useState("");
|
|
20
21
|
|
|
21
22
|
return (
|
|
22
23
|
<>
|
|
24
|
+
{!!p.deeplinkPrefix && <Deeplink {...p} />}
|
|
23
25
|
<TextInput
|
|
24
26
|
value={filter}
|
|
25
27
|
placeholder="Filter..."
|
package/index.jsx
CHANGED
|
@@ -193,7 +193,7 @@ export default ({
|
|
|
193
193
|
{[
|
|
194
194
|
"api",
|
|
195
195
|
!!variables && "vars",
|
|
196
|
-
"
|
|
196
|
+
"config",
|
|
197
197
|
...tabs.map((t) => t.title),
|
|
198
198
|
]
|
|
199
199
|
.filter(Boolean)
|
|
@@ -228,7 +228,12 @@ export default ({
|
|
|
228
228
|
<X style={{ marginRight: 5 }} onPress={() => setIsOpen(false)} />
|
|
229
229
|
</View>
|
|
230
230
|
{tab === "vars" && !!variables && <Variables variables={variables} />}
|
|
231
|
-
{tab === "
|
|
231
|
+
{tab === "config" && (
|
|
232
|
+
<Libs
|
|
233
|
+
deeplinkPrefix={variables.DEEPLINK_PREFIX}
|
|
234
|
+
onClose={() => setIsOpen(false)}
|
|
235
|
+
/>
|
|
236
|
+
)}
|
|
232
237
|
{tab === "api" && (
|
|
233
238
|
<Api
|
|
234
239
|
{...{ apis, setBlacklists, blacklists, maxNumOfApiToStore }}
|
package/package.json
CHANGED