react-native-in-app-debugger 1.0.77 → 1.0.79

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 CHANGED
@@ -1,28 +1,103 @@
1
- import React from 'react';
2
- import { Linking, Text, TextInput, TouchableOpacity, View } from 'react-native';
1
+ import React, { useEffect } from "react";
2
+ import {
3
+ Linking,
4
+ Text,
5
+ TextInput,
6
+ TouchableOpacity,
7
+ View,
8
+ FlatList,
9
+ } from "react-native";
10
+ import X from "./X";
3
11
 
4
- export default ({deeplinkPrefix, onClose}) => {
5
- const [text, setText] = React.useState('');
12
+ let LocalStorage;
13
+ try {
14
+ LocalStorage =
15
+ require("@react-native-async-storage/async-storage/src").default;
16
+ } catch (error) {
17
+ // console.error("Error importing LocalStorage:", error);
18
+ }
19
+
20
+ export default ({ deeplinkPrefix, onClose }) => {
21
+ const [text, setText] = React.useState("");
22
+ const [history, setHistory] = React.useState([]);
23
+
24
+ const go = (t) => {
25
+ const newHistory = [t, ...history.filter((h) => h !== t)];
26
+ // setHistory(newHistory);
27
+ setTimeout(() => {
28
+ LocalStorage?.setItem(
29
+ "in-app-debugger-deeplink-list",
30
+ JSON.stringify(newHistory)
31
+ );
32
+ Linking.openURL(deeplinkPrefix + t);
33
+ }, 500);
34
+ onClose();
35
+ };
36
+
37
+ const remove = (t) => {
38
+ const newHistory = history.filter((h) => h !== t);
39
+ setHistory(newHistory);
40
+ LocalStorage?.setItem(
41
+ "in-app-debugger-deeplink-list",
42
+ JSON.stringify(newHistory)
43
+ );
44
+ };
45
+
46
+ useEffect(() => {
47
+ LocalStorage?.getItem("in-app-debugger-deeplink-list").then((d) => {
48
+ if (d) {
49
+ setHistory(JSON.parse(d));
50
+ }
51
+ });
52
+ }, []);
6
53
  return (
7
- <View style={{ flexDirection: 'row', alignItems: 'center', margin: 10 }}>
8
- <Text style={{ color: 'white' }}>{deeplinkPrefix}</Text>
9
- <TextInput
10
- value={text}
11
- autoCapitalize='none'
12
- autoCorrect={false}
13
- autoComplete='off'
14
- onChangeText={setText}
15
- style={{ flex: 1, backgroundColor: '#555', marginRight: 10, padding: 3, borderRadius: 3 }}
54
+ <View style={{ marginBottom: 10 }}>
55
+ <View style={{ flexDirection: "row", alignItems: "center", margin: 10 }}>
56
+ <Text style={{ color: "white" }}>{deeplinkPrefix}</Text>
57
+ <TextInput
58
+ value={text}
59
+ autoCapitalize="none"
60
+ autoCorrect={false}
61
+ autoComplete="off"
62
+ onChangeText={setText}
63
+ style={{
64
+ flex: 1,
65
+ backgroundColor: "#555",
66
+ marginRight: 10,
67
+ padding: 3,
68
+ borderRadius: 3,
69
+ }}
70
+ />
71
+ <TouchableOpacity
72
+ style={{ padding: 7, borderRadius: 4, backgroundColor: "white" }}
73
+ onPress={() => go(text)}
74
+ >
75
+ <Text style={{ color: "black", fontSize: 9 }}>Go</Text>
76
+ </TouchableOpacity>
77
+ </View>
78
+ <FlatList
79
+ data={history}
80
+ renderItem={({ item }) => (
81
+ <View
82
+ style={{
83
+ flexDirection: "row",
84
+ alignItems: "center",
85
+ gap: 10,
86
+ padding: 10,
87
+ justifyContent: "flex-end",
88
+ }}
89
+ >
90
+ <TouchableOpacity onPress={() => go(item)}>
91
+ <Text style={{ color: "white", textAlign: "right" }}>{item}</Text>
92
+ </TouchableOpacity>
93
+ <X
94
+ style={{ marginRight: 5 }}
95
+ size={15}
96
+ onPress={() => remove(item)}
97
+ />
98
+ </View>
99
+ )}
16
100
  />
17
- <TouchableOpacity
18
- style={{ padding: 7, borderRadius: 4, backgroundColor: 'white' }}
19
- onPress={() => {
20
- onClose();
21
- Linking.openURL(deeplinkPrefix + text);
22
- }}
23
- >
24
- <Text style={{ color: 'black', fontSize: 9 }}>Go</Text>
25
- </TouchableOpacity>
26
101
  </View>
27
102
  );
28
103
  };
package/Libs.jsx CHANGED
@@ -9,7 +9,6 @@ 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";
13
12
 
14
13
  const libs = Object.entries(packageJson.dependencies).reduce(
15
14
  (arr, [name, version]) => [...arr, { name, version }],
@@ -21,7 +20,6 @@ export default (p) => {
21
20
 
22
21
  return (
23
22
  <>
24
- {!!p.deeplinkPrefix && <Deeplink {...p} />}
25
23
  <TextInput
26
24
  value={filter}
27
25
  placeholder="Filter..."
package/index.jsx CHANGED
@@ -6,7 +6,9 @@ import {
6
6
  View,
7
7
  SafeAreaView,
8
8
  useWindowDimensions,
9
+ FlatList,
9
10
  } from "react-native";
11
+ import Deeplink from "./Deeplink";
10
12
  import Text from "./Text";
11
13
  import X from "./X";
12
14
  const testId = "react-native-in-app-debugger-close-button";
@@ -64,6 +66,8 @@ export default ({
64
66
  interceptResponse,
65
67
  tabs = [],
66
68
  }) => {
69
+
70
+ const deeplinkPrefix = variables?.DEEPLINK_PREFIX;
67
71
  const [blacklists, setB, blacklistRef] = useStateRef([]);
68
72
  const dimension = useWindowDimensions();
69
73
 
@@ -189,11 +193,51 @@ export default ({
189
193
  ))}
190
194
  </View>
191
195
  <View style={{ flexDirection: "row", padding: 5, gap: 6 }}>
192
- <View style={{ flex: 1, flexDirection: "row" }}>
196
+ <FlatList
197
+ style={{flex: 1}}
198
+ data={[
199
+ "api",
200
+ !!variables && "vars",
201
+ !!deeplinkPrefix && "deeplink",
202
+ "libs",
203
+ ...tabs.map((t) => t.title),
204
+ ]
205
+ .filter(Boolean)}
206
+ keyExtractor={(item) => item}
207
+ horizontal
208
+ showsHorizontalScrollIndicator={false}
209
+ renderItem={({item, index})=>{
210
+ const isSelected = item === tab;
211
+ return (
212
+ <TouchableOpacity
213
+ onPress={() => setTab(item)}
214
+ activeOpacity={isSelected ? 1 : 0.7}
215
+ style={{
216
+ paddingHorizontal: 8,
217
+ borderBottomWidth: +isSelected,
218
+ borderColor: "white",
219
+ }}
220
+ >
221
+ <Text
222
+ style={{
223
+ color: "white",
224
+ opacity: isSelected ? 1 : 0.5,
225
+ textAlign: "center",
226
+ textTransform: "uppercase",
227
+ }}
228
+ >
229
+ {item}
230
+ {!index && !!apis.length && <Text> ({apis.length})</Text>}
231
+ </Text>
232
+ </TouchableOpacity>
233
+ );
234
+ }}
235
+ />
236
+ {/* <View style={{ flex: 1, flexDirection: "row" }}>
193
237
  {[
194
238
  "api",
195
239
  !!variables && "vars",
196
- "config",
240
+ "libs",
197
241
  ...tabs.map((t) => t.title),
198
242
  ]
199
243
  .filter(Boolean)
@@ -224,16 +268,12 @@ export default ({
224
268
  </TouchableOpacity>
225
269
  );
226
270
  })}
227
- </View>
271
+ </View> */}
228
272
  <X style={{ marginRight: 5 }} onPress={() => setIsOpen(false)} />
229
273
  </View>
230
- {tab === "vars" && !!variables && <Variables variables={variables} />}
231
- {tab === "config" && (
232
- <Libs
233
- deeplinkPrefix={variables.DEEPLINK_PREFIX}
234
- onClose={() => setIsOpen(false)}
235
- />
236
- )}
274
+ {tab === "vars" && <Variables variables={variables} />}
275
+ {tab === "deeplink" && <Deeplink deeplinkPrefix={deeplinkPrefix} onClose={() => setIsOpen(false)} />}
276
+ {tab === "libs" && <Libs />}
237
277
  {tab === "api" && (
238
278
  <Api
239
279
  {...{ apis, setBlacklists, blacklists, maxNumOfApiToStore }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-in-app-debugger",
3
- "version": "1.0.77",
3
+ "version": "1.0.79",
4
4
  "description": "This library's main usage is to be used by Non-Technical testers during UAT, SIT or any testing phase.",
5
5
  "main": "index.jsx",
6
6
  "scripts": {