react-native-rook-sdk 4.0.0-beta.1 → 4.0.0
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/LICENSE +1 -1
- package/README.md +3 -35
- package/android/build.gradle +45 -20
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +2 -1
- package/android/src/main/AndroidManifestNew.xml +36 -0
- package/android/src/main/java/com/rooksdk/RookSdkModule.kt +263 -11
- package/android/src/main/java/com/rooksdk/RookSdkPackage.kt +42 -26
- package/android/src/main/java/com/rooksdk/broadcasts/AndroidPermissionsReceiverTransmitter.kt +65 -0
- package/android/src/main/java/com/rooksdk/broadcasts/HealthConnectPermissionsReceiverTransmitter.kt +70 -0
- package/android/src/main/java/com/rooksdk/broadcasts/SamsungHealthPermissionsReceiverTransmitter.kt +52 -0
- package/android/src/main/java/com/rooksdk/modules/RookBackgroundSyncModule.kt +99 -0
- package/android/src/main/java/com/rooksdk/modules/RookConfigurationModule.kt +182 -0
- package/android/src/main/java/com/rooksdk/modules/RookLocalData.kt +301 -0
- package/android/src/main/java/com/rooksdk/modules/RookPermissionsModule.kt +359 -0
- package/android/src/main/java/com/rooksdk/modules/RookSourcesModule.kt +102 -0
- package/android/src/main/java/com/rooksdk/modules/RookStepsModule.kt +119 -0
- package/android/src/main/java/com/rooksdk/modules/RookSyncModule.kt +551 -0
- package/android/src/main/java/com/rooksdk/utils/DatasourcesUtils.kt +34 -0
- package/android/src/main/java/com/rooksdk/utils/PermissionConversion.kt +21 -0
- package/android/src/main/java/com/rooksdk/utils/ReadableToWritable.kt +145 -0
- package/android/src/main/java/com/rooksdk/utils/RookDateTime.kt +26 -0
- package/android/src/main/java/com/rooksdk/utils/RookGsonBuilder.kt +17 -0
- package/android/src/main/java/com/rooksdk/utils/SamsungAvailability.kt +21 -0
- package/android/src/main/java/com/rooksdk/utils/Source.kt +6 -0
- package/android/src/main/java/com/rooksdk/utils/StringToSyncType.kt +41 -0
- package/android/src/main/java/com/rooksdk/utils/serializers/InstantSerializer.kt +19 -0
- package/android/src/main/java/com/rooksdk/utils/serializers/LocalDateSerializer.kt +21 -0
- package/android/src/main/res/drawable/ic_health_connect.xml +19 -0
- package/android/src/main/res/values/themes.xml +3 -0
- package/ios/DateHelper.swift +4 -4
- package/ios/EncodableDataSource.swift +3 -2
- package/ios/EncodableDataSourceAuthorizer.swift +3 -2
- package/ios/{HearRateMapper.swift → EncodableHeartRate.swift} +3 -3
- package/ios/EncodableRookDataSource.swift +36 -0
- package/ios/EncodableSDKState.swift +94 -0
- package/ios/EncodableStatusDataSources.swift +47 -0
- package/ios/NutritionMapper.swift +114 -0
- package/ios/RookBackground.swift +8 -5
- package/ios/RookBackgroundModule.h +5 -0
- package/ios/RookBackgroundModule.mm +15 -0
- package/ios/RookConfiguration.swift +34 -24
- package/ios/RookConfigurationModule.h +5 -0
- package/ios/RookConfigurationModule.mm +22 -0
- package/ios/RookExternalModule.h +5 -0
- package/ios/RookExternalModule.m +31 -0
- package/ios/{RookData.swift → RookLocalData.swift} +70 -48
- package/ios/RookPermissions.swift +33 -5
- package/ios/RookPermissionsModule.h +5 -0
- package/ios/RookPermissionsModule.mm +20 -0
- package/ios/RookSdk.h +2 -14
- package/ios/RookSdk.mm +97 -546
- package/ios/RookSources.swift +54 -60
- package/ios/RookSourcesModule.h +5 -0
- package/ios/RookSourcesModule.mm +18 -0
- package/ios/RookSync.h +5 -0
- package/ios/RookSync.m +35 -0
- package/ios/RookSync.swift +78 -48
- package/ios/SwiftTest.swift +18 -0
- package/ios/react-native-rook-sdk-Bridging-Header.h +12 -0
- package/{src/context/RookSyncGateContext.ts → lib/commonjs/context/RookSyncGateContext.js} +13 -10
- package/lib/commonjs/context/RookSyncGateContext.js.map +1 -0
- package/lib/commonjs/context/RookSyncGateProvider.js +108 -0
- package/lib/commonjs/context/RookSyncGateProvider.js.map +1 -0
- package/{src/context/RookSyncGateReducer.ts → lib/commonjs/context/RookSyncGateReducer.js} +44 -13
- package/lib/commonjs/context/RookSyncGateReducer.js.map +1 -0
- package/lib/commonjs/context/RookSyncGateTypes.js +6 -0
- package/lib/commonjs/context/RookSyncGateTypes.js.map +1 -0
- package/lib/commonjs/context/index.js +14 -0
- package/lib/commonjs/context/index.js.map +1 -0
- package/lib/commonjs/hooks/index.js +76 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/{src/hooks/useRookAPISources.ts → lib/commonjs/hooks/useRookAPISources.js} +36 -40
- package/lib/commonjs/hooks/useRookAPISources.js.map +1 -0
- package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js +88 -0
- package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js.map +1 -0
- package/lib/commonjs/hooks/useRookAppleHealth.js +63 -0
- package/lib/commonjs/hooks/useRookAppleHealth.js.map +1 -0
- package/lib/commonjs/hooks/useRookConfiguration.js +113 -0
- package/lib/commonjs/hooks/useRookConfiguration.js.map +1 -0
- package/lib/commonjs/hooks/useRookData.js +116 -0
- package/lib/commonjs/hooks/useRookData.js.map +1 -0
- package/lib/commonjs/hooks/useRookHealthConnect.js +70 -0
- package/lib/commonjs/hooks/useRookHealthConnect.js.map +1 -0
- package/lib/commonjs/hooks/useRookPermissions.js +211 -0
- package/lib/commonjs/hooks/useRookPermissions.js.map +1 -0
- package/lib/commonjs/hooks/useRookSamsungHealth.js +54 -0
- package/lib/commonjs/hooks/useRookSamsungHealth.js.map +1 -0
- package/lib/commonjs/hooks/useRookSync.js +148 -0
- package/lib/commonjs/hooks/useRookSync.js.map +1 -0
- package/lib/commonjs/hooks/useRookVariables.js +93 -0
- package/lib/commonjs/hooks/useRookVariables.js.map +1 -0
- package/lib/commonjs/index.js +121 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/modules/hook/useRookAutoSync.js +261 -0
- package/lib/commonjs/modules/hook/useRookAutoSync.js.map +1 -0
- package/lib/commonjs/modules/types/sendMessageBroadcast.js +2 -0
- package/lib/commonjs/modules/types/sendMessageBroadcast.js.map +1 -0
- package/lib/commonjs/modules/utils/errors.js +12 -0
- package/lib/commonjs/modules/utils/errors.js.map +1 -0
- package/lib/commonjs/types/ActivityEvent.js +6 -0
- package/lib/commonjs/types/ActivityEvent.js.map +1 -0
- package/lib/commonjs/types/AppleHealthNutritionEvent.js +77 -0
- package/lib/commonjs/types/AppleHealthNutritionEvent.js.map +1 -0
- package/lib/{module/NativeRookSdk.js → commonjs/types/AppleHealthPermissions.js} +7 -45
- package/lib/commonjs/types/AppleHealthPermissions.js.map +1 -0
- package/lib/commonjs/types/AuthorizedSources.js +6 -0
- package/lib/commonjs/types/AuthorizedSources.js.map +1 -0
- package/lib/commonjs/types/BodySummary.js +6 -0
- package/lib/{module/types/Rook.js.map → commonjs/types/BodySummary.js.map} +1 -1
- package/lib/commonjs/types/DataSource.js +16 -0
- package/lib/commonjs/types/DataSource.js.map +1 -0
- package/lib/commonjs/types/DiagnosticState.js +2 -0
- package/lib/commonjs/types/DiagnosticState.js.map +1 -0
- package/lib/commonjs/types/HCMealData.js +65 -0
- package/lib/commonjs/types/HCMealData.js.map +1 -0
- package/lib/commonjs/types/HeartRateEvent.js +2 -0
- package/lib/commonjs/types/HeartRateEvent.js.map +1 -0
- package/lib/commonjs/types/PermissionsType.js +2 -0
- package/lib/commonjs/types/PermissionsType.js.map +1 -0
- package/lib/commonjs/types/PhysicalSummary.js +6 -0
- package/lib/commonjs/types/PhysicalSummary.js.map +1 -0
- package/lib/commonjs/types/SDKSources.js +13 -0
- package/lib/commonjs/types/SDKSources.js.map +1 -0
- package/lib/commonjs/types/SamsungHealthPermissions.js +23 -0
- package/lib/commonjs/types/SamsungHealthPermissions.js.map +1 -0
- package/lib/commonjs/types/SleepSummary.js +6 -0
- package/lib/commonjs/types/SleepSummary.js.map +1 -0
- package/lib/commonjs/types/SummaryTypes.js +2 -0
- package/lib/commonjs/types/SummaryTypes.js.map +1 -0
- package/lib/commonjs/types/SyncTypes.js +33 -0
- package/lib/commonjs/types/SyncTypes.js.map +1 -0
- package/lib/commonjs/types/WriteNutrition.js +18 -0
- package/lib/commonjs/types/WriteNutrition.js.map +1 -0
- package/lib/commonjs/utils/getNativeModule.js +29 -0
- package/lib/commonjs/utils/getNativeModule.js.map +1 -0
- package/lib/commonjs/utils/getRookModule.js +28 -0
- package/lib/commonjs/utils/getRookModule.js.map +1 -0
- package/{src/utils/isModuleReady.ts → lib/commonjs/utils/isModuleReady.js} +10 -4
- package/lib/commonjs/utils/isModuleReady.js.map +1 -0
- package/lib/commonjs/utils/isRunningOnAndroid.js +15 -0
- package/lib/commonjs/utils/isRunningOnAndroid.js.map +1 -0
- package/lib/commonjs/utils/isRunningOniOS.js +15 -0
- package/lib/commonjs/utils/isRunningOniOS.js.map +1 -0
- package/lib/commonjs/utils/isValidDate.js +41 -0
- package/lib/commonjs/utils/isValidDate.js.map +1 -0
- package/lib/commonjs/utils/nativeModules.js +29 -0
- package/lib/commonjs/utils/nativeModules.js.map +1 -0
- package/lib/commonjs/utils/packageInfo.js +13 -0
- package/lib/commonjs/utils/packageInfo.js.map +1 -0
- package/lib/module/context/RookSyncGateContext.js +0 -2
- package/lib/module/context/RookSyncGateContext.js.map +1 -1
- package/lib/module/context/RookSyncGateProvider.js +31 -22
- package/lib/module/context/RookSyncGateProvider.js.map +1 -1
- package/lib/module/context/RookSyncGateReducer.js +12 -4
- package/lib/module/context/RookSyncGateReducer.js.map +1 -1
- package/lib/module/context/RookSyncGateTypes.js +0 -2
- package/lib/module/context/index.js +2 -0
- package/lib/module/context/index.js.map +1 -0
- package/lib/module/hooks/index.js +11 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useRookAPISources.js +16 -10
- package/lib/module/hooks/useRookAPISources.js.map +1 -1
- package/lib/module/hooks/useRookAndroidBackgroundSteps.js +12 -11
- package/lib/module/hooks/useRookAndroidBackgroundSteps.js.map +1 -1
- package/lib/module/hooks/useRookAppleHealth.js +10 -9
- package/lib/module/hooks/useRookAppleHealth.js.map +1 -1
- package/lib/module/hooks/useRookConfiguration.js +34 -10
- package/lib/module/hooks/useRookConfiguration.js.map +1 -1
- package/lib/module/hooks/useRookData.js +45 -31
- package/lib/module/hooks/useRookData.js.map +1 -1
- package/lib/module/hooks/useRookHealthConnect.js +10 -9
- package/lib/module/hooks/useRookHealthConnect.js.map +1 -1
- package/lib/module/hooks/useRookPermissions.js +49 -26
- package/lib/module/hooks/useRookPermissions.js.map +1 -1
- package/lib/module/hooks/useRookSamsungHealth.js +20 -8
- package/lib/module/hooks/useRookSamsungHealth.js.map +1 -1
- package/lib/module/hooks/useRookSync.js +32 -23
- package/lib/module/hooks/useRookSync.js.map +1 -1
- package/lib/module/hooks/useRookVariables.js +37 -19
- package/lib/module/hooks/useRookVariables.js.map +1 -1
- package/lib/module/index.js +10 -18
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/hook/useRookAutoSync.js +40 -27
- package/lib/module/modules/hook/useRookAutoSync.js.map +1 -1
- package/lib/module/modules/types/sendMessageBroadcast.js +1 -1
- package/lib/module/modules/utils/errors.js +0 -2
- package/lib/module/modules/utils/errors.js.map +1 -1
- package/lib/module/types/ActivityEvent.js +0 -2
- package/lib/module/types/AppleHealthNutritionEvent.js +70 -0
- package/lib/module/types/AppleHealthNutritionEvent.js.map +1 -0
- package/lib/module/types/AppleHealthPermissions.js +0 -2
- package/lib/module/types/AppleHealthPermissions.js.map +1 -1
- package/lib/module/types/AuthorizedSources.js +0 -2
- package/lib/module/types/BodySummary.js +0 -2
- package/lib/module/types/DataSource.js +0 -2
- package/lib/module/types/DataSource.js.map +1 -1
- package/lib/module/types/DiagnosticState.js +2 -0
- package/lib/module/types/DiagnosticState.js.map +1 -0
- package/lib/module/types/HCMealData.js +59 -0
- package/lib/module/types/HCMealData.js.map +1 -0
- package/lib/module/types/HeartRateEvent.js +1 -1
- package/lib/module/types/PermissionsType.js +1 -1
- package/lib/module/types/PhysicalSummary.js +0 -2
- package/lib/module/types/SDKSources.js +0 -2
- package/lib/module/types/SDKSources.js.map +1 -1
- package/lib/module/types/SamsungHealthPermissions.js +0 -3
- package/lib/module/types/SamsungHealthPermissions.js.map +1 -1
- package/lib/module/types/SleepSummary.js +0 -2
- package/lib/module/types/SummaryTypes.js +1 -1
- package/lib/module/types/SyncTypes.js +0 -2
- package/lib/module/types/SyncTypes.js.map +1 -1
- package/lib/module/types/WriteNutrition.js +12 -0
- package/lib/module/types/WriteNutrition.js.map +1 -0
- package/lib/module/utils/getNativeModule.js +23 -0
- package/lib/module/utils/getNativeModule.js.map +1 -0
- package/lib/module/utils/getRookModule.js +22 -0
- package/lib/module/utils/getRookModule.js.map +1 -0
- package/lib/module/utils/isModuleReady.js +0 -2
- package/lib/module/utils/isModuleReady.js.map +1 -1
- package/lib/module/utils/isRunningOnAndroid.js +0 -2
- package/lib/module/utils/isRunningOnAndroid.js.map +1 -1
- package/lib/module/utils/isRunningOniOS.js +0 -2
- package/lib/module/utils/isRunningOniOS.js.map +1 -1
- package/lib/module/utils/isValidDate.js +20 -2
- package/lib/module/utils/isValidDate.js.map +1 -1
- package/lib/module/utils/nativeModules.js +23 -0
- package/lib/module/utils/nativeModules.js.map +1 -0
- package/lib/module/utils/packageInfo.js +7 -0
- package/lib/module/utils/packageInfo.js.map +1 -0
- package/lib/typescript/src/context/RookSyncGateContext.d.ts.map +1 -1
- package/lib/typescript/src/context/RookSyncGateProvider.d.ts.map +1 -1
- package/lib/typescript/src/context/RookSyncGateReducer.d.ts.map +1 -1
- package/lib/typescript/src/context/RookSyncGateTypes.d.ts +14 -4
- package/lib/typescript/src/context/RookSyncGateTypes.d.ts.map +1 -1
- package/lib/typescript/src/context/index.d.ts +2 -0
- package/lib/typescript/src/context/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +11 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useRookAPISources.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookAndroidBackgroundSteps.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookAppleHealth.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookConfiguration.d.ts +3 -1
- package/lib/typescript/src/hooks/useRookConfiguration.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookData.d.ts +2 -2
- package/lib/typescript/src/hooks/useRookData.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookHealthConnect.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookPermissions.d.ts +2 -0
- package/lib/typescript/src/hooks/useRookPermissions.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookSamsungHealth.d.ts +6 -0
- package/lib/typescript/src/hooks/useRookSamsungHealth.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookSync.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookVariables.d.ts +2 -0
- package/lib/typescript/src/hooks/useRookVariables.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +8 -17
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/modules/hook/useRookAutoSync.d.ts.map +1 -1
- package/lib/typescript/src/types/AppleHealthNutritionEvent.d.ts +76 -0
- package/lib/typescript/src/types/AppleHealthNutritionEvent.d.ts.map +1 -0
- package/lib/typescript/src/types/AuthorizedSources.d.ts +0 -11
- package/lib/typescript/src/types/AuthorizedSources.d.ts.map +1 -1
- package/lib/typescript/src/types/DiagnosticState.d.ts +13 -0
- package/lib/typescript/src/types/DiagnosticState.d.ts.map +1 -0
- package/lib/typescript/src/types/HCMealData.d.ts +60 -0
- package/lib/typescript/src/types/HCMealData.d.ts.map +1 -0
- package/lib/typescript/src/types/HeartRateEvent.d.ts +2 -2
- package/lib/typescript/src/types/HeartRateEvent.d.ts.map +1 -1
- package/lib/typescript/src/types/SamsungHealthPermissions.d.ts +0 -1
- package/lib/typescript/src/types/SamsungHealthPermissions.d.ts.map +1 -1
- package/lib/typescript/src/types/SyncTypes.d.ts +1 -5
- package/lib/typescript/src/types/SyncTypes.d.ts.map +1 -1
- package/lib/typescript/src/types/WriteNutrition.d.ts +61 -0
- package/lib/typescript/src/types/WriteNutrition.d.ts.map +1 -0
- package/lib/typescript/src/utils/getNativeModule.d.ts +10 -0
- package/lib/typescript/src/utils/getNativeModule.d.ts.map +1 -0
- package/lib/typescript/src/utils/getRookModule.d.ts +9 -0
- package/lib/typescript/src/utils/getRookModule.d.ts.map +1 -0
- package/lib/typescript/src/utils/isModuleReady.d.ts.map +1 -1
- package/lib/typescript/src/utils/isValidDate.d.ts +8 -0
- package/lib/typescript/src/utils/isValidDate.d.ts.map +1 -1
- package/lib/typescript/src/utils/nativeModules.d.ts +24 -0
- package/lib/typescript/src/utils/nativeModules.d.ts.map +1 -0
- package/lib/typescript/src/utils/packageInfo.d.ts +6 -0
- package/lib/typescript/src/utils/packageInfo.d.ts.map +1 -0
- package/package.json +98 -94
- package/react-native-rook-sdk.podspec +45 -0
- package/RNRookSdk.podspec +0 -22
- package/ios/Encodable.swift +0 -25
- package/ios/RookEntry.swift +0 -61
- package/ios/RookSdk-Bridging-Header.h +0 -12
- package/ios/boost-boost_privacy-Bridging-Header.h +0 -4
- package/lib/module/NativeRookSdk.js.map +0 -1
- package/lib/module/package.json +0 -1
- package/lib/module/types/Rook.js +0 -2
- package/lib/typescript/package.json +0 -1
- package/lib/typescript/src/NativeRookSdk.d.ts +0 -190
- package/lib/typescript/src/NativeRookSdk.d.ts.map +0 -1
- package/lib/typescript/src/types/Rook.d.ts +0 -9
- package/lib/typescript/src/types/Rook.d.ts.map +0 -1
- package/src/NativeRookSdk.ts +0 -281
- package/src/context/RookSyncGateProvider.tsx +0 -78
- package/src/context/RookSyncGateTypes.ts +0 -34
- package/src/hooks/useRookAndroidBackgroundSteps.ts +0 -81
- package/src/hooks/useRookAppleHealth.ts +0 -55
- package/src/hooks/useRookConfiguration.ts +0 -82
- package/src/hooks/useRookData.ts +0 -122
- package/src/hooks/useRookHealthConnect.ts +0 -59
- package/src/hooks/useRookPermissions.ts +0 -224
- package/src/hooks/useRookSamsungHealth.ts +0 -37
- package/src/hooks/useRookSync.ts +0 -157
- package/src/hooks/useRookVariables.ts +0 -77
- package/src/index.tsx +0 -28
- package/src/modules/hook/useRookAutoSync.ts +0 -305
- package/src/modules/types/sendMessageBroadcast.ts +0 -5
- package/src/modules/utils/errors.ts +0 -9
- package/src/types/ActivityEvent.ts +0 -159
- package/src/types/AppleHealthPermissions.ts +0 -49
- package/src/types/AuthorizedSources.ts +0 -33
- package/src/types/BodySummary.ts +0 -116
- package/src/types/DataSource.ts +0 -16
- package/src/types/HeartRateEvent.ts +0 -26
- package/src/types/PermissionsType.ts +0 -9
- package/src/types/PhysicalSummary.ts +0 -84
- package/src/types/Rook.ts +0 -8
- package/src/types/SDKSources.ts +0 -5
- package/src/types/SamsungHealthPermissions.ts +0 -16
- package/src/types/SleepSummary.ts +0 -66
- package/src/types/SummaryTypes.ts +0 -70
- package/src/types/SyncTypes.ts +0 -63
- package/src/utils/isRunningOnAndroid.ts +0 -10
- package/src/utils/isRunningOniOS.ts +0 -10
- package/src/utils/isValidDate.ts +0 -15
package/src/index.tsx
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export { default as RookSdk } from './NativeRookSdk';
|
|
2
|
-
|
|
3
|
-
export { default as RookSyncGate } from './context/RookSyncGateProvider';
|
|
4
|
-
|
|
5
|
-
export { useRookAPISources } from './hooks/useRookAPISources';
|
|
6
|
-
export { useRookAppleHealth } from './hooks/useRookAppleHealth';
|
|
7
|
-
export { useRookConfiguration } from './hooks/useRookConfiguration';
|
|
8
|
-
export { useRookPermissions } from './hooks/useRookPermissions';
|
|
9
|
-
export { useRookData } from './hooks/useRookData';
|
|
10
|
-
export { useRookAndroidBackgroundSteps } from './hooks/useRookAndroidBackgroundSteps';
|
|
11
|
-
export { useRookHealthConnect } from './hooks/useRookHealthConnect';
|
|
12
|
-
export { useRookSamsungHealth } from './hooks/useRookSamsungHealth';
|
|
13
|
-
export { useRookVariables } from './hooks/useRookVariables';
|
|
14
|
-
export { useRookSync } from './hooks/useRookSync';
|
|
15
|
-
|
|
16
|
-
export { APIDataSource } from './types/DataSource';
|
|
17
|
-
export { SDKDataSource } from './types/SDKSources';
|
|
18
|
-
export { AppleHealthPermission } from './types/AppleHealthPermissions';
|
|
19
|
-
export { type SamsungHealthPermission } from './types/SamsungHealthPermissions';
|
|
20
|
-
export { type PhysicalSummary } from './types/PhysicalSummary';
|
|
21
|
-
export { type BodySummary } from './types/BodySummary';
|
|
22
|
-
export { type SleepSummary } from './types/SleepSummary';
|
|
23
|
-
export {
|
|
24
|
-
SharedHealthEvents,
|
|
25
|
-
UniqueAppleHealthEvents,
|
|
26
|
-
UniqueSamsungHealthEvents,
|
|
27
|
-
UniqueHealthConnectEvents,
|
|
28
|
-
} from './types/SyncTypes';
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
-
import RookSdk from '../../NativeRookSdk';
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { AppState, Platform } from 'react-native';
|
|
5
|
-
import type { RookSyncGateState } from '../../context/RookSyncGateTypes';
|
|
6
|
-
import { errors } from '../utils/errors';
|
|
7
|
-
import type { Message } from '../types/sendMessageBroadcast';
|
|
8
|
-
import { AppleHealthPermission } from '../../types/AppleHealthPermissions';
|
|
9
|
-
|
|
10
|
-
type StartBackgroundSync = {
|
|
11
|
-
state: RookSyncGateState;
|
|
12
|
-
enableBackground: boolean;
|
|
13
|
-
enableLogs: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const MESSAGE_TYPE = 'ROOK_BACKGROUND_ENABLED';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The above TypeScript code defines a function `useRookAutoSync` that handles background
|
|
20
|
-
* synchronization, including user ID validation and error messaging.
|
|
21
|
-
* @property {boolean} enableBackground - The `enableBackground` property in the `useRookAutoSync`
|
|
22
|
-
* function determines whether background synchronization should be enabled. If `enableBackground` is
|
|
23
|
-
* set to `true`, the function will listen for changes in the app state and trigger the
|
|
24
|
-
* `startBackgroundSync` function when the app transitions from
|
|
25
|
-
* @property {boolean} enableLogs - The `enableLogs` property in the `useRookAutoSync` function is a
|
|
26
|
-
* boolean value that determines whether logging should be enabled or not. If `enableLogs` is set to
|
|
27
|
-
* `true`, logging messages will be displayed in the console to provide information about the
|
|
28
|
-
* background synchronization process. If `
|
|
29
|
-
* @property {RookSyncGateState} state - The `state` property in the `useRookAutoSync` function
|
|
30
|
-
* represents the current state of the RookSyncGate. It includes information such as whether the state
|
|
31
|
-
* is ready, the permissions status, and the user ID associated with the state. This state is used to
|
|
32
|
-
* determine when to start the
|
|
33
|
-
*/
|
|
34
|
-
export const useRookAutoSync = ({
|
|
35
|
-
enableBackground,
|
|
36
|
-
enableLogs,
|
|
37
|
-
state,
|
|
38
|
-
}: StartBackgroundSync) => {
|
|
39
|
-
const appState = useRef(AppState.currentState);
|
|
40
|
-
const [changeAppState, setChangeState] = useState(0);
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (!enableBackground) return;
|
|
44
|
-
|
|
45
|
-
const subscription = AppState.addEventListener('change', (nextAppState) => {
|
|
46
|
-
if (
|
|
47
|
-
// Check previous state to check if he app was inactive or in background
|
|
48
|
-
// and then pass to be active
|
|
49
|
-
appState.current?.match(/inactive|background/) &&
|
|
50
|
-
nextAppState === 'active'
|
|
51
|
-
) {
|
|
52
|
-
setChangeState((prev) => prev + 1);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
appState.current = nextAppState;
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return () => {
|
|
59
|
-
subscription.remove();
|
|
60
|
-
};
|
|
61
|
-
}, []);
|
|
62
|
-
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (!state.ready || !enableBackground) return;
|
|
65
|
-
|
|
66
|
-
startBackgroundServices();
|
|
67
|
-
}, [state, changeAppState]);
|
|
68
|
-
|
|
69
|
-
const startBackgroundServices = () => {
|
|
70
|
-
const { clientUUID, password, ready } = state;
|
|
71
|
-
|
|
72
|
-
if (!ready || !clientUUID || !password) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (Platform.OS === 'android') {
|
|
77
|
-
startAndroidBackgroundSync();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
startIOSBackgroundSync();
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const isValidUser = async (): Promise<boolean> => {
|
|
85
|
-
try {
|
|
86
|
-
const userID = await RookSdk.getUserID();
|
|
87
|
-
|
|
88
|
-
if (userID) return true;
|
|
89
|
-
|
|
90
|
-
if (enableLogs) console.error(errors.noUserIDAndroidBackground);
|
|
91
|
-
|
|
92
|
-
throw new Error(errors.noUserIDAndroidBackground);
|
|
93
|
-
} catch (error) {
|
|
94
|
-
sendMessageToBroadcast({
|
|
95
|
-
type: 'ROOK_BACKGROUND_ENABLED',
|
|
96
|
-
message: (error as any).message || 'There is not a user id',
|
|
97
|
-
value: false,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const tryToStartBackgroundSync = async (): Promise<boolean> => {
|
|
105
|
-
try {
|
|
106
|
-
const backgroundStatus =
|
|
107
|
-
await RookSdk.checkHealthConnectBackgroundReadStatus();
|
|
108
|
-
|
|
109
|
-
if (backgroundStatus !== 'PERMISSION_GRANTED')
|
|
110
|
-
throw new Error('No permission granted or not available');
|
|
111
|
-
|
|
112
|
-
const result = await RookSdk.scheduleBackgroundSync(enableLogs);
|
|
113
|
-
|
|
114
|
-
return result;
|
|
115
|
-
} catch (error) {
|
|
116
|
-
sendMessageToBroadcast({
|
|
117
|
-
type: 'ROOK_BACKGROUND_ENABLED',
|
|
118
|
-
message:
|
|
119
|
-
(error as any).message ||
|
|
120
|
-
'Health Connect background is not available on the device or the user does not grants permission',
|
|
121
|
-
value: false,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const tryToStartForegroundSync = async (): Promise<boolean> => {
|
|
129
|
-
try {
|
|
130
|
-
const hasHCPermissions =
|
|
131
|
-
await RookSdk.healthConnectHasPartialPermissions();
|
|
132
|
-
const hasAndroidPermissions =
|
|
133
|
-
await RookSdk.androidHasBackgroundPermissions();
|
|
134
|
-
|
|
135
|
-
if (!hasHCPermissions || !hasAndroidPermissions) {
|
|
136
|
-
if (enableLogs) console.error(errors.autoStartAndroidBackgroundSync);
|
|
137
|
-
|
|
138
|
-
throw new Error(errors.autoStartAndroidBackgroundSync);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (AppState.currentState === 'active' && appState.current === 'active') {
|
|
142
|
-
await RookSdk.enableBackgroundAndroidSteps();
|
|
143
|
-
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return false;
|
|
148
|
-
} catch (error) {
|
|
149
|
-
sendMessageToBroadcast({
|
|
150
|
-
type: 'ROOK_BACKGROUND_ENABLED',
|
|
151
|
-
value: false,
|
|
152
|
-
message: (error as Error).message,
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const tryToStartSamsungHealthSync = async (): Promise<boolean> => {
|
|
160
|
-
try {
|
|
161
|
-
const isAvailable = await RookSdk.checkSamsungAvailability();
|
|
162
|
-
|
|
163
|
-
if (isAvailable !== 'INSTALLED') return false;
|
|
164
|
-
|
|
165
|
-
await RookSdk.enableSamsungSync();
|
|
166
|
-
|
|
167
|
-
return true;
|
|
168
|
-
} catch (error) {
|
|
169
|
-
sendMessageToBroadcast({
|
|
170
|
-
type: 'ROOK_BACKGROUND_ENABLED',
|
|
171
|
-
value: false,
|
|
172
|
-
message: (error as Error).message,
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* The function `startAndroidBackgroundSync` in TypeScript initiates background synchronization for an
|
|
181
|
-
* Android app, handling user ID validation and error messaging.
|
|
182
|
-
* @returns If the `userID` is not available, an error message is logged and a message is sent to
|
|
183
|
-
* broadcast with `value` set to `false`. If an error occurs during the process, a message is sent to
|
|
184
|
-
* broadcast with `value` set to `false` and an error message is logged.
|
|
185
|
-
*/
|
|
186
|
-
const startAndroidBackgroundSync = async () => {
|
|
187
|
-
const { clientUUID, password, ready } = state;
|
|
188
|
-
|
|
189
|
-
if (!ready || !clientUUID || !password) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
try {
|
|
194
|
-
const enabledSources = [];
|
|
195
|
-
|
|
196
|
-
const isValid = await isValidUser();
|
|
197
|
-
if (!isValid) return;
|
|
198
|
-
|
|
199
|
-
const isSamsungEnabled = await tryToStartSamsungHealthSync();
|
|
200
|
-
const isEnabled = await tryToStartBackgroundSync();
|
|
201
|
-
|
|
202
|
-
if (isSamsungEnabled) enabledSources.push('Samsung Health');
|
|
203
|
-
if (isEnabled) enabledSources.push('Health Connect');
|
|
204
|
-
|
|
205
|
-
if (!isEnabled) {
|
|
206
|
-
const isForegroundEnabled = await tryToStartForegroundSync();
|
|
207
|
-
|
|
208
|
-
if (!isForegroundEnabled && !isSamsungEnabled)
|
|
209
|
-
throw new Error("We couldn't start background sync");
|
|
210
|
-
|
|
211
|
-
if (isForegroundEnabled) enabledSources.push('Foreground Service');
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
sendMessageToBroadcast({
|
|
215
|
-
type: 'ROOK_BACKGROUND_ENABLED',
|
|
216
|
-
value: true,
|
|
217
|
-
message: `via: ${enabledSources.join(', ')}`,
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
if (enableLogs) console.log('ROOK - Background enabled successfully');
|
|
221
|
-
} catch (error) {
|
|
222
|
-
sendMessageToBroadcast({
|
|
223
|
-
type: 'ROOK_BACKGROUND_ENABLED',
|
|
224
|
-
message: (error as any).message,
|
|
225
|
-
value: false,
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* The function `startIOSBackgroundSync` in TypeScript initiates background synchronization for an
|
|
232
|
-
* iOS app, handling user ID validation and error messaging.
|
|
233
|
-
* @returns If the `userID` is not available, an error message is logged and a message is sent to
|
|
234
|
-
* broadcast with `value` set to `false`. If an error occurs during the process, a message is sent to
|
|
235
|
-
* broadcast with `value` set to `false` and an error message is logged.
|
|
236
|
-
*/
|
|
237
|
-
const startIOSBackgroundSync = async () => {
|
|
238
|
-
try {
|
|
239
|
-
const userID = await RookSdk.getUserID();
|
|
240
|
-
|
|
241
|
-
if (!userID) {
|
|
242
|
-
if (enableLogs) console.error(errors.noUserIDAndroidBackground);
|
|
243
|
-
|
|
244
|
-
sendMessageToBroadcast({
|
|
245
|
-
type: MESSAGE_TYPE,
|
|
246
|
-
value: false,
|
|
247
|
-
message: errors.noUserIDAndroidBackground,
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const status = await RookSdk.appleHealthHasPermissions(
|
|
254
|
-
AppleHealthPermission.STEP_COUNT
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
if (status === 'PERMISSION_NOT_REQUESTED')
|
|
258
|
-
throw new Error('Permissions required');
|
|
259
|
-
|
|
260
|
-
await RookSdk.enableBackGroundUpdates();
|
|
261
|
-
|
|
262
|
-
RookSdk.sync(() => {
|
|
263
|
-
sendMessageToBroadcast({
|
|
264
|
-
type: MESSAGE_TYPE,
|
|
265
|
-
value: true,
|
|
266
|
-
message: 'Some data has already uploaded',
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
sendMessageToBroadcast({
|
|
271
|
-
type: MESSAGE_TYPE,
|
|
272
|
-
value: true,
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
if (enableLogs) console.log('ROOK - Background enabled successfully');
|
|
276
|
-
} catch (err) {
|
|
277
|
-
const error = err as any;
|
|
278
|
-
|
|
279
|
-
sendMessageToBroadcast({
|
|
280
|
-
type: MESSAGE_TYPE,
|
|
281
|
-
value: false,
|
|
282
|
-
message: errors.autoStartIOSBackgroundSync,
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
if (enableLogs) {
|
|
286
|
-
if (error.message && (error.message as string).includes('emptyUserId'))
|
|
287
|
-
console.error(errors.noUserIDAndroidBackground);
|
|
288
|
-
else console.error(errors.autoStartIOSBackgroundSync);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* The function `sendMessageToBroadcast` sends a message to be broadcasted using a Rook module.
|
|
295
|
-
* @param {Message} message - The `message` parameter is of type `Message`, which is likely an object
|
|
296
|
-
* containing information to be sent as a broadcast message.
|
|
297
|
-
*/
|
|
298
|
-
const sendMessageToBroadcast = (message: Message): void => {
|
|
299
|
-
RookSdk.sendMessage(message);
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
return {
|
|
303
|
-
startBackgroundServices,
|
|
304
|
-
};
|
|
305
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const errors = {
|
|
2
|
-
autoStartAndroidBackgroundSync:
|
|
3
|
-
'ROOK - We try to start the health connect background sync but some permissions are missing, please grant permissions on health connect and android permissions, https://docs.tryrook.io/docs/rookconnect/sdk/reactnative/fundamentals/grantpermissons/#request-permissions',
|
|
4
|
-
|
|
5
|
-
autoStartIOSBackgroundSync:
|
|
6
|
-
'ROOK - We try to start the background sync but some error occurred please check the permissions are granted and data exists in the device, https://docs.tryrook.io/docs/rookconnect/sdk/reactnative/fundamentals/grantpermissons/#request-permissions',
|
|
7
|
-
noUserIDAndroidBackground:
|
|
8
|
-
"ROOK - We couldn't start the background sync cause there is no user registered, https://docs.tryrook.io/docs/rookconnect/sdk/reactnative/fundamentals/updateuserid/",
|
|
9
|
-
};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ActivityLevelGranularData,
|
|
3
|
-
ElevationGranularData,
|
|
4
|
-
FloorsClimbedGranularData,
|
|
5
|
-
HrGranularData,
|
|
6
|
-
HrvRmssdGranularData,
|
|
7
|
-
HrvSdnnGranularData,
|
|
8
|
-
SaturationGranularData,
|
|
9
|
-
StepsGranularData,
|
|
10
|
-
SwimmingDistanceGranularData,
|
|
11
|
-
TraveledDistanceGranularData,
|
|
12
|
-
Vo2GranularData,
|
|
13
|
-
} from './SummaryTypes';
|
|
14
|
-
|
|
15
|
-
export interface SpeedGranularData {
|
|
16
|
-
dateTime: string;
|
|
17
|
-
intervalDurationSeconds: number;
|
|
18
|
-
speedMetersPerSecond: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface VelocityObject {
|
|
22
|
-
speedMetersPerSecond: number;
|
|
23
|
-
direction: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface CadenceGranularData {
|
|
27
|
-
dateTime: string;
|
|
28
|
-
intervalDurationSeconds: number;
|
|
29
|
-
cadenceRpm: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface TorqueGranularData {
|
|
33
|
-
dateTime: string;
|
|
34
|
-
intervalDurationSeconds: number;
|
|
35
|
-
torqueNewtonMeters: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface LapGranularData {
|
|
39
|
-
dateTime: string;
|
|
40
|
-
intervalDurationSeconds: number;
|
|
41
|
-
laps: number;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface PositionObject {
|
|
45
|
-
latDeg: number;
|
|
46
|
-
lngDeg: number;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface PositionGranularData {
|
|
50
|
-
dateTime: string;
|
|
51
|
-
intervalDurationSeconds: number;
|
|
52
|
-
latDeg: number;
|
|
53
|
-
lngDeg: number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface PowerGranularData {
|
|
57
|
-
dateTime: string;
|
|
58
|
-
intervalDurationSeconds: number;
|
|
59
|
-
powerWatts: number;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface TssGranularData {
|
|
63
|
-
dateTime: string;
|
|
64
|
-
intervalDurationSeconds: number;
|
|
65
|
-
tssScore: number;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// --- Interfaz SHActivityEvent Completa ---
|
|
69
|
-
export interface ActivityEvent {
|
|
70
|
-
dateTime: string;
|
|
71
|
-
sourceOfData: string;
|
|
72
|
-
wasTheUserUnderPhysicalActivity: boolean;
|
|
73
|
-
activityStartDateTime: string;
|
|
74
|
-
activityEndDateTime: string;
|
|
75
|
-
activityDurationSeconds: number;
|
|
76
|
-
activityTypeName: string;
|
|
77
|
-
activeSeconds: number | null;
|
|
78
|
-
restSeconds: number | null;
|
|
79
|
-
lowIntensitySeconds: number | null;
|
|
80
|
-
moderateIntensitySeconds: number | null;
|
|
81
|
-
vigorousIntensitySeconds: number | null;
|
|
82
|
-
inactivitySeconds: number | null;
|
|
83
|
-
activityLevelGranularData: ActivityLevelGranularData[] | null;
|
|
84
|
-
continuousInactivePeriods: number | null;
|
|
85
|
-
activityStrainLevel: number | null;
|
|
86
|
-
activityWorkKilojoules: number | null;
|
|
87
|
-
activityEnergyKilojoules: number | null;
|
|
88
|
-
activityEnergyPlannedKilojoules: number | null;
|
|
89
|
-
caloriesNetIntakeKcal: number | null;
|
|
90
|
-
caloriesExpenditureKcal: number | null;
|
|
91
|
-
caloriesNetActiveKcal: number | null;
|
|
92
|
-
caloriesBasalMetabolicRateKcal: number | null;
|
|
93
|
-
fatPercentageOfCalories: number | null;
|
|
94
|
-
carbohydratePercentageOfCalories: number | null;
|
|
95
|
-
proteinPercentageOfCalories: number | null;
|
|
96
|
-
steps: number | null;
|
|
97
|
-
stepsGranularData: StepsGranularData[] | null;
|
|
98
|
-
walkedDistanceMeters: number | null;
|
|
99
|
-
traveledDistanceMeters: number | null;
|
|
100
|
-
traveledDistanceGranularData: TraveledDistanceGranularData[] | null;
|
|
101
|
-
floorsClimbed: number | null;
|
|
102
|
-
floorsClimbedGranularData: FloorsClimbedGranularData[] | null;
|
|
103
|
-
elevationAvgAltitudeMeters: number | null;
|
|
104
|
-
elevationMinimumAltitudeMeters: number | null;
|
|
105
|
-
elevationMaximumAltitudeMeters: number | null;
|
|
106
|
-
elevationLossActualAltitudeMeters: number | null;
|
|
107
|
-
elevationGainActualAltitudeMeters: number | null;
|
|
108
|
-
elevationPlannedGainMeters: number | null;
|
|
109
|
-
elevationGranularData: ElevationGranularData[] | null;
|
|
110
|
-
swimmingNumStrokes: number | null;
|
|
111
|
-
swimmingNumLaps: number | null;
|
|
112
|
-
swimmingPoolLengthMeters: number | null;
|
|
113
|
-
swimmingTotalDistanceMeters: number | null;
|
|
114
|
-
swimmingDistanceGranularData: SwimmingDistanceGranularData[] | null;
|
|
115
|
-
hrMaximumBpm: number | null;
|
|
116
|
-
hrMinimumBpm: number | null;
|
|
117
|
-
hrAvgBpm: number | null;
|
|
118
|
-
hrRestingBpm: number | null;
|
|
119
|
-
hrGranularData: HrGranularData[] | null;
|
|
120
|
-
hrvAvgRmssd: number | null;
|
|
121
|
-
hrvAvgSdnn: number | null;
|
|
122
|
-
hrvSdnnGranularData: HrvSdnnGranularData[] | null;
|
|
123
|
-
hrvRmssdGranularData: HrvRmssdGranularData[] | null;
|
|
124
|
-
speedNormalizedMetersPerSecond: number | null;
|
|
125
|
-
speedAvgMetersPerSecond: number | null;
|
|
126
|
-
speedMaximumMetersPerSecond: number | null;
|
|
127
|
-
speedGranularData: SpeedGranularData[] | null;
|
|
128
|
-
velocityAvg: VelocityObject | null;
|
|
129
|
-
velocityMaximum: VelocityObject | null;
|
|
130
|
-
paceAvgMinPerKm: number | null;
|
|
131
|
-
paceMaximumMinPerKm: number | null;
|
|
132
|
-
cadenceAvgRpm: number | null;
|
|
133
|
-
cadenceMaximumRpm: number | null;
|
|
134
|
-
cadenceGranularData: CadenceGranularData[] | null;
|
|
135
|
-
torqueAvgNewtonMeters: number | null;
|
|
136
|
-
torqueMaximumNewtonMeters: number | null;
|
|
137
|
-
torqueGranularData: TorqueGranularData[] | null;
|
|
138
|
-
lapGranularData: LapGranularData[] | null;
|
|
139
|
-
saturationAvgPercentage: number | null;
|
|
140
|
-
saturationGranularData: SaturationGranularData[] | null;
|
|
141
|
-
vo2MaxMlPerMinPerKg: number | null;
|
|
142
|
-
vo2GranularData: Vo2GranularData[] | null;
|
|
143
|
-
positionStart: PositionObject | null;
|
|
144
|
-
positionCentroid: PositionObject | null;
|
|
145
|
-
positionEnd: PositionObject | null;
|
|
146
|
-
positionGranularData: PositionGranularData[] | null;
|
|
147
|
-
positionPolylineMapDataSummary: string | null;
|
|
148
|
-
powerAvgWatts: number | null;
|
|
149
|
-
powerMaximumWatts: number | null;
|
|
150
|
-
powerGranularData: PowerGranularData[] | null;
|
|
151
|
-
stressAtRestDurationSeconds: number | null;
|
|
152
|
-
stressDurationSeconds: number | null;
|
|
153
|
-
lowStressDurationSeconds: number | null;
|
|
154
|
-
mediumStressDurationSeconds: number | null;
|
|
155
|
-
highStressDurationSeconds: number | null;
|
|
156
|
-
tssGranularData: TssGranularData[] | null;
|
|
157
|
-
stressAvgLevel: number | null;
|
|
158
|
-
stressMaximumLevel: number | null;
|
|
159
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export enum AppleHealthPermission {
|
|
2
|
-
APPLE_EXERCISE_TIME = 'appleExerciseTime',
|
|
3
|
-
APPLE_MOVE_TIME = 'appleMoveTime',
|
|
4
|
-
APPLE_STAND_TIME = 'appleStandTime',
|
|
5
|
-
BASAL_ENERGY_BURNED = 'basalEnergyBurned',
|
|
6
|
-
ACTIVE_ENERGY_BURNED = 'activeEnergyBurned',
|
|
7
|
-
STEP_COUNT = 'stepCount',
|
|
8
|
-
DISTANCE_CYCLING = 'distanceCycling',
|
|
9
|
-
DISTANCE_WALKING_RUNNING = 'distanceWalkingRunning',
|
|
10
|
-
DISTANCE_SWIMMING = 'distanceSwimming',
|
|
11
|
-
SWIMMING_STROKE_COUNT = 'swimmingStrokeCount',
|
|
12
|
-
FLIGHTS_CLIMBED = 'flightsClimbed',
|
|
13
|
-
WALKING_SPEED = 'walkingSpeed',
|
|
14
|
-
WALKING_STEP_LENGTH = 'walkingStepLength',
|
|
15
|
-
RUNNING_POWER = 'runningPower',
|
|
16
|
-
RUNNING_SPEED = 'runningSpeed',
|
|
17
|
-
HEIGHT = 'height',
|
|
18
|
-
BODY_MASS = 'bodyMass',
|
|
19
|
-
BODY_MASS_INDEX = 'bodyMassIndex',
|
|
20
|
-
WAIST_CIRCUMFERENCE = 'waistCircumference',
|
|
21
|
-
BODY_FAT_PERCENTAGE = 'bodyFatPercentage',
|
|
22
|
-
BODY_TEMPERATURE = 'bodyTemperature',
|
|
23
|
-
BASAL_BODY_TEMPERATURE = 'basalBodyTemperature',
|
|
24
|
-
APPLE_SLEEPING_WRIST_TEMPERATURE = 'appleSleepingWristTemperature',
|
|
25
|
-
HEART_RATE = 'heartRate',
|
|
26
|
-
RESTING_HEART_RATE = 'restingHeartRate',
|
|
27
|
-
WALKING_HEART_RATE_AVERAGE = 'walkingHeartRateAverage',
|
|
28
|
-
HEART_RATE_VARIABILITY_SDNN = 'heartRateVariabilitySDNN',
|
|
29
|
-
ELECTROCARDIOGRAM = 'electrocardiogram',
|
|
30
|
-
WORKOUT = 'workout',
|
|
31
|
-
SLEEP_ANALYSIS = 'sleepAnalysis',
|
|
32
|
-
VO2_MAX = 'vo2Max',
|
|
33
|
-
OXYGEN_SATURATION = 'oxygenSaturation',
|
|
34
|
-
RESPIRATORY_RATE = 'respiratoryRate',
|
|
35
|
-
UV_EXPOSURE = 'uvExposure',
|
|
36
|
-
BIOLOGICAL_SEX = 'biologicalSex',
|
|
37
|
-
DATE_OF_BIRTH = 'dateOfBirth',
|
|
38
|
-
BLOOD_PRESSURE_SYSTOLIC = 'bloodPressureSystolic',
|
|
39
|
-
BLOOD_PRESSURE_DIASTOLIC = 'bloodPressureDiastolic',
|
|
40
|
-
BLOOD_GLUCOSE = 'bloodGlucose',
|
|
41
|
-
DIETARY_ENERGY_CONSUMED = 'dietaryEnergyConsumed',
|
|
42
|
-
DIETARY_PROTEIN = 'dietaryProtein',
|
|
43
|
-
DIETARY_SUGAR = 'dietarySugar',
|
|
44
|
-
DIETARY_FAT_TOTAL = 'dietaryFatTotal',
|
|
45
|
-
DIETARY_CARBOHYDRATES = 'dietaryCarbohydrates',
|
|
46
|
-
DIETARY_FIBER = 'dietaryFiber',
|
|
47
|
-
DIETARY_SODIUM = 'dietarySodium',
|
|
48
|
-
DIETARY_CHOLESTEROL = 'dietaryCholesterol',
|
|
49
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { APIDataSource } from './DataSource';
|
|
2
|
-
|
|
3
|
-
export interface AuthorizedSources {
|
|
4
|
-
android?: boolean;
|
|
5
|
-
appleHealth?: boolean;
|
|
6
|
-
fitbit?: boolean;
|
|
7
|
-
garmin?: boolean;
|
|
8
|
-
healthConnect?: boolean;
|
|
9
|
-
oura?: boolean;
|
|
10
|
-
polar?: boolean;
|
|
11
|
-
whoop?: boolean;
|
|
12
|
-
withings?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type DataSourceAuthorizer = {
|
|
16
|
-
dataSource: string;
|
|
17
|
-
authorized: boolean;
|
|
18
|
-
authorizationUrl?: string;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type DataSourceProps = {
|
|
22
|
-
userID: string;
|
|
23
|
-
dataSource: APIDataSource;
|
|
24
|
-
redirectURL?: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type AuthorizedSource = {
|
|
28
|
-
name: string;
|
|
29
|
-
imageUrl: string;
|
|
30
|
-
authorized: boolean;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type BasicObject = { [key: string]: boolean };
|