@ovok/native/data-sync
Apple Health and Health Connect import: authorization, sync progress and manual request UI.
- Stable unknown
- Release candidate since 1.16.1-rc.3
- Development since 1.16.1-dev.2111+9796905
Apple Health and Health Connect import: authorization, sync progress and manual request UI.
Import from @ovok/native/data-sync.
Components
SyncProgressList
const SyncProgressList: MemoExoticComponent<(__namedParameters) => Element>;Lists the sync progress of each data type with its status.
DataSync()
function DataSync(__namedParameters): Element;Namespace for the health data sync components; renders its children.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { } |
Returns
Element
Hooks
useHealthAuthorization()
function useHealthAuthorization(): HealthAuthorizationValue;Returns the health authorization state; must be used inside an Apple Health or Health Connect authorization provider.
Returns
Classes
HealthSyncBatchError
Error of a health import batch that did not save every entry, carrying the server response.
Extends
Error
Constructors
Constructor
new HealthSyncBatchError(
message,
bundle?,
outcome?
): HealthSyncBatchError;Parameters
| Parameter | Type | Description |
|---|---|---|
message | string | - |
bundle? | Bundle<Resource> | Transaction response bundle of the batch that failed to save every entry. |
outcome? | OperationOutcome | Operation outcome the server returned for the batch. |
Returns
Overrides
Error.constructor
Properties
Functions
getHealthDataCoding()
function getHealthDataCoding(
provider,
identifier,
mode
): object;Returns the coding for a health platform identifier and data mode.
Parameters
| Parameter | Type |
|---|---|
provider | HealthProvider |
identifier | string |
mode | HealthDataMode |
Returns
| Name | Type | Description |
|---|---|---|
code | string | Code of the coding. |
display? | string | Human readable name of the code, when known. |
system | string | Code system of the coding. |
getHealthDataMode()
function getHealthDataMode(key, configuredMode?): HealthDataMode;Returns the configured mode, or the default mode of the data type.
Parameters
| Parameter | Type |
|---|---|
key | HealthSyncKey |
configuredMode? | HealthDataMode |
Returns
toHealthSyncError()
function toHealthSyncError(error): Error;Converts a failed batch response or error into an Error, keeping the bundle or outcome.
Parameters
| Parameter | Type |
|---|---|
error | unknown |
Returns
Error
Type Aliases
AndroidHealthConnectAuthorizationStatus
type AndroidHealthConnectAuthorizationStatus = object;Health Connect authorization state.
Properties
backgroundAccess?
backgroundAccess?: "authorized" | "shouldRequest" | "refused" | "unsupported";Background access is reported independently; it never blocks foreground import.
error?
error?: Error;Error of the last authorization attempt.
missingTypes?
missingTypes?: readonly string[];Record types that still need authorization.
state
state:
| "unknown"
| "shouldRequest"
| "requesting"
| "authorized"
| "refused"
| "error";Current authorization stage.
AndroidHealthSyncProps
type AndroidHealthSyncProps = HealthSyncProps<RecordType>;Props of AndroidHealthSync.
AppleHealthAuthorizationStatus
type AppleHealthAuthorizationStatus = object;Apple Health authorization state.
Properties
error?
error?: Error;Error of the last authorization attempt.
notRequestedMeasurementTypes
notRequestedMeasurementTypes: HealthSyncKey[];Configured measurement types with at least one unanswered read identifier.
notRequestedReadIdentifiers
notRequestedReadIdentifiers: AppleHealthDataTypeIdentifier[];HealthKit types that still need to be answered in Settings.
notRequestedWriteIdentifiers
notRequestedWriteIdentifiers: SampleTypeIdentifierWriteable[];HealthKit write types that still need to be answered in Settings.
state
state: "unknown" | "shouldRequest" | "requesting" | "ready" | "error";Current authorization stage.
AppleHealthDataTypeIdentifier
type AppleHealthDataTypeIdentifier = SampleTypeIdentifier;HealthKit sample type identifiers supported by the SDK.
AppleHealthSyncProps
type AppleHealthSyncProps = HealthSyncProps<AppleHealthDataTypeIdentifier> & object;Props of AppleHealthSync.
Type Declaration
| Name | Type | Description |
|---|---|---|
backgroundDelivery? | object | Enables HealthKit observer delivery while the app is in the background. |
backgroundDelivery.frequency? | UpdateFrequency | How often HealthKit delivers updates in the background. |
HealthAuthorizationValue
type HealthAuthorizationValue =
| {
missingTypes: readonly string[];
platform: "apple-health";
request: () => Promise<void>;
status: AppleHealthAuthorizationStatus;
}
| {
missingTypes: readonly string[];
platform: "health-connect";
request: () => Promise<void>;
status: AndroidHealthConnectAuthorizationStatus;
};Authorization state and request action of the active health platform.
Union Members
Type Literal
{
missingTypes: readonly string[];
platform: "apple-health";
request: () => Promise<void>;
status: AppleHealthAuthorizationStatus;
}| Name | Type | Description |
|---|---|---|
missingTypes | readonly string[] | Data types that have not been authorized. |
platform | "apple-health" | Apple Health platform. |
request() | () => Promise<void> | Requests the missing authorizations. |
status | AppleHealthAuthorizationStatus | Authorization status. |
Type Literal
{
missingTypes: readonly string[];
platform: "health-connect";
request: () => Promise<void>;
status: AndroidHealthConnectAuthorizationStatus;
}| Name | Type | Description |
|---|---|---|
missingTypes | readonly string[] | Data types that have not been authorized. |
platform | "health-connect" | Health Connect platform. |
request() | () => Promise<void> | Requests the missing authorizations. |
status | AndroidHealthConnectAuthorizationStatus | Authorization status. |
HealthDataMode
type HealthDataMode = "point" | "daily-total" | "daily-summary" | "session" | "series";How a data type is turned into observations.
HealthSyncKey
type HealthSyncKey = HealthSyncKeys | HealthDataType;Measurement type or health-only data type that can be synced.
HealthSyncKeys
type HealthSyncKeys = Exclude<MeasurementTypeKey,
| MeasurementTypeKey.photoUpload
| MeasurementTypeKey.symptomQuestionnaire>;Measurement types that can be synced, excluding photo upload and symptom questionnaire.
SyncPauseReason
type SyncPauseReason = "offline" | "wifi-only";Why a sync is paused.
SyncProgress
type SyncProgress = object;Sync state of one data type.
Properties
measurementTypeKey
measurementTypeKey: HealthSyncKey;Data type being synced.
progress?
progress?: object;Records processed so far.
created?
created?: number;Number of observations created instead of matched or updated.
done
done: number;Records processed.
total
total: number;Records to process.
reason?
reason?: SyncPauseReason;Why the sync is paused.
status
status: "started" | "completed" | "failed" | "idle" | "syncing" | "paused";Current sync stage.
SyncProgressListProps
type SyncProgressListProps = object;Props of SyncProgressList.
Properties
labelForType?
labelForType?: (type) => string;Returns the display label of a data type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
string
progress
progress:
| Partial<Record<string, SyncProgress>>
| null
| undefined;Sync progress per data type.
reasonLabels?
reasonLabels?: Partial<Record<NonNullable<SyncProgress["reason"]>, string>>;Overrides the pause reason texts.
statusLabels?
statusLabels?: Partial<Record<SyncProgress["status"], string>>;Overrides the status texts.
Text?
Text?: React.ComponentType<React.ComponentProps<typeof PaperText>>;Text component used to render labels.
Enumerations
HealthDataType
Health data that is not represented by a core measurement service.
Enumeration Members
Variables
HEALTH_DATA_CATALOG
const HEALTH_DATA_CATALOG: readonly HealthDataCatalogEntry[];Supported Apple Health and Health Connect data types with their LOINC mappings.
HealthAuthorizationContext
const HealthAuthorizationContext: Context<HealthAuthorizationValue | null>;Context carrying the health authorization state.
References
HealthImportAdapter
Re-exports HealthImportAdapter
useHealthImport
Re-exports useHealthImport
Last updated on