sonarfit-react-native 1.0.0 → 1.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.
- package/README.md +33 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ React Native integration for SonarFit SDK - AI-powered workout rep counting for
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- AI-powered rep counting for
|
|
7
|
+
- AI-powered rep counting for Squats, Bench Press, and Deadlifts
|
|
8
8
|
- Real-time workout tracking
|
|
9
9
|
- Support for Apple Watch and AirPods motion sensors
|
|
10
10
|
- Native iOS integration with React Native bridge
|
|
@@ -28,6 +28,28 @@ cd ios && pod install
|
|
|
28
28
|
platform :ios, '17.0'
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
3. Add required permissions to your `Info.plist`:
|
|
32
|
+
```xml
|
|
33
|
+
<key>NSMotionUsageDescription</key>
|
|
34
|
+
<string>This app uses motion sensors to track your workout reps and provide real-time feedback</string>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
4. Enable HealthKit capability:
|
|
38
|
+
- Select your iOS app target in Xcode
|
|
39
|
+
- Go to **Signing & Capabilities**
|
|
40
|
+
- Click **+ Capability**
|
|
41
|
+
- Add **HealthKit**
|
|
42
|
+
- Enable **Background Delivery** under HealthKit
|
|
43
|
+
|
|
44
|
+
5. Add Background Modes to your `Info.plist`:
|
|
45
|
+
```xml
|
|
46
|
+
<key>UIBackgroundModes</key>
|
|
47
|
+
<array>
|
|
48
|
+
<string>fetch</string>
|
|
49
|
+
<string>processing</string>
|
|
50
|
+
</array>
|
|
51
|
+
```
|
|
52
|
+
|
|
31
53
|
## Usage
|
|
32
54
|
|
|
33
55
|
### Initialize the SDK
|
|
@@ -45,7 +67,7 @@ useEffect(() => {
|
|
|
45
67
|
console.error('Failed to initialize SonarFit SDK:', error);
|
|
46
68
|
}
|
|
47
69
|
};
|
|
48
|
-
|
|
70
|
+
|
|
49
71
|
initSDK();
|
|
50
72
|
}, []);
|
|
51
73
|
```
|
|
@@ -57,18 +79,18 @@ import SonarFitSDK, { WorkoutConfig } from 'sonarfit-react-native';
|
|
|
57
79
|
|
|
58
80
|
const startWorkout = async () => {
|
|
59
81
|
const config: WorkoutConfig = {
|
|
60
|
-
workoutType: 'squat',
|
|
82
|
+
workoutType: 'squat', // 'squat' | 'deadlift' | 'benchpress'
|
|
61
83
|
sets: 3,
|
|
62
84
|
reps: 10,
|
|
63
|
-
restTime: 60,
|
|
64
|
-
countdownDuration: 3,
|
|
65
|
-
autoReLift: true,
|
|
66
|
-
deviceType: '
|
|
85
|
+
restTime: 60, // seconds (default: 60)
|
|
86
|
+
countdownDuration: 3, // seconds (default: 3)
|
|
87
|
+
autoReLift: true, // default: true
|
|
88
|
+
deviceType: 'airpods', // 'watch' | 'airpods'
|
|
67
89
|
};
|
|
68
90
|
|
|
69
91
|
try {
|
|
70
92
|
const result = await SonarFitSDK.presentWorkout(config);
|
|
71
|
-
|
|
93
|
+
|
|
72
94
|
if (result.completed) {
|
|
73
95
|
console.log(`Completed ${result.totalRepsCompleted}/${result.totalTargetReps} reps`);
|
|
74
96
|
console.log(`Duration: ${result.totalDuration}s`);
|
|
@@ -111,7 +133,7 @@ interface WorkoutConfig {
|
|
|
111
133
|
restTime?: number; // default: 60
|
|
112
134
|
countdownDuration?: number; // default: 3
|
|
113
135
|
autoReLift?: boolean; // default: true
|
|
114
|
-
deviceType
|
|
136
|
+
deviceType: 'watch' | 'airpods';
|
|
115
137
|
}
|
|
116
138
|
|
|
117
139
|
interface WorkoutResult {
|
|
@@ -138,7 +160,8 @@ interface WorkoutResult {
|
|
|
138
160
|
|
|
139
161
|
- React Native >= 0.60
|
|
140
162
|
- iOS >= 17.0
|
|
141
|
-
- Xcode >=
|
|
163
|
+
- Xcode >= 16.0
|
|
164
|
+
- AirPods Pro/Max or Apple Watch (for motion tracking)
|
|
142
165
|
|
|
143
166
|
## Example
|
|
144
167
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonarfit-react-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "React Native integration for SonarFit SDK - AI-powered workout rep counting",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"README.md"
|
|
45
45
|
],
|
|
46
46
|
"react-native": "lib/index.js"
|
|
47
|
-
}
|
|
47
|
+
}
|