react-native-workouts 0.1.0 → 0.2.3
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 +176 -172
- package/app.json +3 -0
- package/build/ReactNativeWorkouts.types.d.ts +106 -20
- package/build/ReactNativeWorkouts.types.d.ts.map +1 -1
- package/build/ReactNativeWorkouts.types.js +3 -1
- package/build/ReactNativeWorkouts.types.js.map +1 -1
- package/build/ReactNativeWorkoutsModule.d.ts +76 -2
- package/build/ReactNativeWorkoutsModule.d.ts.map +1 -1
- package/build/ReactNativeWorkoutsModule.js +2 -2
- package/build/ReactNativeWorkoutsModule.js.map +1 -1
- package/build/hooks.d.ts +70 -0
- package/build/hooks.d.ts.map +1 -0
- package/build/hooks.js +194 -0
- package/build/hooks.js.map +1 -0
- package/build/index.d.ts +3 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/expo-module.config.json +8 -4
- package/ios/ReactNativeWorkouts.podspec +8 -2
- package/ios/ReactNativeWorkoutsModule.swift +546 -137
- package/package.json +2 -2
- package/public/react-native-workouts-banner.png +0 -0
- package/src/ReactNativeWorkouts.types.ts +172 -75
- package/src/ReactNativeWorkoutsModule.ts +101 -18
- package/src/hooks.ts +295 -0
- package/src/index.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-workouts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "React Native Expo module for Apple WorkoutKit - create, preview, and sync custom workouts to Apple Watch",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"dependencies": {},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/react": "~19.1.0",
|
|
52
|
-
"expo-module-scripts": "^5.0.8",
|
|
53
52
|
"expo": "^54.0.27",
|
|
53
|
+
"expo-module-scripts": "^5.0.8",
|
|
54
54
|
"react-native": "0.81.5"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
Binary file
|
|
@@ -1,105 +1,116 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* WorkoutKit authorization state as seen by Apple's `WorkoutScheduler`.
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
5
|
export type AuthorizationStatus =
|
|
4
|
-
|
|
|
5
|
-
|
|
|
6
|
-
|
|
|
7
|
-
|
|
|
6
|
+
| "authorized"
|
|
7
|
+
| "notDetermined"
|
|
8
|
+
| "denied"
|
|
9
|
+
| "unknown";
|
|
10
|
+
|
|
11
|
+
// Shared Objects
|
|
12
|
+
|
|
13
|
+
import type { SharedObject } from "expo";
|
|
8
14
|
|
|
9
15
|
// Activity Types
|
|
10
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Supported workout activity types exposed by this package.
|
|
19
|
+
*
|
|
20
|
+
* Note: these map to HealthKit `HKWorkoutActivityType` values.
|
|
21
|
+
*/
|
|
11
22
|
export type ActivityType =
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
34
|
-
export type LocationType =
|
|
23
|
+
| "running"
|
|
24
|
+
| "cycling"
|
|
25
|
+
| "walking"
|
|
26
|
+
| "hiking"
|
|
27
|
+
| "swimming"
|
|
28
|
+
| "rowing"
|
|
29
|
+
| "elliptical"
|
|
30
|
+
| "stairClimbing"
|
|
31
|
+
| "highIntensityIntervalTraining"
|
|
32
|
+
| "yoga"
|
|
33
|
+
| "functionalStrengthTraining"
|
|
34
|
+
| "traditionalStrengthTraining"
|
|
35
|
+
| "dance"
|
|
36
|
+
| "jumpRope"
|
|
37
|
+
| "coreTraining"
|
|
38
|
+
| "pilates"
|
|
39
|
+
| "kickboxing"
|
|
40
|
+
| "stairs"
|
|
41
|
+
| "stepTraining"
|
|
42
|
+
| "wheelchairRunPace"
|
|
43
|
+
| "wheelchairWalkPace";
|
|
44
|
+
|
|
45
|
+
export type LocationType = "indoor" | "outdoor";
|
|
35
46
|
|
|
36
47
|
// Units
|
|
37
48
|
|
|
38
49
|
export type DistanceUnit =
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
50
|
+
| "meters"
|
|
51
|
+
| "m"
|
|
52
|
+
| "kilometers"
|
|
53
|
+
| "km"
|
|
54
|
+
| "miles"
|
|
55
|
+
| "mi"
|
|
56
|
+
| "yards"
|
|
57
|
+
| "yd"
|
|
58
|
+
| "feet"
|
|
59
|
+
| "ft";
|
|
49
60
|
|
|
50
61
|
export type TimeUnit =
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
62
|
+
| "seconds"
|
|
63
|
+
| "s"
|
|
64
|
+
| "sec"
|
|
65
|
+
| "minutes"
|
|
66
|
+
| "min"
|
|
67
|
+
| "hours"
|
|
68
|
+
| "h"
|
|
69
|
+
| "hr";
|
|
59
70
|
|
|
60
71
|
export type EnergyUnit =
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
72
|
+
| "kilocalories"
|
|
73
|
+
| "kcal"
|
|
74
|
+
| "cal"
|
|
75
|
+
| "kilojoules"
|
|
76
|
+
| "kj";
|
|
66
77
|
|
|
67
78
|
export type SpeedUnit =
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
79
|
+
| "metersPerSecond"
|
|
80
|
+
| "mps"
|
|
81
|
+
| "m/s"
|
|
82
|
+
| "kilometersPerHour"
|
|
83
|
+
| "kph"
|
|
84
|
+
| "km/h"
|
|
85
|
+
| "milesPerHour"
|
|
86
|
+
| "mph";
|
|
76
87
|
|
|
77
88
|
export type PaceUnit =
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
89
|
+
| "minutesPerKilometer"
|
|
90
|
+
| "min/km"
|
|
91
|
+
| "minutesPerMile"
|
|
92
|
+
| "min/mi";
|
|
82
93
|
|
|
83
94
|
// Goals
|
|
84
95
|
|
|
85
96
|
export interface OpenGoal {
|
|
86
|
-
type:
|
|
97
|
+
type: "open";
|
|
87
98
|
}
|
|
88
99
|
|
|
89
100
|
export interface DistanceGoal {
|
|
90
|
-
type:
|
|
101
|
+
type: "distance";
|
|
91
102
|
value: number;
|
|
92
103
|
unit?: DistanceUnit;
|
|
93
104
|
}
|
|
94
105
|
|
|
95
106
|
export interface TimeGoal {
|
|
96
|
-
type:
|
|
107
|
+
type: "time";
|
|
97
108
|
value: number;
|
|
98
109
|
unit?: TimeUnit;
|
|
99
110
|
}
|
|
100
111
|
|
|
101
112
|
export interface EnergyGoal {
|
|
102
|
-
type:
|
|
113
|
+
type: "energy";
|
|
103
114
|
value: number;
|
|
104
115
|
unit?: EnergyUnit;
|
|
105
116
|
}
|
|
@@ -109,38 +120,38 @@ export type WorkoutGoal = OpenGoal | DistanceGoal | TimeGoal | EnergyGoal;
|
|
|
109
120
|
// Alerts
|
|
110
121
|
|
|
111
122
|
export interface HeartRateZoneAlert {
|
|
112
|
-
type:
|
|
123
|
+
type: "heartRate";
|
|
113
124
|
zone: number;
|
|
114
125
|
}
|
|
115
126
|
|
|
116
127
|
export interface HeartRateRangeAlert {
|
|
117
|
-
type:
|
|
128
|
+
type: "heartRate";
|
|
118
129
|
min: number;
|
|
119
130
|
max: number;
|
|
120
131
|
}
|
|
121
132
|
|
|
122
133
|
export interface PaceAlert {
|
|
123
|
-
type:
|
|
134
|
+
type: "pace";
|
|
124
135
|
min: number;
|
|
125
136
|
max: number;
|
|
126
137
|
unit?: PaceUnit;
|
|
127
138
|
}
|
|
128
139
|
|
|
129
140
|
export interface SpeedAlert {
|
|
130
|
-
type:
|
|
141
|
+
type: "speed";
|
|
131
142
|
min: number;
|
|
132
143
|
max: number;
|
|
133
144
|
unit?: SpeedUnit;
|
|
134
145
|
}
|
|
135
146
|
|
|
136
147
|
export interface CadenceAlert {
|
|
137
|
-
type:
|
|
148
|
+
type: "cadence";
|
|
138
149
|
min: number;
|
|
139
150
|
max: number;
|
|
140
151
|
}
|
|
141
152
|
|
|
142
153
|
export interface PowerAlert {
|
|
143
|
-
type:
|
|
154
|
+
type: "power";
|
|
144
155
|
min: number;
|
|
145
156
|
max: number;
|
|
146
157
|
}
|
|
@@ -155,7 +166,7 @@ export type WorkoutAlert =
|
|
|
155
166
|
|
|
156
167
|
// Workout Steps
|
|
157
168
|
|
|
158
|
-
export type StepPurpose =
|
|
169
|
+
export type StepPurpose = "work" | "recovery";
|
|
159
170
|
|
|
160
171
|
export interface WorkoutStep {
|
|
161
172
|
goal?: WorkoutGoal;
|
|
@@ -176,8 +187,17 @@ export interface IntervalBlock {
|
|
|
176
187
|
// Workout Configurations
|
|
177
188
|
|
|
178
189
|
export interface CustomWorkoutConfig {
|
|
190
|
+
/**
|
|
191
|
+
* Activity type (running, cycling, etc).
|
|
192
|
+
*/
|
|
179
193
|
activityType: ActivityType;
|
|
194
|
+
/**
|
|
195
|
+
* Indoor/outdoor (where applicable). Defaults to `"outdoor"` when omitted.
|
|
196
|
+
*/
|
|
180
197
|
locationType?: LocationType;
|
|
198
|
+
/**
|
|
199
|
+
* Display name used by the system (where supported by WorkoutKit).
|
|
200
|
+
*/
|
|
181
201
|
displayName?: string;
|
|
182
202
|
warmup?: WorkoutStep;
|
|
183
203
|
blocks: IntervalBlock[];
|
|
@@ -187,12 +207,15 @@ export interface CustomWorkoutConfig {
|
|
|
187
207
|
export interface SingleGoalWorkoutConfig {
|
|
188
208
|
activityType: ActivityType;
|
|
189
209
|
locationType?: LocationType;
|
|
210
|
+
/**
|
|
211
|
+
* Optional label for your app/back-end. WorkoutKit may not display this for all workout kinds.
|
|
212
|
+
*/
|
|
190
213
|
displayName?: string;
|
|
191
214
|
goal: WorkoutGoal;
|
|
192
215
|
}
|
|
193
216
|
|
|
194
217
|
export interface PacerTarget {
|
|
195
|
-
type:
|
|
218
|
+
type: "speed" | "pace";
|
|
196
219
|
value: number;
|
|
197
220
|
unit?: SpeedUnit | PaceUnit;
|
|
198
221
|
}
|
|
@@ -200,10 +223,35 @@ export interface PacerTarget {
|
|
|
200
223
|
export interface PacerWorkoutConfig {
|
|
201
224
|
activityType: ActivityType;
|
|
202
225
|
locationType?: LocationType;
|
|
226
|
+
/**
|
|
227
|
+
* Optional label for your app/back-end. WorkoutKit may not display this for all workout kinds.
|
|
228
|
+
*/
|
|
203
229
|
displayName?: string;
|
|
204
230
|
target: PacerTarget;
|
|
205
231
|
}
|
|
206
232
|
|
|
233
|
+
export type SwimBikeRunActivityType = "swimming" | "cycling" | "running";
|
|
234
|
+
|
|
235
|
+
export interface SwimBikeRunActivityConfig {
|
|
236
|
+
type: SwimBikeRunActivityType;
|
|
237
|
+
/**
|
|
238
|
+
* For running/cycling: `"indoor" | "outdoor"`.
|
|
239
|
+
* For swimming: `"indoor"` means pool, `"outdoor"` means open water.
|
|
240
|
+
*/
|
|
241
|
+
locationType?: LocationType;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface SwimBikeRunWorkoutConfig {
|
|
245
|
+
/**
|
|
246
|
+
* Display name shown by the system for multisport workouts.
|
|
247
|
+
*/
|
|
248
|
+
displayName?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Ordered list of activities (e.g. swim -> bike -> run).
|
|
251
|
+
*/
|
|
252
|
+
activities: SwimBikeRunActivityConfig[];
|
|
253
|
+
}
|
|
254
|
+
|
|
207
255
|
// Date Components
|
|
208
256
|
|
|
209
257
|
export interface DateComponents {
|
|
@@ -240,3 +288,52 @@ export interface AuthorizationChangeEvent {
|
|
|
240
288
|
export type ReactNativeWorkoutsModuleEvents = {
|
|
241
289
|
onAuthorizationChange: (event: AuthorizationChangeEvent) => void;
|
|
242
290
|
};
|
|
291
|
+
|
|
292
|
+
export type WorkoutPlanKind = "custom" | "singleGoal" | "pacer" | "swimBikeRun";
|
|
293
|
+
|
|
294
|
+
export interface WorkoutPlanExport {
|
|
295
|
+
/**
|
|
296
|
+
* UUID of the underlying `WorkoutPlan` instance.
|
|
297
|
+
*
|
|
298
|
+
* This is useful for debugging/logging and for matching the ID returned by `plan.scheduleAndSync`.
|
|
299
|
+
*/
|
|
300
|
+
id: string;
|
|
301
|
+
kind: WorkoutPlanKind;
|
|
302
|
+
/**
|
|
303
|
+
* The original config used to create the plan.
|
|
304
|
+
*
|
|
305
|
+
* Use this to persist/share the plan in your own backend and recreate the plan later.
|
|
306
|
+
*/
|
|
307
|
+
config: unknown;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export declare class WorkoutPlan extends SharedObject<{}> {
|
|
311
|
+
/**
|
|
312
|
+
* UUID of this plan instance.
|
|
313
|
+
*/
|
|
314
|
+
readonly id: string;
|
|
315
|
+
/**
|
|
316
|
+
* Which kind of workout this plan represents.
|
|
317
|
+
*/
|
|
318
|
+
readonly kind: WorkoutPlanKind;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Shows Apple's system Workout preview modal (includes “Add to Watch / Send to Watch” UX).
|
|
322
|
+
*/
|
|
323
|
+
preview(): Promise<boolean>;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Schedules the plan using Apple's `WorkoutScheduler`.
|
|
327
|
+
*
|
|
328
|
+
* This is the mechanism that syncs the plan to the Apple Watch Workout app.
|
|
329
|
+
*/
|
|
330
|
+
scheduleAndSync(date: DateComponents): Promise<ScheduleResult>;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Returns `{ id, kind, config }` for storing/sharing the plan in your own backend.
|
|
334
|
+
*
|
|
335
|
+
* This does NOT export a system-importable file — it's a JSON payload you can use to recreate
|
|
336
|
+
* the plan via the `create*WorkoutPlan(...)` factories.
|
|
337
|
+
*/
|
|
338
|
+
export(): WorkoutPlanExport;
|
|
339
|
+
}
|
|
@@ -1,64 +1,147 @@
|
|
|
1
|
-
import { NativeModule, requireNativeModule } from
|
|
1
|
+
import { NativeModule, requireNativeModule } from "expo";
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
|
-
ReactNativeWorkoutsModuleEvents,
|
|
5
|
-
AuthorizationStatus,
|
|
6
4
|
ActivityType,
|
|
7
|
-
|
|
5
|
+
AuthorizationStatus,
|
|
8
6
|
CustomWorkoutConfig,
|
|
9
|
-
SingleGoalWorkoutConfig,
|
|
10
|
-
PacerWorkoutConfig,
|
|
11
7
|
DateComponents,
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
LocationType,
|
|
9
|
+
PacerWorkoutConfig,
|
|
10
|
+
ReactNativeWorkoutsModuleEvents,
|
|
14
11
|
ScheduledWorkout,
|
|
15
|
-
|
|
12
|
+
ScheduleResult,
|
|
13
|
+
SingleGoalWorkoutConfig,
|
|
14
|
+
SwimBikeRunWorkoutConfig,
|
|
15
|
+
WorkoutPlan,
|
|
16
|
+
WorkoutValidationResult,
|
|
17
|
+
} from "./ReactNativeWorkouts.types";
|
|
16
18
|
|
|
17
|
-
declare class ReactNativeWorkoutsModule
|
|
19
|
+
declare class ReactNativeWorkoutsModule
|
|
20
|
+
extends NativeModule<ReactNativeWorkoutsModuleEvents> {
|
|
18
21
|
// Constants
|
|
22
|
+
/**
|
|
23
|
+
* Whether Health data is available on this device.
|
|
24
|
+
* On iOS simulators this is typically `false`.
|
|
25
|
+
*/
|
|
19
26
|
readonly isAvailable: boolean;
|
|
20
27
|
|
|
21
28
|
// Authorization
|
|
29
|
+
/**
|
|
30
|
+
* Returns the current WorkoutKit authorization status.
|
|
31
|
+
*/
|
|
22
32
|
getAuthorizationStatus(): Promise<AuthorizationStatus>;
|
|
33
|
+
/**
|
|
34
|
+
* Prompts the user for WorkoutKit authorization (if needed).
|
|
35
|
+
*/
|
|
23
36
|
requestAuthorization(): Promise<AuthorizationStatus>;
|
|
24
37
|
|
|
25
38
|
// Validation
|
|
39
|
+
/**
|
|
40
|
+
* Returns whether a given goal type is supported for the provided activity + location.
|
|
41
|
+
*/
|
|
26
42
|
supportsGoal(
|
|
27
43
|
activityType: ActivityType,
|
|
28
44
|
locationType: LocationType,
|
|
29
|
-
goalType: string
|
|
45
|
+
goalType: string,
|
|
30
46
|
): Promise<boolean>;
|
|
31
47
|
|
|
32
48
|
// Custom Workouts
|
|
49
|
+
/**
|
|
50
|
+
* Validates a custom workout config. (Legacy name: this does not persist anything.)
|
|
51
|
+
*/
|
|
33
52
|
createCustomWorkout(
|
|
34
|
-
config: CustomWorkoutConfig
|
|
53
|
+
config: CustomWorkoutConfig,
|
|
35
54
|
): Promise<WorkoutValidationResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Previews a custom workout via Apple's system modal.
|
|
57
|
+
*/
|
|
58
|
+
previewWorkout(config: CustomWorkoutConfig): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Schedules a custom workout (syncs it to the Apple Watch Workout app).
|
|
61
|
+
*
|
|
62
|
+
* Prefer using `useCustomWorkout(...)` + `plan.scheduleAndSync(...)` for new code.
|
|
63
|
+
*/
|
|
36
64
|
scheduleWorkout(
|
|
37
65
|
config: CustomWorkoutConfig,
|
|
38
|
-
date: DateComponents
|
|
66
|
+
date: DateComponents,
|
|
39
67
|
): Promise<ScheduleResult>;
|
|
40
68
|
|
|
41
69
|
// Single Goal Workouts
|
|
70
|
+
/**
|
|
71
|
+
* Validates a single-goal workout config. (Legacy name: this does not persist anything.)
|
|
72
|
+
*/
|
|
42
73
|
createSingleGoalWorkout(
|
|
43
|
-
config: SingleGoalWorkoutConfig
|
|
74
|
+
config: SingleGoalWorkoutConfig,
|
|
44
75
|
): Promise<WorkoutValidationResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Previews a single-goal workout via Apple's system modal.
|
|
78
|
+
*/
|
|
79
|
+
previewSingleGoalWorkout(config: SingleGoalWorkoutConfig): Promise<boolean>;
|
|
80
|
+
/**
|
|
81
|
+
* Schedules a single-goal workout (syncs it to the Apple Watch Workout app).
|
|
82
|
+
*
|
|
83
|
+
* Prefer using `useSingleGoalWorkout(...)` + `plan.scheduleAndSync(...)` for new code.
|
|
84
|
+
*/
|
|
45
85
|
scheduleSingleGoalWorkout(
|
|
46
86
|
config: SingleGoalWorkoutConfig,
|
|
47
|
-
date: DateComponents
|
|
87
|
+
date: DateComponents,
|
|
48
88
|
): Promise<ScheduleResult>;
|
|
49
89
|
|
|
50
90
|
// Pacer Workouts
|
|
91
|
+
/**
|
|
92
|
+
* Validates a pacer workout config. (Legacy name: this does not persist anything.)
|
|
93
|
+
*/
|
|
51
94
|
createPacerWorkout(
|
|
52
|
-
config: PacerWorkoutConfig
|
|
95
|
+
config: PacerWorkoutConfig,
|
|
53
96
|
): Promise<WorkoutValidationResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Previews a pacer workout via Apple's system modal.
|
|
99
|
+
*/
|
|
100
|
+
previewPacerWorkout(config: PacerWorkoutConfig): Promise<boolean>;
|
|
101
|
+
/**
|
|
102
|
+
* Schedules a pacer workout (syncs it to the Apple Watch Workout app).
|
|
103
|
+
*
|
|
104
|
+
* Prefer using `usePacerWorkout(...)` + `plan.scheduleAndSync(...)` for new code.
|
|
105
|
+
*/
|
|
54
106
|
schedulePacerWorkout(
|
|
55
107
|
config: PacerWorkoutConfig,
|
|
56
|
-
date: DateComponents
|
|
108
|
+
date: DateComponents,
|
|
57
109
|
): Promise<ScheduleResult>;
|
|
58
110
|
|
|
111
|
+
// Shared WorkoutPlan factories (object-oriented API)
|
|
112
|
+
/**
|
|
113
|
+
* Creates a stateful `WorkoutPlan` shared object (recommended API for new code).
|
|
114
|
+
*/
|
|
115
|
+
createCustomWorkoutPlan(config: CustomWorkoutConfig): Promise<WorkoutPlan>;
|
|
116
|
+
/**
|
|
117
|
+
* Creates a stateful `WorkoutPlan` shared object (recommended API for new code).
|
|
118
|
+
*/
|
|
119
|
+
createSingleGoalWorkoutPlan(
|
|
120
|
+
config: SingleGoalWorkoutConfig,
|
|
121
|
+
): Promise<WorkoutPlan>;
|
|
122
|
+
/**
|
|
123
|
+
* Creates a stateful `WorkoutPlan` shared object (recommended API for new code).
|
|
124
|
+
*/
|
|
125
|
+
createPacerWorkoutPlan(config: PacerWorkoutConfig): Promise<WorkoutPlan>;
|
|
126
|
+
/**
|
|
127
|
+
* Creates a stateful multisport `WorkoutPlan` shared object (recommended API for new code).
|
|
128
|
+
*/
|
|
129
|
+
createSwimBikeRunWorkoutPlan(
|
|
130
|
+
config: SwimBikeRunWorkoutConfig,
|
|
131
|
+
): Promise<WorkoutPlan>;
|
|
132
|
+
|
|
59
133
|
// Scheduled Workouts Management
|
|
134
|
+
/**
|
|
135
|
+
* Lists scheduled workouts created by this app.
|
|
136
|
+
*/
|
|
60
137
|
getScheduledWorkouts(): Promise<ScheduledWorkout[]>;
|
|
138
|
+
/**
|
|
139
|
+
* Removes a scheduled workout by ID.
|
|
140
|
+
*/
|
|
61
141
|
removeScheduledWorkout(id: string): Promise<boolean>;
|
|
142
|
+
/**
|
|
143
|
+
* Removes all scheduled workouts created by this app.
|
|
144
|
+
*/
|
|
62
145
|
removeAllScheduledWorkouts(): Promise<boolean>;
|
|
63
146
|
|
|
64
147
|
// Utility
|
|
@@ -68,5 +151,5 @@ declare class ReactNativeWorkoutsModule extends NativeModule<ReactNativeWorkouts
|
|
|
68
151
|
}
|
|
69
152
|
|
|
70
153
|
export default requireNativeModule<ReactNativeWorkoutsModule>(
|
|
71
|
-
|
|
154
|
+
"ReactNativeWorkouts",
|
|
72
155
|
);
|