diff --git a/src/declarations/interfaces/Location.d.ts b/src/declarations/interfaces/Location.d.ts index 322d28c3..77ac751d 100644 --- a/src/declarations/interfaces/Location.d.ts +++ b/src/declarations/interfaces/Location.d.ts @@ -1,5 +1,5 @@ /// -/// +/// /// /// /// @@ -216,7 +216,7 @@ declare module "react-native-background-geolocation" { /** * Device motion-activity when this location was recorded (eg: `still`, `on_foot`, `in_vehicle`). */ - activity: MotionActivityEvent; + activity: LocationMotionActivityEvent; /** * If this location was recorded due to [[ProviderChangeEvent]], this is a reference to the location-provider state. */ diff --git a/src/declarations/interfaces/LocationMotionActivityEvent.d.ts b/src/declarations/interfaces/LocationMotionActivityEvent.d.ts new file mode 100644 index 00000000..3bd02a0b --- /dev/null +++ b/src/declarations/interfaces/LocationMotionActivityEvent.d.ts @@ -0,0 +1,42 @@ +declare module "react-native-background-geolocation" { + /** + * Type of activity. + */ + type LocationMotionActivityType = + | "still" + | "walking" + | "on_foot" + | "running" + | "on_bicycle" + | "in_vehicle"; + + /** + * The `activity` field which is part of the `Location` type that gets passed to [[BackgroundGeolocation.onLocation]]. + * + * @example + * ```typescript + * BackgroundGeolocation.onLocatione(location => { + * console.log("[location] ", location.activity.type, location.activity.confidence); + * }); + * ``` + */ + interface LocationMotionActivityEvent { + /** + * The reported device motion activity. + * + * | Activity Name | + * |----------------| + * | `still` | + * | `walking` | + * | `on_foot` | + * | `running` | + * | `on_bicycle` | + * | `in_vehicle` | + */ + type: LocationMotionActivityType; + /** + * Confidence of the reported device motion activity in %. + */ + confidence: number; + } +} diff --git a/src/declarations/interfaces/MotionActivityEvent.d.ts b/src/declarations/interfaces/MotionActivityEvent.d.ts index 2c4dd387..a6b95ae3 100644 --- a/src/declarations/interfaces/MotionActivityEvent.d.ts +++ b/src/declarations/interfaces/MotionActivityEvent.d.ts @@ -1,31 +1,31 @@ declare module "react-native-background-geolocation" { /** - * The event-object provided to [[BackgroundGeolocation.onActivityChange]]. Also attached to each recorded [[Location]]. - * - * @example - * ```typescript - * BackgroundGeolocation.onActivityChange(activityChangeEvent => { - * console.log("[activitychange] ", activityChangeEvent.activity, activityChangeEvent.confidence); - * }); - * ``` - */ + * The event-object provided to [[BackgroundGeolocation.onActivityChange]]. Also attached to each recorded [[Location]]. + * + * @example + * ```typescript + * BackgroundGeolocation.onActivityChange(activityChangeEvent => { + * console.log("[activitychange] ", activityChangeEvent.activity, activityChangeEvent.confidence); + * }); + * ``` + */ interface MotionActivityEvent { /** - * The reported device motion activity. - * - * | Activity Name | - * |----------------| - * | `still` | - * | `walking` | - * | `on_foot` | - * | `running` | - * | `on_bicycle` | - * | `in_vehicle` | - */ + * The reported device motion activity. + * + * | Activity Name | + * |----------------| + * | `still` | + * | `walking` | + * | `on_foot` | + * | `running` | + * | `on_bicycle` | + * | `in_vehicle` | + */ activity: string; /** - * Confidence of the reported device motion activity in %. - */ + * Confidence of the reported device motion activity in %. + */ confidence: number; } }