react-native-inapp-inspector 2.0.0 → 2.0.2
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/README.md +10 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/9.2.0/checksums/checksums.lock +0 -0
- package/android/.gradle/9.2.0/fileChanges/last-build.bin +0 -0
- package/android/.gradle/9.2.0/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/9.2.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/9.2.0/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build/reports/problems/problems-report.html +659 -0
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +33 -24
- package/dist/commonjs/components/ConsoleLogCard.js +5 -5
- package/dist/commonjs/components/EndOfListFooter.js +1 -1
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +19 -71
- package/dist/commonjs/components/Inspector/BundleTab.js +670 -188
- package/dist/commonjs/components/Inspector/ConsoleTab.js +109 -98
- package/dist/commonjs/components/Inspector/CrashTab.js +2 -1
- package/dist/commonjs/components/Inspector/InspectorHeader.js +102 -19
- package/dist/commonjs/components/Inspector/MainScreen.js +151 -17
- package/dist/commonjs/components/Inspector/NetworkTab.js +104 -20
- package/dist/commonjs/components/Inspector/SettingsPanel.js +1111 -1385
- package/dist/commonjs/components/Inspector/TabBar.js +3 -4
- package/dist/commonjs/components/Inspector/TelemetryConsentModal.d.ts +3 -0
- package/dist/commonjs/components/Inspector/TelemetryConsentModal.js +212 -0
- package/dist/commonjs/components/JsonViewer.js +9 -4
- package/dist/commonjs/components/LogCard.js +31 -1
- package/dist/commonjs/components/LogSyntaxHighlighter.d.ts +16 -0
- package/dist/commonjs/components/LogSyntaxHighlighter.js +130 -0
- package/dist/commonjs/components/NetworkIcons.d.ts +2 -0
- package/dist/commonjs/components/NetworkIcons.js +10 -1
- package/dist/commonjs/components/Slider.d.ts +13 -0
- package/dist/commonjs/components/Slider.js +261 -0
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/analyticsLogger.js +1 -1
- package/dist/commonjs/customHooks/crashHandler.js +1 -1
- package/dist/commonjs/helpers/index.d.ts +2 -0
- package/dist/commonjs/helpers/index.js +16 -0
- package/dist/commonjs/helpers/searchQueryParser.d.ts +6 -0
- package/dist/commonjs/helpers/searchQueryParser.js +236 -0
- package/dist/commonjs/helpers/settingsStore.js +13 -13
- package/dist/commonjs/helpers/telemetry.d.ts +99 -0
- package/dist/commonjs/helpers/telemetry.js +398 -0
- package/dist/commonjs/index.d.ts +2 -0
- package/dist/commonjs/index.js +30 -21
- package/dist/commonjs/native/NativeInspector.d.ts +5 -0
- package/dist/commonjs/native/NativeInspector.js +3 -2
- package/dist/commonjs/styles/index.js +35 -35
- package/dist/esm/components/ConsoleLogCard.js +5 -5
- package/dist/esm/components/EndOfListFooter.js +2 -2
- package/dist/esm/components/Inspector/AnalyticsTab.js +21 -73
- package/dist/esm/components/Inspector/BundleTab.js +670 -188
- package/dist/esm/components/Inspector/ConsoleTab.js +110 -99
- package/dist/esm/components/Inspector/CrashTab.js +2 -1
- package/dist/esm/components/Inspector/InspectorHeader.js +103 -20
- package/dist/esm/components/Inspector/MainScreen.js +119 -18
- package/dist/esm/components/Inspector/NetworkTab.js +105 -21
- package/dist/esm/components/Inspector/SettingsPanel.js +1114 -1388
- package/dist/esm/components/Inspector/TabBar.js +4 -5
- package/dist/esm/components/Inspector/TelemetryConsentModal.d.ts +3 -0
- package/dist/esm/components/Inspector/TelemetryConsentModal.js +175 -0
- package/dist/esm/components/JsonViewer.js +9 -4
- package/dist/esm/components/LogCard.js +32 -2
- package/dist/esm/components/LogSyntaxHighlighter.d.ts +16 -0
- package/dist/esm/components/LogSyntaxHighlighter.js +123 -0
- package/dist/esm/components/NetworkIcons.d.ts +2 -0
- package/dist/esm/components/NetworkIcons.js +7 -0
- package/dist/esm/components/Slider.d.ts +13 -0
- package/dist/esm/components/Slider.js +222 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/analyticsLogger.js +1 -1
- package/dist/esm/customHooks/crashHandler.js +1 -1
- package/dist/esm/helpers/index.d.ts +2 -0
- package/dist/esm/helpers/index.js +2 -0
- package/dist/esm/helpers/searchQueryParser.d.ts +6 -0
- package/dist/esm/helpers/searchQueryParser.js +233 -0
- package/dist/esm/helpers/settingsStore.js +13 -13
- package/dist/esm/helpers/telemetry.d.ts +99 -0
- package/dist/esm/helpers/telemetry.js +380 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +20 -21
- package/dist/esm/native/NativeInspector.d.ts +5 -0
- package/dist/esm/native/NativeInspector.js +3 -2
- package/dist/esm/styles/index.js +35 -35
- package/ios/{NetworkInspectorModule.m → NetworkInspectorModule.mm} +193 -97
- package/package.json +2 -2
package/dist/esm/styles/index.js
CHANGED
|
@@ -7,10 +7,10 @@ export const getRawStyles = (colors) => ({
|
|
|
7
7
|
header: {
|
|
8
8
|
flexDirection: 'row',
|
|
9
9
|
alignItems: 'center',
|
|
10
|
-
paddingHorizontal:
|
|
11
|
-
paddingVertical:
|
|
10
|
+
paddingHorizontal: 10,
|
|
11
|
+
paddingVertical: 8,
|
|
12
12
|
zIndex: 10,
|
|
13
|
-
minHeight:
|
|
13
|
+
minHeight: 52,
|
|
14
14
|
shadowColor: colors.black,
|
|
15
15
|
shadowOffset: { width: 0, height: 2 },
|
|
16
16
|
shadowOpacity: 0.08,
|
|
@@ -34,7 +34,7 @@ export const getRawStyles = (colors) => ({
|
|
|
34
34
|
flexDirection: 'row',
|
|
35
35
|
alignItems: 'center',
|
|
36
36
|
justifyContent: 'flex-end',
|
|
37
|
-
gap:
|
|
37
|
+
gap: 5,
|
|
38
38
|
},
|
|
39
39
|
headerTitle: {
|
|
40
40
|
fontFamily: AppFonts.interBold,
|
|
@@ -136,7 +136,7 @@ export const getRawStyles = (colors) => ({
|
|
|
136
136
|
fontSize: 12,
|
|
137
137
|
letterSpacing: 0.2,
|
|
138
138
|
},
|
|
139
|
-
listContent: { paddingBottom:
|
|
139
|
+
listContent: { paddingBottom: Platform.OS === 'ios' ? 44 : 32 },
|
|
140
140
|
// #2 — scroll-to-top button, always shown at the bottom right.
|
|
141
141
|
scrollTopBtn: {
|
|
142
142
|
position: 'absolute',
|
|
@@ -157,9 +157,9 @@ export const getRawStyles = (colors) => ({
|
|
|
157
157
|
},
|
|
158
158
|
detailScroll: { flex: 1 },
|
|
159
159
|
closeButtonSquare: {
|
|
160
|
-
width:
|
|
161
|
-
height:
|
|
162
|
-
borderRadius:
|
|
160
|
+
width: 30,
|
|
161
|
+
height: 30,
|
|
162
|
+
borderRadius: 7,
|
|
163
163
|
backgroundColor: `${colors.white}2B`,
|
|
164
164
|
alignItems: 'center',
|
|
165
165
|
justifyContent: 'center',
|
|
@@ -378,12 +378,12 @@ export const getRawStyles = (colors) => ({
|
|
|
378
378
|
},
|
|
379
379
|
clearBtn: { padding: 4 },
|
|
380
380
|
domainHeaderCard: {
|
|
381
|
-
marginHorizontal:
|
|
382
|
-
marginTop:
|
|
381
|
+
marginHorizontal: 8,
|
|
382
|
+
marginTop: 10,
|
|
383
383
|
marginBottom: 4,
|
|
384
|
-
paddingHorizontal:
|
|
385
|
-
paddingVertical:
|
|
386
|
-
borderRadius:
|
|
384
|
+
paddingHorizontal: 8,
|
|
385
|
+
paddingVertical: 7,
|
|
386
|
+
borderRadius: 9,
|
|
387
387
|
backgroundColor: colors.grayBackground,
|
|
388
388
|
borderWidth: 1,
|
|
389
389
|
borderColor: colors.grayBorderSecondary,
|
|
@@ -405,18 +405,18 @@ export const getRawStyles = (colors) => ({
|
|
|
405
405
|
flex: 1,
|
|
406
406
|
minWidth: 0,
|
|
407
407
|
marginRight: 6,
|
|
408
|
-
gap:
|
|
408
|
+
gap: 6,
|
|
409
409
|
},
|
|
410
410
|
domainIconWrap: {
|
|
411
|
-
width:
|
|
412
|
-
height:
|
|
413
|
-
borderRadius:
|
|
411
|
+
width: 22,
|
|
412
|
+
height: 22,
|
|
413
|
+
borderRadius: 5,
|
|
414
414
|
alignItems: 'center',
|
|
415
415
|
justifyContent: 'center',
|
|
416
416
|
},
|
|
417
417
|
domainTitleText: {
|
|
418
418
|
fontFamily: AppFonts.interBold,
|
|
419
|
-
fontSize: 13
|
|
419
|
+
fontSize: 13,
|
|
420
420
|
fontWeight: '700',
|
|
421
421
|
color: colors.primaryBlack,
|
|
422
422
|
textTransform: 'capitalize',
|
|
@@ -478,23 +478,23 @@ export const getRawStyles = (colors) => ({
|
|
|
478
478
|
flexDirection: 'row',
|
|
479
479
|
alignItems: 'center',
|
|
480
480
|
gap: 3,
|
|
481
|
-
paddingHorizontal:
|
|
482
|
-
paddingVertical:
|
|
483
|
-
borderRadius:
|
|
481
|
+
paddingHorizontal: 5,
|
|
482
|
+
paddingVertical: 2.5,
|
|
483
|
+
borderRadius: 5,
|
|
484
484
|
borderWidth: 1,
|
|
485
485
|
borderColor: colors.grayBorderSecondary,
|
|
486
486
|
backgroundColor: colors.primaryLight,
|
|
487
487
|
},
|
|
488
488
|
domainStatText: {
|
|
489
489
|
fontFamily: AppFonts.interBold,
|
|
490
|
-
fontSize:
|
|
490
|
+
fontSize: 9.5,
|
|
491
491
|
},
|
|
492
492
|
treeNodeRow: {
|
|
493
493
|
flexDirection: 'row',
|
|
494
494
|
alignItems: 'stretch',
|
|
495
|
-
marginHorizontal:
|
|
496
|
-
paddingRight:
|
|
497
|
-
paddingLeft:
|
|
495
|
+
marginHorizontal: 8,
|
|
496
|
+
paddingRight: 4,
|
|
497
|
+
paddingLeft: 0,
|
|
498
498
|
backgroundColor: colors.grayBackground,
|
|
499
499
|
borderLeftWidth: 1,
|
|
500
500
|
borderRightWidth: 1,
|
|
@@ -508,14 +508,14 @@ export const getRawStyles = (colors) => ({
|
|
|
508
508
|
paddingBottom: 6,
|
|
509
509
|
},
|
|
510
510
|
treeLines: {
|
|
511
|
-
width:
|
|
511
|
+
width: 14,
|
|
512
512
|
position: 'relative',
|
|
513
513
|
},
|
|
514
514
|
modernTreeLine: {
|
|
515
515
|
position: 'absolute',
|
|
516
|
-
left:
|
|
516
|
+
left: 7,
|
|
517
517
|
top: 0,
|
|
518
|
-
width:
|
|
518
|
+
width: 7,
|
|
519
519
|
height: '100%',
|
|
520
520
|
borderLeftWidth: 1.5,
|
|
521
521
|
opacity: 0.5,
|
|
@@ -523,19 +523,19 @@ export const getRawStyles = (colors) => ({
|
|
|
523
523
|
modernTreeLineLast: {
|
|
524
524
|
height: '50%',
|
|
525
525
|
borderBottomWidth: 1.5,
|
|
526
|
-
borderBottomLeftRadius:
|
|
526
|
+
borderBottomLeftRadius: 8,
|
|
527
527
|
},
|
|
528
528
|
modernTreeBranch: {
|
|
529
529
|
position: 'absolute',
|
|
530
|
-
left:
|
|
530
|
+
left: 7,
|
|
531
531
|
top: '50%',
|
|
532
|
-
width:
|
|
532
|
+
width: 7,
|
|
533
533
|
borderTopWidth: 1.5,
|
|
534
534
|
opacity: 0.5,
|
|
535
535
|
},
|
|
536
536
|
treeCardWrapper: {
|
|
537
537
|
flex: 1,
|
|
538
|
-
paddingVertical: 3
|
|
538
|
+
paddingVertical: 3,
|
|
539
539
|
},
|
|
540
540
|
card: {
|
|
541
541
|
marginHorizontal: 0,
|
|
@@ -575,10 +575,10 @@ export const getRawStyles = (colors) => ({
|
|
|
575
575
|
gap: 5,
|
|
576
576
|
},
|
|
577
577
|
smallCheckbox: {
|
|
578
|
-
width:
|
|
579
|
-
height:
|
|
578
|
+
width: 15,
|
|
579
|
+
height: 15,
|
|
580
580
|
borderRadius: 4,
|
|
581
|
-
borderWidth: 1.
|
|
581
|
+
borderWidth: 1.8,
|
|
582
582
|
borderColor: colors.grayTextWeak,
|
|
583
583
|
alignItems: 'center',
|
|
584
584
|
justifyContent: 'center',
|
|
@@ -21,6 +21,8 @@ static NSUncaughtExceptionHandler *previousUncaughtExceptionHandler = NULL;
|
|
|
21
21
|
if (self = [super initWithFrame:frame]) {
|
|
22
22
|
self.backgroundColor = [UIColor clearColor];
|
|
23
23
|
self.userInteractionEnabled = NO;
|
|
24
|
+
self.contentMode = UIViewContentModeRedraw;
|
|
25
|
+
self.clipsToBounds = NO;
|
|
24
26
|
}
|
|
25
27
|
return self;
|
|
26
28
|
}
|
|
@@ -177,11 +179,18 @@ static NSUncaughtExceptionHandler *previousUncaughtExceptionHandler = NULL;
|
|
|
177
179
|
|
|
178
180
|
@end
|
|
179
181
|
|
|
182
|
+
@interface InAppInspectorFloatingView () <UIGestureRecognizerDelegate>
|
|
183
|
+
@property (nonatomic, assign) CGPoint panStartCenter;
|
|
184
|
+
@property (nonatomic, assign) NSTimeInterval lastTapTime;
|
|
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];
|
|
@@ -194,66 +203,103 @@ static NSUncaughtExceptionHandler *previousUncaughtExceptionHandler = NULL;
|
|
|
194
203
|
self.layer.borderWidth = 2.2;
|
|
195
204
|
self.layer.borderColor = [UIColor colorWithRed:56.0/255.0 green:189.0/255.0 blue:248.0/255.0 alpha:0.9].CGColor;
|
|
196
205
|
|
|
197
|
-
// Native drawn Inspector Owl icon
|
|
206
|
+
// Native drawn Inspector Owl icon
|
|
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
212
|
|
|
203
|
-
//
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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:)];
|
|
213
|
+
// Dedicated Tap Gesture Recognizer
|
|
214
|
+
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
|
|
215
|
+
tap.numberOfTapsRequired = 1;
|
|
216
|
+
tap.cancelsTouchesInView = NO;
|
|
217
|
+
tap.delegate = self;
|
|
217
218
|
[self addGestureRecognizer:tap];
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
|
|
220
|
+
// Dedicated Pan Gesture Recognizer
|
|
221
|
+
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)];
|
|
222
|
+
pan.delegate = self;
|
|
223
|
+
[self addGestureRecognizer:pan];
|
|
220
224
|
}
|
|
221
225
|
return self;
|
|
222
226
|
}
|
|
223
227
|
|
|
228
|
+
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
|
229
|
+
if (!self.userInteractionEnabled || self.hidden || self.alpha < 0.01) {
|
|
230
|
+
return nil;
|
|
231
|
+
}
|
|
232
|
+
if (CGRectContainsPoint(self.bounds, point)) {
|
|
233
|
+
return self;
|
|
234
|
+
}
|
|
235
|
+
return [super hitTest:point withEvent:event];
|
|
236
|
+
}
|
|
237
|
+
|
|
224
238
|
- (void)updateBadgeVisible:(BOOL)visible {
|
|
225
|
-
|
|
239
|
+
// Active badge dot
|
|
226
240
|
}
|
|
227
241
|
|
|
228
|
-
- (void)
|
|
242
|
+
- (void)handleTapGesture:(UITapGestureRecognizer *)gesture {
|
|
229
243
|
if (gesture.state == UIGestureRecognizerStateEnded) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
244
|
+
[self triggerTapAction];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
- (void)triggerTapAction {
|
|
249
|
+
NSTimeInterval now = CACurrentMediaTime();
|
|
250
|
+
if (now - self.lastTapTime < 0.35) return;
|
|
251
|
+
self.lastTapTime = now;
|
|
252
|
+
|
|
253
|
+
if (@available(iOS 10.0, *)) {
|
|
254
|
+
UIImpactFeedbackGenerator *impact = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium];
|
|
255
|
+
[impact prepare];
|
|
256
|
+
[impact impactOccurred];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
[UIView animateWithDuration:0.08 animations:^{
|
|
260
|
+
self.transform = CGAffineTransformMakeScale(0.90, 0.90);
|
|
261
|
+
} completion:^(BOOL finished) {
|
|
262
|
+
[UIView animateWithDuration:0.10 animations:^{
|
|
263
|
+
self.transform = CGAffineTransformIdentity;
|
|
264
|
+
}];
|
|
265
|
+
}];
|
|
266
|
+
|
|
267
|
+
if (self.onTapBlock) {
|
|
268
|
+
self.onTapBlock();
|
|
233
269
|
}
|
|
234
270
|
}
|
|
235
271
|
|
|
236
|
-
- (void)
|
|
272
|
+
- (void)handlePanGesture:(UIPanGestureRecognizer *)pan {
|
|
237
273
|
UIView *superview = self.superview;
|
|
238
274
|
if (!superview) return;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
275
|
+
|
|
276
|
+
if (pan.state == UIGestureRecognizerStateBegan) {
|
|
277
|
+
self.panStartCenter = self.center;
|
|
278
|
+
[superview bringSubviewToFront:self];
|
|
279
|
+
[UIView animateWithDuration:0.1 animations:^{
|
|
280
|
+
self.transform = CGAffineTransformMakeScale(1.06, 1.06);
|
|
281
|
+
}];
|
|
282
|
+
} else if (pan.state == UIGestureRecognizerStateChanged) {
|
|
283
|
+
CGPoint translation = [pan translationInView:superview];
|
|
284
|
+
CGFloat halfW = self.bounds.size.width / 2.0;
|
|
285
|
+
CGFloat halfH = self.bounds.size.height / 2.0;
|
|
286
|
+
CGFloat minX = halfW + 10.0;
|
|
287
|
+
CGFloat maxX = superview.bounds.size.width - halfW - 10.0;
|
|
288
|
+
CGFloat minY = halfH + 44.0;
|
|
289
|
+
CGFloat maxY = superview.bounds.size.height - halfH - 44.0;
|
|
290
|
+
|
|
291
|
+
CGPoint newCenter = CGPointMake(self.panStartCenter.x + translation.x, self.panStartCenter.y + translation.y);
|
|
292
|
+
newCenter.x = MAX(minX, MIN(maxX, newCenter.x));
|
|
293
|
+
newCenter.y = MAX(minY, MIN(maxY, newCenter.y));
|
|
294
|
+
self.center = newCenter;
|
|
295
|
+
} else if (pan.state == UIGestureRecognizerStateEnded || pan.state == UIGestureRecognizerStateCancelled) {
|
|
296
|
+
[UIView animateWithDuration:0.15 animations:^{
|
|
297
|
+
self.transform = CGAffineTransformIdentity;
|
|
298
|
+
}];
|
|
299
|
+
|
|
300
|
+
CGFloat halfW = self.bounds.size.width / 2.0;
|
|
301
|
+
CGFloat minX = halfW + 10.0;
|
|
302
|
+
CGFloat maxX = superview.bounds.size.width - halfW - 10.0;
|
|
257
303
|
CGFloat targetX = (self.center.x < superview.bounds.size.width / 2.0) ? minX : maxX;
|
|
258
304
|
[UIView animateWithDuration:0.25 delay:0 usingSpringWithDamping:0.75 initialSpringVelocity:0.5 options:UIViewAnimationOptionCurveEaseOut animations:^{
|
|
259
305
|
self.center = CGPointMake(targetX, self.center.y);
|
|
@@ -411,13 +457,13 @@ RCT_EXPORT_MODULE(NetworkInspectorModule);
|
|
|
411
457
|
}
|
|
412
458
|
|
|
413
459
|
RCT_EXPORT_METHOD(enableNativeCrashProtection:(RCTPromiseResolveBlock)resolve
|
|
414
|
-
|
|
460
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
415
461
|
[self installHandlers];
|
|
416
462
|
resolve(@(YES));
|
|
417
463
|
}
|
|
418
464
|
|
|
419
465
|
RCT_EXPORT_METHOD(getDeviceMetrics:(RCTPromiseResolveBlock)resolve
|
|
420
|
-
|
|
466
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
421
467
|
NSMutableDictionary *metrics = [NSMutableDictionary dictionary];
|
|
422
468
|
|
|
423
469
|
// 1. Memory / RAM Metrics
|
|
@@ -470,46 +516,66 @@ RCT_EXPORT_METHOD(getDeviceMetrics:(RCTPromiseResolveBlock)resolve
|
|
|
470
516
|
[metrics setObject:[UIDevice currentDevice].systemVersion forKey:@"osVersion"];
|
|
471
517
|
[metrics setObject:@"arm64" forKey:@"cpuAbi"];
|
|
472
518
|
|
|
519
|
+
// 5. Application Identifiers (Legal & Non-PII)
|
|
520
|
+
NSBundle *mainBundle = [NSBundle mainBundle];
|
|
521
|
+
NSString *appName = [mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"] ?: [mainBundle objectForInfoDictionaryKey:@"CFBundleName"];
|
|
522
|
+
NSString *appVersion = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
|
523
|
+
NSString *appBuild = [mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"];
|
|
524
|
+
NSString *appBundleId = [mainBundle bundleIdentifier];
|
|
525
|
+
if (appName) [metrics setObject:appName forKey:@"appName"];
|
|
526
|
+
if (appVersion) [metrics setObject:appVersion forKey:@"appVersion"];
|
|
527
|
+
if (appBuild) [metrics setObject:appBuild forKey:@"appBuild"];
|
|
528
|
+
if (appBundleId) {
|
|
529
|
+
[metrics setObject:appBundleId forKey:@"appBundleId"];
|
|
530
|
+
[metrics setObject:appBundleId forKey:@"appPackageName"];
|
|
531
|
+
}
|
|
532
|
+
|
|
473
533
|
resolve(metrics);
|
|
474
534
|
}
|
|
475
535
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
for (UIWindow *w in scene.windows) {
|
|
485
|
-
if (w.isKeyWindow) {
|
|
486
|
-
targetWindow = w;
|
|
487
|
-
break;
|
|
488
|
-
}
|
|
536
|
+
static UIWindow *GetAppActiveWindow(void) {
|
|
537
|
+
if (@available(iOS 13.0, *)) {
|
|
538
|
+
for (UIScene *scene in [UIApplication sharedApplication].connectedScenes) {
|
|
539
|
+
if ([scene isKindOfClass:[UIWindowScene class]]) {
|
|
540
|
+
UIWindowScene *ws = (UIWindowScene *)scene;
|
|
541
|
+
for (UIWindow *w in ws.windows) {
|
|
542
|
+
if (w.isKeyWindow || w.windowLevel == UIWindowLevelNormal) {
|
|
543
|
+
return w;
|
|
489
544
|
}
|
|
490
545
|
}
|
|
491
|
-
if (
|
|
546
|
+
if (ws.windows.count > 0) {
|
|
547
|
+
return ws.windows.firstObject;
|
|
548
|
+
}
|
|
492
549
|
}
|
|
493
550
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
}
|
|
551
|
+
}
|
|
552
|
+
for (UIWindow *w in [UIApplication sharedApplication].windows) {
|
|
553
|
+
if (w.isKeyWindow || w.windowLevel == UIWindowLevelNormal) {
|
|
554
|
+
return w;
|
|
499
555
|
}
|
|
556
|
+
}
|
|
557
|
+
return [UIApplication sharedApplication].windows.firstObject;
|
|
558
|
+
}
|
|
500
559
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
560
|
+
RCT_EXPORT_METHOD(showFloatingButton:(NSDictionary *)options
|
|
561
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
562
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
563
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
564
|
+
UIWindow *targetWindow = GetAppActiveWindow();
|
|
565
|
+
CGRect screenBounds = targetWindow ? targetWindow.bounds : [UIScreen mainScreen].bounds;
|
|
566
|
+
|
|
567
|
+
CGFloat screenWidth = screenBounds.size.width > 0 ? screenBounds.size.width : [UIScreen mainScreen].bounds.size.width;
|
|
568
|
+
if (screenWidth <= 0) screenWidth = 393.0;
|
|
569
|
+
CGFloat screenHeight = screenBounds.size.height > 0 ? screenBounds.size.height : [UIScreen mainScreen].bounds.size.height;
|
|
570
|
+
if (screenHeight <= 0) screenHeight = 852.0;
|
|
505
571
|
|
|
506
572
|
CGFloat size = 64.0;
|
|
507
573
|
if (options && options[@"size"]) {
|
|
508
574
|
size = [options[@"size"] doubleValue];
|
|
509
575
|
}
|
|
510
576
|
|
|
511
|
-
CGFloat initialX =
|
|
512
|
-
CGFloat initialY =
|
|
577
|
+
CGFloat initialX = screenWidth - size - 20.0;
|
|
578
|
+
CGFloat initialY = screenHeight - size - 120.0;
|
|
513
579
|
if (options && options[@"x"]) {
|
|
514
580
|
initialX = [options[@"x"] doubleValue];
|
|
515
581
|
}
|
|
@@ -519,33 +585,55 @@ RCT_EXPORT_METHOD(showFloatingButton:(NSDictionary *)options
|
|
|
519
585
|
|
|
520
586
|
if (floatingButtonView == nil) {
|
|
521
587
|
floatingButtonView = [[InAppInspectorFloatingView alloc] initWithFrame:CGRectMake(initialX, initialY, size, size)];
|
|
588
|
+
floatingButtonView.layer.zPosition = 999999;
|
|
522
589
|
__weak NetworkInspectorModule *weakSelf = self;
|
|
523
590
|
floatingButtonView.onTapBlock = ^{
|
|
524
|
-
NetworkInspectorModule *strongSelf = weakSelf;
|
|
525
|
-
if (strongSelf
|
|
591
|
+
NetworkInspectorModule *strongSelf = weakSelf ?: sharedInstance;
|
|
592
|
+
if (strongSelf) {
|
|
526
593
|
[strongSelf sendEventWithName:@"onFloatingButtonPress" body:@{}];
|
|
527
594
|
}
|
|
528
595
|
};
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
if (floatingButtonView.superview == nil) {
|
|
532
|
-
[targetWindow addSubview:floatingButtonView];
|
|
533
596
|
} else {
|
|
534
|
-
|
|
597
|
+
floatingButtonView.layer.zPosition = 999999;
|
|
598
|
+
floatingButtonView.frame = CGRectMake(initialX, initialY, size, size);
|
|
535
599
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
600
|
+
|
|
601
|
+
void (^attachToWindow)(void) = ^{
|
|
602
|
+
UIWindow *activeWin = GetAppActiveWindow();
|
|
603
|
+
if (!activeWin || !floatingButtonView) return;
|
|
604
|
+
|
|
605
|
+
CGRect winBounds = activeWin.bounds;
|
|
606
|
+
if (winBounds.size.width > 0 && winBounds.size.height > 0) {
|
|
607
|
+
CGRect curFrame = floatingButtonView.frame;
|
|
608
|
+
if (curFrame.origin.x <= 0 || curFrame.origin.x >= winBounds.size.width ||
|
|
609
|
+
curFrame.origin.y <= 0 || curFrame.origin.y >= winBounds.size.height) {
|
|
610
|
+
floatingButtonView.frame = CGRectMake(winBounds.size.width - curFrame.size.width - 20.0,
|
|
611
|
+
winBounds.size.height - curFrame.size.height - 120.0,
|
|
612
|
+
curFrame.size.width,
|
|
613
|
+
curFrame.size.height);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (floatingButtonView.superview != activeWin) {
|
|
618
|
+
[activeWin addSubview:floatingButtonView];
|
|
619
|
+
}
|
|
620
|
+
[activeWin bringSubviewToFront:floatingButtonView];
|
|
621
|
+
floatingButtonView.hidden = NO;
|
|
540
622
|
floatingButtonView.alpha = 1.0;
|
|
541
|
-
|
|
623
|
+
[floatingButtonView.subviews.firstObject setNeedsDisplay];
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
attachToWindow();
|
|
627
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), attachToWindow);
|
|
628
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.8 * NSEC_PER_SEC)), dispatch_get_main_queue(), attachToWindow);
|
|
629
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), attachToWindow);
|
|
542
630
|
|
|
543
631
|
resolve(@(YES));
|
|
544
632
|
});
|
|
545
633
|
}
|
|
546
634
|
|
|
547
635
|
RCT_EXPORT_METHOD(hideFloatingButton:(RCTPromiseResolveBlock)resolve
|
|
548
|
-
|
|
636
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
549
637
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
550
638
|
if (floatingButtonView != nil) {
|
|
551
639
|
[UIView animateWithDuration:0.15 animations:^{
|
|
@@ -559,8 +647,8 @@ RCT_EXPORT_METHOD(hideFloatingButton:(RCTPromiseResolveBlock)resolve
|
|
|
559
647
|
}
|
|
560
648
|
|
|
561
649
|
RCT_EXPORT_METHOD(setFloatingButtonBadge:(BOOL)hasBadge
|
|
562
|
-
|
|
563
|
-
|
|
650
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
651
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
564
652
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
565
653
|
if (floatingButtonView != nil) {
|
|
566
654
|
[floatingButtonView updateBadgeVisible:hasBadge];
|
|
@@ -570,8 +658,8 @@ RCT_EXPORT_METHOD(setFloatingButtonBadge:(BOOL)hasBadge
|
|
|
570
658
|
}
|
|
571
659
|
|
|
572
660
|
RCT_EXPORT_METHOD(setFloatingButtonPosition:(double)x y:(double)y
|
|
573
|
-
|
|
574
|
-
|
|
661
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
662
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
575
663
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
576
664
|
if (floatingButtonView != nil && floatingButtonView.superview != nil) {
|
|
577
665
|
floatingButtonView.frame = CGRectMake(x, y, floatingButtonView.frame.size.width, floatingButtonView.frame.size.height);
|
|
@@ -581,7 +669,7 @@ RCT_EXPORT_METHOD(setFloatingButtonPosition:(double)x y:(double)y
|
|
|
581
669
|
}
|
|
582
670
|
|
|
583
671
|
RCT_EXPORT_METHOD(startFpsMonitoring:(RCTPromiseResolveBlock)resolve
|
|
584
|
-
|
|
672
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
585
673
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
586
674
|
if (self->displayLink == nil) {
|
|
587
675
|
self->lastFpsTimestamp = 0;
|
|
@@ -609,7 +697,7 @@ RCT_EXPORT_METHOD(startFpsMonitoring:(RCTPromiseResolveBlock)resolve
|
|
|
609
697
|
}
|
|
610
698
|
|
|
611
699
|
RCT_EXPORT_METHOD(stopFpsMonitoring:(RCTPromiseResolveBlock)resolve
|
|
612
|
-
|
|
700
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
613
701
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
614
702
|
if (self->displayLink != nil) {
|
|
615
703
|
[self->displayLink invalidate];
|
|
@@ -620,7 +708,7 @@ RCT_EXPORT_METHOD(stopFpsMonitoring:(RCTPromiseResolveBlock)resolve
|
|
|
620
708
|
}
|
|
621
709
|
|
|
622
710
|
RCT_EXPORT_METHOD(getFpsMetrics:(RCTPromiseResolveBlock)resolve
|
|
623
|
-
|
|
711
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
624
712
|
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
|
625
713
|
[dict setObject:@(self->currentCalculatedFps > 0 ? self->currentCalculatedFps : 60.0) forKey:@"fps"];
|
|
626
714
|
[dict setObject:@(60.0) forKey:@"targetFps"];
|
|
@@ -628,8 +716,8 @@ RCT_EXPORT_METHOD(getFpsMetrics:(RCTPromiseResolveBlock)resolve
|
|
|
628
716
|
}
|
|
629
717
|
|
|
630
718
|
RCT_EXPORT_METHOD(getNativeStorageItem:(NSString *)key
|
|
631
|
-
|
|
632
|
-
|
|
719
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
720
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
633
721
|
NSString *prefKey = [NSString stringWithFormat:@"inapp_inspector_%@", key ?: @""];
|
|
634
722
|
NSString *val = [[NSUserDefaults standardUserDefaults] stringForKey:prefKey];
|
|
635
723
|
resolve(val ?: [NSNull null]);
|
|
@@ -637,8 +725,8 @@ RCT_EXPORT_METHOD(getNativeStorageItem:(NSString *)key
|
|
|
637
725
|
|
|
638
726
|
RCT_EXPORT_METHOD(setNativeStorageItem:(NSString *)key
|
|
639
727
|
value:(NSString *)value
|
|
640
|
-
|
|
641
|
-
|
|
728
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
729
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
642
730
|
NSString *prefKey = [NSString stringWithFormat:@"inapp_inspector_%@", key ?: @""];
|
|
643
731
|
if (value == nil || [value isKindOfClass:[NSNull class]]) {
|
|
644
732
|
[[NSUserDefaults standardUserDefaults] removeObjectForKey:prefKey];
|
|
@@ -650,8 +738,8 @@ RCT_EXPORT_METHOD(setNativeStorageItem:(NSString *)key
|
|
|
650
738
|
}
|
|
651
739
|
|
|
652
740
|
RCT_EXPORT_METHOD(triggerHaptic:(NSString *)style
|
|
653
|
-
|
|
654
|
-
|
|
741
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
742
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
655
743
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
656
744
|
if (@available(iOS 10.0, *)) {
|
|
657
745
|
NSString *s = [style lowercaseString] ?: @"light";
|
|
@@ -685,8 +773,16 @@ RCT_EXPORT_METHOD(triggerHaptic:(NSString *)style
|
|
|
685
773
|
});
|
|
686
774
|
}
|
|
687
775
|
|
|
776
|
+
RCT_EXPORT_METHOD(addListener:(NSString *)eventName) {
|
|
777
|
+
[super addListener:eventName];
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
RCT_EXPORT_METHOD(removeListeners:(double)count) {
|
|
781
|
+
[super removeListeners:count];
|
|
782
|
+
}
|
|
783
|
+
|
|
688
784
|
RCT_EXPORT_METHOD(getNativeSystemMetrics:(RCTPromiseResolveBlock)resolve
|
|
689
|
-
|
|
785
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
690
786
|
dispatch_async(self->_metricsQueue, ^{
|
|
691
787
|
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
|
692
788
|
|
|
@@ -773,8 +869,8 @@ RCT_EXPORT_METHOD(pushNativeLogRecord:(NSString *)pageKey
|
|
|
773
869
|
}
|
|
774
870
|
|
|
775
871
|
RCT_EXPORT_METHOD(getNativeCachedPage:(NSString *)pageKey
|
|
776
|
-
offset:(
|
|
777
|
-
limit:(
|
|
872
|
+
offset:(double)offset
|
|
873
|
+
limit:(double)limit
|
|
778
874
|
query:(NSString *)query
|
|
779
875
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
780
876
|
reject:(RCTPromiseRejectBlock)reject) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-inapp-inspector",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"scripts": {
|
|
44
44
|
"clean": "rm -rf dist",
|
|
45
45
|
"prebuild": "node scripts/gen-version.js",
|
|
46
|
-
"build": "npm run clean && tsc && tsc -p tsconfig.esm.json",
|
|
46
|
+
"build": "npm run clean && tsc && tsc -p tsconfig.esm.json && node scripts/inject-telemetry.js",
|
|
47
47
|
"watch": "tsc -w",
|
|
48
48
|
"prepack": "npm run build",
|
|
49
49
|
"publish": "node release.cjs",
|