@mindedsolutions/bug-reporter-sdk 0.3.3 → 0.3.4
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/dist/hooks/useDeviceInfo.js +21 -11
- package/dist/hooks/useShakeDetection.js +24 -19
- package/package.json +7 -7
|
@@ -40,19 +40,29 @@ const Application = __importStar(require("expo-application"));
|
|
|
40
40
|
const Network = __importStar(require("expo-network"));
|
|
41
41
|
function useDeviceInfo() {
|
|
42
42
|
const getDeviceInfo = (0, react_1.useCallback)(() => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
try {
|
|
44
|
+
return {
|
|
45
|
+
brand: Device.brand,
|
|
46
|
+
model: Device.modelName,
|
|
47
|
+
os: Device.osName,
|
|
48
|
+
osVersion: Device.osVersion,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return { brand: null, model: null, os: null, osVersion: null };
|
|
53
|
+
}
|
|
49
54
|
}, []);
|
|
50
55
|
const getAppInfo = (0, react_1.useCallback)(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
try {
|
|
57
|
+
return {
|
|
58
|
+
name: Application.applicationName,
|
|
59
|
+
version: Application.nativeApplicationVersion,
|
|
60
|
+
build: Application.nativeBuildVersion,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return { name: null, version: null, build: null };
|
|
65
|
+
}
|
|
56
66
|
}, []);
|
|
57
67
|
const getNetworkInfo = (0, react_1.useCallback)(async () => {
|
|
58
68
|
try {
|
|
@@ -13,24 +13,29 @@ function useShakeDetection({ enabled, threshold, onShake }) {
|
|
|
13
13
|
(0, react_1.useEffect)(() => {
|
|
14
14
|
if (!enabled)
|
|
15
15
|
return;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
try {
|
|
17
|
+
expo_sensors_1.Accelerometer.setUpdateInterval(100);
|
|
18
|
+
const subscription = expo_sensors_1.Accelerometer.addListener(({ x, y, z }) => {
|
|
19
|
+
const magnitude = Math.sqrt(x * x + y * y + z * z);
|
|
20
|
+
if (magnitude < shakeThreshold)
|
|
21
|
+
return;
|
|
22
|
+
const now = Date.now();
|
|
23
|
+
// Cooldown check
|
|
24
|
+
if (now - lastShake.current < constants_1.SHAKE_COOLDOWN_MS)
|
|
25
|
+
return;
|
|
26
|
+
// Add timestamp and clean old ones
|
|
27
|
+
timestamps.current.push(now);
|
|
28
|
+
timestamps.current = timestamps.current.filter((t) => now - t < constants_1.SHAKE_WINDOW_MS);
|
|
29
|
+
if (timestamps.current.length >= constants_1.SHAKE_COUNT) {
|
|
30
|
+
lastShake.current = now;
|
|
31
|
+
timestamps.current = [];
|
|
32
|
+
onShakeRef.current();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return () => subscription.remove();
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Native module not available (e.g. version mismatch)
|
|
39
|
+
}
|
|
35
40
|
}, [enabled, shakeThreshold]);
|
|
36
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindedsolutions/bug-reporter-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "In-app bug reporting and feature request SDK for React Native/Expo with shake detection, screenshot capture, feature board, and Supabase integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"clean": "rm -rf dist"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"expo-application": ">=5",
|
|
25
|
-
"expo-device": ">=6",
|
|
26
|
-
"expo-network": ">=6",
|
|
27
|
-
"expo-sensors": ">=13",
|
|
24
|
+
"expo-application": ">=5 <8",
|
|
25
|
+
"expo-device": ">=6 <9",
|
|
26
|
+
"expo-network": ">=6 <8",
|
|
27
|
+
"expo-sensors": ">=13 <16",
|
|
28
28
|
"react": ">=18",
|
|
29
29
|
"react-native": ">=0.72",
|
|
30
|
-
"react-native-view-shot": ">=3",
|
|
31
|
-
"react-native-webview": ">=13"
|
|
30
|
+
"react-native-view-shot": ">=3 <5",
|
|
31
|
+
"react-native-webview": ">=13 <14"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@supabase/supabase-js": "^2.49.0"
|