Skip to content

Commit

Permalink
fix(metadata): add recording method in the metadata object
Browse files Browse the repository at this point in the history
  • Loading branch information
sauravexodus committed Aug 15, 2023
1 parent db104ec commit 7a074db
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ fun convertMetadataToJSMap(meta: Metadata): WritableNativeMap {
putString("dataOrigin", meta.dataOrigin.packageName)
putString("lastModifiedTime", meta.lastModifiedTime.toString())
putInt("device", meta.device?.type ?: 0)
putInt("recordingMethod", meta.recordingMethod)
}
}

Expand Down
14 changes: 14 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,17 @@ export const ExerciseSegmentType = {
/** Use this type for yoga. */
YOGA: 67,
};

export const RecordingMethod = {
/** For actively recorded data by the user. */
RECORDING_METHOD_ACTIVELY_RECORDED: 1,

/** For passively recorded data by the app. */
RECORDING_METHOD_AUTOMATICALLY_RECORDED: 2,

/** For manually entered data by the user. */
RECORDING_METHOD_MANUAL_ENTRY: 3,

/** Unknown recording method. */
RECORDING_METHOD_UNKNOWN: 0,
};
2 changes: 2 additions & 0 deletions src/types/base.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export interface Metadata {
clientRecordVersion: number;
// see: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device
device: number;
// Use RecordingType constant to compare
recordingMethod: number;
}

export type TimeRangeFilter =
Expand Down

0 comments on commit 7a074db

Please sign in to comment.