react-native-in-app-debugger 2.0.8 → 2.0.9

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/index.jsx CHANGED
@@ -285,16 +285,32 @@ export default (props) => {
285
285
  <BlacklistIcon />
286
286
  </TouchableOpacity>
287
287
  )}
288
+ {isExpand && item.interface === "axios" && !!item.mockid && (
289
+ <TouchableOpacity
290
+ onPress={() => props.goToMock({ ...item, id: item.mockid })}
291
+ style={styles.actionButton}
292
+ >
293
+ <Text style={{ color: "black", fontSize: 10 }}>
294
+ Edit Mock
295
+ </Text>
296
+ </TouchableOpacity>
297
+ )}
288
298
  {isExpand && item.interface === "axios" && (
289
299
  <TouchableOpacity
290
- onPress={() => {
291
- props.goToMock(
292
- item.mockid ? { ...item, id: item.mockid } : item
293
- );
294
- }}
300
+ onPress={() => props.goToMock(item)}
301
+ style={styles.actionButton}
302
+ >
303
+ <Text style={{ color: "black", fontSize: 10 }}>
304
+ {item.mockid ? "New " : ""}Mock
305
+ </Text>
306
+ </TouchableOpacity>
307
+ )}
308
+ {isExpand && (
309
+ <TouchableOpacity
310
+ onPress={() => props.deleteApi(item.id)}
295
311
  style={styles.actionButton}
296
312
  >
297
- <Text style={{ color: "black", fontSize: 10 }}>Mock</Text>
313
+ <Text style={{ color: "black", fontSize: 10 }}>Delete</Text>
298
314
  </TouchableOpacity>
299
315
  )}
300
316
  </View>
@@ -50,11 +50,16 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
50
50
  datetime: new Date().toLocaleString(),
51
51
  time: `${hour}:${minute}:${second}`,
52
52
  mockid: undefined,
53
- interface: undefined
53
+ interface: undefined,
54
54
  };
55
55
  setApis((v) => {
56
56
  const newData = [
57
- { request, id: Date.now().toString(36) + Math.random().toString(36), mockid: data.mockid, interface: data.interface },
57
+ {
58
+ request,
59
+ id: Date.now().toString(36) + Math.random().toString(36),
60
+ mockid: data.mockid,
61
+ interface: data.interface,
62
+ },
58
63
  ...(maxNumOfApiToStore ? v.slice(0, maxNumOfApiToStore - 1) : v),
59
64
  ];
60
65
  return newData;
@@ -194,7 +199,7 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
194
199
  if (!shouldExclude(url, method)) {
195
200
  const data = config.data ? parse(config.data) : undefined;
196
201
 
197
- const mock = mocked(url, method);
202
+ const mock = mocked(url, method);
198
203
 
199
204
  makeRequest({
200
205
  url,
@@ -255,5 +260,14 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
255
260
  );
256
261
  }, [mocks]);
257
262
 
258
- return { apis, clear: () => setApis([]), bookmarks, setBookmarks };
263
+ const deleteApi = (id) => {
264
+ setApis((v) => v.filter((a) => a.id !== id));
265
+ setBookmarks((v) => {
266
+ const newV = { ...v };
267
+ delete newV[id];
268
+ return newV;
269
+ });
270
+ };
271
+
272
+ return { apis, deleteApi, clear: () => setApis([]), bookmarks, setBookmarks };
259
273
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-in-app-debugger",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
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": {