react-native-inapp-inspector 2.2.7 → 2.2.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/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +22 -7
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/native/NativeInspector.js +13 -0
- package/dist/commonjs/native/NativeNetworkInspector.d.ts +1 -1
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/native/NativeInspector.js +13 -0
- package/dist/esm/native/NativeNetworkInspector.d.ts +1 -1
- package/ios/NetworkInspectorModule.mm +11 -1
- package/package.json +1 -1
- package/src/constants/version.ts +1 -1
- package/src/native/NativeInspector.ts +13 -0
- package/src/native/NativeNetworkInspector.ts +1 -1
|
@@ -206,12 +206,16 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
private var floatingButton: InAppInspectorFloatingView? = null
|
|
209
|
+
@Volatile private var floatingButtonPressed: Boolean = false
|
|
209
210
|
|
|
210
211
|
private fun emitFloatingButtonPress() {
|
|
212
|
+
floatingButtonPressed = true
|
|
211
213
|
if (reactContext.hasActiveReactInstance()) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
try {
|
|
215
|
+
reactContext
|
|
216
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
217
|
+
.emit("onFloatingButtonPress", null)
|
|
218
|
+
} catch (e: Exception) {}
|
|
215
219
|
}
|
|
216
220
|
}
|
|
217
221
|
|
|
@@ -313,13 +317,24 @@ class NetworkInspectorModule(private val reactContext: ReactApplicationContext)
|
|
|
313
317
|
}
|
|
314
318
|
|
|
315
319
|
activity.runOnUiThread {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
+
try {
|
|
321
|
+
val density = activity.resources.displayMetrics.density
|
|
322
|
+
floatingButton?.x = (x * density).toFloat()
|
|
323
|
+
floatingButton?.y = (y * density).toFloat()
|
|
324
|
+
promise.resolve(true)
|
|
325
|
+
} catch (e: Exception) {
|
|
326
|
+
promise.reject("FLOATING_BTN_ERROR", e.message, e)
|
|
327
|
+
}
|
|
320
328
|
}
|
|
321
329
|
}
|
|
322
330
|
|
|
331
|
+
@ReactMethod
|
|
332
|
+
fun checkFloatingButtonPress(promise: Promise) {
|
|
333
|
+
val pressed = floatingButtonPressed
|
|
334
|
+
floatingButtonPressed = false
|
|
335
|
+
promise.resolve(pressed)
|
|
336
|
+
}
|
|
337
|
+
|
|
323
338
|
private var sensorManager: android.hardware.SensorManager? = null
|
|
324
339
|
private var lastShakeTime = 0L
|
|
325
340
|
private var isFpsMonitoring = false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "2.2.
|
|
1
|
+
export declare const LIB_VERSION = "2.2.9";
|
|
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LIB_VERSION = void 0;
|
|
4
4
|
// AUTO-GENERATED FILE — do not edit by hand.
|
|
5
5
|
// Regenerated from package.json on every build by scripts/gen-version.js.
|
|
6
|
-
exports.LIB_VERSION = '2.2.
|
|
6
|
+
exports.LIB_VERSION = '2.2.9';
|
|
@@ -151,6 +151,19 @@ const subscribeNativeFloatingButtonPress = (callback) => {
|
|
|
151
151
|
}
|
|
152
152
|
catch (e) { }
|
|
153
153
|
}
|
|
154
|
+
// Active Bridgeless / TurboModule tap detection
|
|
155
|
+
const interval = setInterval(async () => {
|
|
156
|
+
if (NativeModule && NativeModule.checkFloatingButtonPress) {
|
|
157
|
+
try {
|
|
158
|
+
const pressed = await NativeModule.checkFloatingButtonPress();
|
|
159
|
+
if (pressed) {
|
|
160
|
+
callback();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch (e) { }
|
|
164
|
+
}
|
|
165
|
+
}, 180);
|
|
166
|
+
cleanups.push(() => clearInterval(interval));
|
|
154
167
|
return () => {
|
|
155
168
|
cleanups.forEach(fn => {
|
|
156
169
|
try {
|
|
@@ -14,7 +14,7 @@ export interface Spec extends TurboModule {
|
|
|
14
14
|
triggerHaptic(style: string): Promise<boolean>;
|
|
15
15
|
getNativeSystemMetrics(): Promise<Object>;
|
|
16
16
|
pushNativeLogRecord(pageKey: string, jsonPayload: string): Promise<boolean>;
|
|
17
|
-
|
|
17
|
+
checkFloatingButtonPress(): Promise<boolean>;
|
|
18
18
|
addListener(eventName: string): void;
|
|
19
19
|
removeListeners(count: number): void;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "2.2.
|
|
1
|
+
export declare const LIB_VERSION = "2.2.9";
|
|
@@ -138,6 +138,19 @@ export const subscribeNativeFloatingButtonPress = (callback) => {
|
|
|
138
138
|
}
|
|
139
139
|
catch (e) { }
|
|
140
140
|
}
|
|
141
|
+
// Active Bridgeless / TurboModule tap detection
|
|
142
|
+
const interval = setInterval(async () => {
|
|
143
|
+
if (NativeModule && NativeModule.checkFloatingButtonPress) {
|
|
144
|
+
try {
|
|
145
|
+
const pressed = await NativeModule.checkFloatingButtonPress();
|
|
146
|
+
if (pressed) {
|
|
147
|
+
callback();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (e) { }
|
|
151
|
+
}
|
|
152
|
+
}, 180);
|
|
153
|
+
cleanups.push(() => clearInterval(interval));
|
|
141
154
|
return () => {
|
|
142
155
|
cleanups.forEach(fn => {
|
|
143
156
|
try {
|
|
@@ -14,7 +14,7 @@ export interface Spec extends TurboModule {
|
|
|
14
14
|
triggerHaptic(style: string): Promise<boolean>;
|
|
15
15
|
getNativeSystemMetrics(): Promise<Object>;
|
|
16
16
|
pushNativeLogRecord(pageKey: string, jsonPayload: string): Promise<boolean>;
|
|
17
|
-
|
|
17
|
+
checkFloatingButtonPress(): Promise<boolean>;
|
|
18
18
|
addListener(eventName: string): void;
|
|
19
19
|
removeListeners(count: number): void;
|
|
20
20
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
static NetworkInspectorModule *sharedInstance = nil;
|
|
7
7
|
static NSUncaughtExceptionHandler *previousUncaughtExceptionHandler = NULL;
|
|
8
|
+
static BOOL g_floatingButtonPressed = NO;
|
|
8
9
|
|
|
9
10
|
@interface InAppInspectorFloatingView : UIView
|
|
10
11
|
@property (nonatomic, copy) void (^onTapBlock)(void);
|
|
@@ -410,6 +411,7 @@ RCT_EXPORT_MODULE(NetworkInspectorModule);
|
|
|
410
411
|
|
|
411
412
|
- (void)safeSendEvent:(NSString *)eventName body:(id)body {
|
|
412
413
|
if (!hasListeners) return;
|
|
414
|
+
if (self.bridge == nil) return;
|
|
413
415
|
@try {
|
|
414
416
|
[self sendEventWithName:eventName body:body];
|
|
415
417
|
} @catch (NSException *ex) {
|
|
@@ -598,8 +600,9 @@ RCT_EXPORT_METHOD(showFloatingButton:(NSDictionary *)options
|
|
|
598
600
|
|
|
599
601
|
__weak NetworkInspectorModule *weakSelf = self;
|
|
600
602
|
floatingButtonView.onTapBlock = ^{
|
|
603
|
+
g_floatingButtonPressed = YES;
|
|
601
604
|
NetworkInspectorModule *strongSelf = weakSelf ?: sharedInstance;
|
|
602
|
-
if (strongSelf) {
|
|
605
|
+
if (strongSelf && strongSelf.bridge != nil) {
|
|
603
606
|
[strongSelf safeSendEvent:@"onFloatingButtonPress" body:@{}];
|
|
604
607
|
}
|
|
605
608
|
};
|
|
@@ -674,6 +677,13 @@ RCT_EXPORT_METHOD(setFloatingButtonPosition:(double)x y:(double)y
|
|
|
674
677
|
});
|
|
675
678
|
}
|
|
676
679
|
|
|
680
|
+
RCT_EXPORT_METHOD(checkFloatingButtonPress:(RCTPromiseResolveBlock)resolve
|
|
681
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
682
|
+
BOOL pressed = g_floatingButtonPressed;
|
|
683
|
+
g_floatingButtonPressed = NO;
|
|
684
|
+
resolve(@(pressed));
|
|
685
|
+
}
|
|
686
|
+
|
|
677
687
|
RCT_EXPORT_METHOD(startFpsMonitoring:(RCTPromiseResolveBlock)resolve
|
|
678
688
|
reject:(RCTPromiseRejectBlock)reject) {
|
|
679
689
|
dispatch_async(dispatch_get_main_queue(), ^{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-inapp-inspector",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.9",
|
|
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",
|
package/src/constants/version.ts
CHANGED
|
@@ -207,6 +207,19 @@ export const subscribeNativeFloatingButtonPress = (
|
|
|
207
207
|
} catch (e) {}
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
// Active Bridgeless / TurboModule tap detection
|
|
211
|
+
const interval = setInterval(async () => {
|
|
212
|
+
if (NativeModule && NativeModule.checkFloatingButtonPress) {
|
|
213
|
+
try {
|
|
214
|
+
const pressed = await NativeModule.checkFloatingButtonPress();
|
|
215
|
+
if (pressed) {
|
|
216
|
+
callback();
|
|
217
|
+
}
|
|
218
|
+
} catch (e) {}
|
|
219
|
+
}
|
|
220
|
+
}, 180);
|
|
221
|
+
cleanups.push(() => clearInterval(interval));
|
|
222
|
+
|
|
210
223
|
return () => {
|
|
211
224
|
cleanups.forEach(fn => {
|
|
212
225
|
try {
|
|
@@ -16,7 +16,7 @@ export interface Spec extends TurboModule {
|
|
|
16
16
|
triggerHaptic(style: string): Promise<boolean>;
|
|
17
17
|
getNativeSystemMetrics(): Promise<Object>;
|
|
18
18
|
pushNativeLogRecord(pageKey: string, jsonPayload: string): Promise<boolean>;
|
|
19
|
-
|
|
19
|
+
checkFloatingButtonPress(): Promise<boolean>;
|
|
20
20
|
addListener(eventName: string): void;
|
|
21
21
|
removeListeners(count: number): void;
|
|
22
22
|
}
|