react-native-inapp-inspector 2.0.0 → 2.0.1

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.
Files changed (63) hide show
  1. package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +10 -24
  2. package/dist/commonjs/components/ConsoleLogCard.js +5 -5
  3. package/dist/commonjs/components/EndOfListFooter.js +1 -1
  4. package/dist/commonjs/components/Inspector/AnalyticsTab.js +19 -71
  5. package/dist/commonjs/components/Inspector/BundleTab.js +670 -188
  6. package/dist/commonjs/components/Inspector/ConsoleTab.js +109 -98
  7. package/dist/commonjs/components/Inspector/CrashTab.js +2 -1
  8. package/dist/commonjs/components/Inspector/InspectorHeader.js +102 -19
  9. package/dist/commonjs/components/Inspector/MainScreen.js +147 -17
  10. package/dist/commonjs/components/Inspector/NetworkTab.js +104 -20
  11. package/dist/commonjs/components/Inspector/SettingsPanel.js +1111 -1385
  12. package/dist/commonjs/components/Inspector/TabBar.js +3 -4
  13. package/dist/commonjs/components/JsonViewer.js +9 -4
  14. package/dist/commonjs/components/LogCard.js +31 -1
  15. package/dist/commonjs/components/LogSyntaxHighlighter.d.ts +16 -0
  16. package/dist/commonjs/components/LogSyntaxHighlighter.js +130 -0
  17. package/dist/commonjs/components/NetworkIcons.d.ts +2 -0
  18. package/dist/commonjs/components/NetworkIcons.js +10 -1
  19. package/dist/commonjs/components/Slider.d.ts +13 -0
  20. package/dist/commonjs/components/Slider.js +261 -0
  21. package/dist/commonjs/constants/version.d.ts +1 -1
  22. package/dist/commonjs/constants/version.js +1 -1
  23. package/dist/commonjs/customHooks/analyticsLogger.js +1 -1
  24. package/dist/commonjs/customHooks/crashHandler.js +1 -1
  25. package/dist/commonjs/helpers/index.d.ts +1 -0
  26. package/dist/commonjs/helpers/index.js +15 -0
  27. package/dist/commonjs/helpers/searchQueryParser.d.ts +6 -0
  28. package/dist/commonjs/helpers/searchQueryParser.js +236 -0
  29. package/dist/commonjs/helpers/settingsStore.js +13 -13
  30. package/dist/commonjs/index.js +7 -20
  31. package/dist/commonjs/styles/index.js +35 -35
  32. package/dist/esm/components/ConsoleLogCard.js +5 -5
  33. package/dist/esm/components/EndOfListFooter.js +2 -2
  34. package/dist/esm/components/Inspector/AnalyticsTab.js +21 -73
  35. package/dist/esm/components/Inspector/BundleTab.js +670 -188
  36. package/dist/esm/components/Inspector/ConsoleTab.js +110 -99
  37. package/dist/esm/components/Inspector/CrashTab.js +2 -1
  38. package/dist/esm/components/Inspector/InspectorHeader.js +103 -20
  39. package/dist/esm/components/Inspector/MainScreen.js +115 -18
  40. package/dist/esm/components/Inspector/NetworkTab.js +105 -21
  41. package/dist/esm/components/Inspector/SettingsPanel.js +1114 -1388
  42. package/dist/esm/components/Inspector/TabBar.js +4 -5
  43. package/dist/esm/components/JsonViewer.js +9 -4
  44. package/dist/esm/components/LogCard.js +32 -2
  45. package/dist/esm/components/LogSyntaxHighlighter.d.ts +16 -0
  46. package/dist/esm/components/LogSyntaxHighlighter.js +123 -0
  47. package/dist/esm/components/NetworkIcons.d.ts +2 -0
  48. package/dist/esm/components/NetworkIcons.js +7 -0
  49. package/dist/esm/components/Slider.d.ts +13 -0
  50. package/dist/esm/components/Slider.js +222 -0
  51. package/dist/esm/constants/version.d.ts +1 -1
  52. package/dist/esm/constants/version.js +1 -1
  53. package/dist/esm/customHooks/analyticsLogger.js +1 -1
  54. package/dist/esm/customHooks/crashHandler.js +1 -1
  55. package/dist/esm/helpers/index.d.ts +1 -0
  56. package/dist/esm/helpers/index.js +1 -0
  57. package/dist/esm/helpers/searchQueryParser.d.ts +6 -0
  58. package/dist/esm/helpers/searchQueryParser.js +233 -0
  59. package/dist/esm/helpers/settingsStore.js +13 -13
  60. package/dist/esm/index.js +8 -21
  61. package/dist/esm/styles/index.js +35 -35
  62. package/ios/NetworkInspectorModule.m +81 -41
  63. package/package.json +1 -1
@@ -177,11 +177,20 @@ static NSUncaughtExceptionHandler *previousUncaughtExceptionHandler = NULL;
177
177
 
178
178
  @end
179
179
 
180
+ @interface InAppInspectorFloatingView ()
181
+ @property (nonatomic, assign) CGPoint touchDownPoint;
182
+ @property (nonatomic, assign) CGPoint initialCenter;
183
+ @property (nonatomic, assign) NSTimeInterval touchDownTime;
184
+ @property (nonatomic, assign) BOOL isDragging;
185
+ @end
186
+
180
187
  @implementation InAppInspectorFloatingView
181
188
 
182
189
  - (instancetype)initWithFrame:(CGRect)frame {
183
190
  self = [super initWithFrame:frame];
184
191
  if (self) {
192
+ self.userInteractionEnabled = YES;
193
+ self.multipleTouchEnabled = NO;
185
194
  self.layer.cornerRadius = frame.size.width / 2.0;
186
195
  self.layer.masksToBounds = NO;
187
196
  self.backgroundColor = [UIColor colorWithRed:15.0/255.0 green:23.0/255.0 blue:42.0/255.0 alpha:0.95];
@@ -198,62 +207,87 @@ static NSUncaughtExceptionHandler *previousUncaughtExceptionHandler = NULL;
198
207
  CGFloat iconSize = frame.size.width * 0.94;
199
208
  CGFloat iconOffset = (frame.size.width - iconSize) / 2.0;
200
209
  InAppInspectorOwlView *owlView = [[InAppInspectorOwlView alloc] initWithFrame:CGRectMake(iconOffset, iconOffset, iconSize, iconSize)];
210
+ owlView.userInteractionEnabled = NO;
201
211
  [self addSubview:owlView];
202
-
203
- // Status dot badge
204
- _badgeDot = [[UIView alloc] initWithFrame:CGRectMake(frame.size.width - 14, 4, 10, 10)];
205
- _badgeDot.layer.cornerRadius = 5;
206
- _badgeDot.backgroundColor = [UIColor colorWithRed:34.0/255.0 green:197.0/255.0 blue:94.0/255.0 alpha:1.0];
207
- _badgeDot.layer.borderColor = [UIColor colorWithRed:15.0/255.0 green:23.0/255.0 blue:42.0/255.0 alpha:1.0].CGColor;
208
- _badgeDot.layer.borderWidth = 1.5;
209
- _badgeDot.hidden = YES;
210
- [self addSubview:_badgeDot];
211
-
212
- // Gestures (Main UI thread only)
213
- UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
214
- [self addGestureRecognizer:pan];
215
-
216
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
217
- [self addGestureRecognizer:tap];
218
-
219
- [tap requireGestureRecognizerToFail:pan];
220
212
  }
221
213
  return self;
222
214
  }
223
215
 
224
216
  - (void)updateBadgeVisible:(BOOL)visible {
225
- self.badgeDot.hidden = !visible;
217
+ // Active badge dot removed
226
218
  }
227
219
 
228
- - (void)handleTap:(UITapGestureRecognizer *)gesture {
229
- if (gesture.state == UIGestureRecognizerStateEnded) {
230
- if (self.onTapBlock) {
231
- self.onTapBlock();
232
- }
220
+ - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
221
+ UITouch *touch = [touches anyObject];
222
+ if (!touch) return;
223
+
224
+ if (self.superview) {
225
+ [self.superview bringSubviewToFront:self];
233
226
  }
227
+
228
+ self.touchDownPoint = [touch locationInView:self.window];
229
+ self.initialCenter = self.center;
230
+ self.touchDownTime = CACurrentMediaTime();
231
+ self.isDragging = NO;
232
+
233
+ [UIView animateWithDuration:0.08 animations:^{
234
+ self.transform = CGAffineTransformMakeScale(0.92, 0.92);
235
+ }];
234
236
  }
235
237
 
236
- - (void)handlePan:(UIPanGestureRecognizer *)pan {
238
+ - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
239
+ UITouch *touch = [touches anyObject];
237
240
  UIView *superview = self.superview;
238
- if (!superview) return;
241
+ if (!touch || !superview) return;
239
242
 
240
- CGPoint translation = [pan translationInView:superview];
241
- CGPoint newCenter = CGPointMake(self.center.x + translation.x, self.center.y + translation.y);
243
+ CGPoint currentPoint = [touch locationInView:self.window];
244
+ CGFloat dx = currentPoint.x - self.touchDownPoint.x;
245
+ CGFloat dy = currentPoint.y - self.touchDownPoint.y;
246
+ CGFloat distance = hypot(dx, dy);
242
247
 
243
- CGFloat halfW = self.bounds.size.width / 2.0;
244
- CGFloat halfH = self.bounds.size.height / 2.0;
245
- CGFloat minX = halfW + 10;
246
- CGFloat maxX = superview.bounds.size.width - halfW - 10;
247
- CGFloat minY = halfH + 44;
248
- CGFloat maxY = superview.bounds.size.height - halfH - 44;
248
+ if (!self.isDragging && distance > 14.0) {
249
+ self.isDragging = YES;
250
+ }
249
251
 
250
- newCenter.x = MAX(minX, MIN(maxX, newCenter.x));
251
- newCenter.y = MAX(minY, MIN(maxY, newCenter.y));
252
+ if (self.isDragging) {
253
+ CGFloat halfW = self.bounds.size.width / 2.0;
254
+ CGFloat halfH = self.bounds.size.height / 2.0;
255
+ CGFloat minX = halfW + 10.0;
256
+ CGFloat maxX = superview.bounds.size.width - halfW - 10.0;
257
+ CGFloat minY = halfH + 44.0;
258
+ CGFloat maxY = superview.bounds.size.height - halfH - 44.0;
259
+
260
+ CGPoint newCenter = CGPointMake(self.initialCenter.x + dx, self.initialCenter.y + dy);
261
+ newCenter.x = MAX(minX, MIN(maxX, newCenter.x));
262
+ newCenter.y = MAX(minY, MIN(maxY, newCenter.y));
263
+ self.center = newCenter;
264
+ }
265
+ }
266
+
267
+ - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
268
+ UITouch *touch = [touches anyObject];
269
+ UIView *superview = self.superview;
270
+
271
+ [UIView animateWithDuration:0.12 animations:^{
272
+ self.transform = CGAffineTransformIdentity;
273
+ }];
252
274
 
253
- self.center = newCenter;
254
- [pan setTranslation:CGPointZero inView:superview];
275
+ if (!touch || !superview) return;
255
276
 
256
- if (pan.state == UIGestureRecognizerStateEnded || pan.state == UIGestureRecognizerStateCancelled) {
277
+ CGPoint currentPoint = [touch locationInView:self.window];
278
+ CGFloat dx = currentPoint.x - self.touchDownPoint.x;
279
+ CGFloat dy = currentPoint.y - self.touchDownPoint.y;
280
+ CGFloat distance = hypot(dx, dy);
281
+ NSTimeInterval elapsed = CACurrentMediaTime() - self.touchDownTime;
282
+
283
+ if (!self.isDragging && distance < 24.0 && elapsed < 0.85) {
284
+ if (self.onTapBlock) {
285
+ self.onTapBlock();
286
+ }
287
+ } else if (self.isDragging) {
288
+ CGFloat halfW = self.bounds.size.width / 2.0;
289
+ CGFloat minX = halfW + 10.0;
290
+ CGFloat maxX = superview.bounds.size.width - halfW - 10.0;
257
291
  CGFloat targetX = (self.center.x < superview.bounds.size.width / 2.0) ? minX : maxX;
258
292
  [UIView animateWithDuration:0.25 delay:0 usingSpringWithDamping:0.75 initialSpringVelocity:0.5 options:UIViewAnimationOptionCurveEaseOut animations:^{
259
293
  self.center = CGPointMake(targetX, self.center.y);
@@ -261,6 +295,12 @@ static NSUncaughtExceptionHandler *previousUncaughtExceptionHandler = NULL;
261
295
  }
262
296
  }
263
297
 
298
+ - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
299
+ [UIView animateWithDuration:0.12 animations:^{
300
+ self.transform = CGAffineTransformIdentity;
301
+ }];
302
+ }
303
+
264
304
  @end
265
305
 
266
306
  static InAppInspectorFloatingView *floatingButtonView = nil;
@@ -521,8 +561,8 @@ RCT_EXPORT_METHOD(showFloatingButton:(NSDictionary *)options
521
561
  floatingButtonView = [[InAppInspectorFloatingView alloc] initWithFrame:CGRectMake(initialX, initialY, size, size)];
522
562
  __weak NetworkInspectorModule *weakSelf = self;
523
563
  floatingButtonView.onTapBlock = ^{
524
- NetworkInspectorModule *strongSelf = weakSelf;
525
- if (strongSelf && strongSelf->hasListeners) {
564
+ NetworkInspectorModule *strongSelf = weakSelf ?: sharedInstance;
565
+ if (strongSelf) {
526
566
  [strongSelf sendEventWithName:@"onFloatingButtonPress" body:@{}];
527
567
  }
528
568
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-inapp-inspector",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "The zero-config, all-in-one in-app debugger for React Native & Expo. Inspect Network (fetch/axios), Console logs, Stack Traces, Redux State, Firebase Analytics, and JS Bundle size directly on device.",
5
5
  "repository": {
6
6
  "type": "git",