react-native-rook-sdk 2.1.2 → 4.0.0-beta.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 +35 -3
- package/RNRookSdk.podspec +22 -0
- package/android/build.gradle +20 -41
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/rooksdk/RookSdkModule.kt +11 -222
- package/android/src/main/java/com/rooksdk/RookSdkPackage.kt +24 -33
- package/ios/DateHelper.swift +55 -0
- package/ios/Encodable.swift +25 -0
- package/ios/EncodableDataSource.swift +5 -6
- package/ios/EncodableDataSourceAuthorizer.swift +3 -4
- package/ios/HearRateMapper.swift +42 -0
- package/ios/RookBackground.swift +35 -0
- package/ios/RookConfiguration.swift +116 -0
- package/ios/RookData.swift +170 -0
- package/ios/RookEntry.swift +61 -0
- package/ios/RookPermissions.swift +78 -0
- package/ios/RookSdk-Bridging-Header.h +12 -0
- package/ios/RookSdk.h +14 -2
- package/ios/RookSdk.mm +549 -81
- package/ios/RookSources.swift +74 -116
- package/ios/RookSync.swift +126 -34
- package/ios/boost-boost_privacy-Bridging-Header.h +4 -0
- package/lib/module/NativeRookSdk.js +96 -0
- package/lib/module/NativeRookSdk.js.map +1 -0
- package/lib/module/context/RookSyncGateContext.js +2 -0
- package/lib/module/context/RookSyncGateContext.js.map +1 -1
- package/lib/module/context/RookSyncGateProvider.js +16 -15
- package/lib/module/context/RookSyncGateProvider.js.map +1 -1
- package/lib/module/context/RookSyncGateReducer.js +2 -0
- package/lib/module/context/RookSyncGateReducer.js.map +1 -1
- package/lib/module/context/RookSyncGateTypes.js +2 -0
- package/lib/module/hooks/useRookAPISources.js +66 -0
- package/lib/module/hooks/useRookAPISources.js.map +1 -0
- package/lib/module/hooks/useRookAndroidBackgroundSteps.js +12 -25
- package/lib/module/hooks/useRookAndroidBackgroundSteps.js.map +1 -1
- package/lib/module/hooks/useRookAppleHealth.js +11 -23
- package/lib/module/hooks/useRookAppleHealth.js.map +1 -1
- package/lib/module/hooks/useRookConfiguration.js +10 -109
- package/lib/module/hooks/useRookConfiguration.js.map +1 -1
- package/lib/module/hooks/useRookData.js +35 -33
- package/lib/module/hooks/useRookData.js.map +1 -1
- package/lib/module/hooks/useRookHealthConnect.js +9 -10
- package/lib/module/hooks/useRookHealthConnect.js.map +1 -1
- package/lib/module/hooks/useRookPermissions.js +39 -77
- package/lib/module/hooks/useRookPermissions.js.map +1 -1
- package/lib/module/hooks/useRookSamsungHealth.js +35 -0
- package/lib/module/hooks/useRookSamsungHealth.js.map +1 -0
- package/lib/module/hooks/useRookSync.js +23 -31
- package/lib/module/hooks/useRookSync.js.map +1 -1
- package/lib/module/hooks/useRookVariables.js +24 -18
- package/lib/module/hooks/useRookVariables.js.map +1 -1
- package/lib/module/index.js +18 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/hook/useRookAutoSync.js +22 -36
- 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 +2 -0
- package/lib/module/modules/utils/errors.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types/ActivityEvent.js +2 -0
- package/lib/module/types/AppleHealthPermissions.js +53 -0
- package/lib/module/types/AppleHealthPermissions.js.map +1 -0
- package/lib/module/types/AuthorizedSources.js +2 -0
- package/lib/module/types/BodySummary.js +2 -0
- package/lib/module/types/DataSource.js +10 -0
- package/lib/module/types/DataSource.js.map +1 -1
- package/lib/module/types/HeartRateEvent.js +2 -0
- package/lib/{commonjs/types/DataSource.js.map → module/types/HeartRateEvent.js.map} +1 -1
- package/lib/module/types/PermissionsType.js +1 -1
- package/lib/module/types/PhysicalSummary.js +2 -0
- package/lib/module/types/Rook.js +2 -0
- package/lib/{commonjs/types/SyncTypes.js.map → module/types/Rook.js.map} +1 -1
- package/lib/module/types/SDKSources.js +2 -0
- package/lib/module/types/SDKSources.js.map +1 -1
- package/lib/module/types/SamsungHealthPermissions.js +3 -0
- package/lib/module/types/SamsungHealthPermissions.js.map +1 -1
- package/lib/module/types/SleepSummary.js +2 -0
- package/lib/module/types/SummaryTypes.js +1 -1
- package/lib/module/types/SyncTypes.js +28 -1
- package/lib/module/types/SyncTypes.js.map +1 -1
- package/lib/module/utils/isModuleReady.js +2 -0
- package/lib/module/utils/isModuleReady.js.map +1 -1
- package/lib/module/utils/isRunningOnAndroid.js +2 -0
- package/lib/module/utils/isRunningOnAndroid.js.map +1 -1
- package/lib/module/utils/isRunningOniOS.js +2 -0
- package/lib/module/utils/isRunningOniOS.js.map +1 -1
- package/lib/module/utils/isValidDate.js +2 -0
- package/lib/module/utils/isValidDate.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeRookSdk.d.ts +190 -0
- package/lib/typescript/src/NativeRookSdk.d.ts.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/hooks/useRookAPISources.d.ts +15 -0
- package/lib/typescript/src/hooks/useRookAPISources.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useRookAndroidBackgroundSteps.d.ts +0 -1
- package/lib/typescript/src/hooks/useRookAndroidBackgroundSteps.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookAppleHealth.d.ts +1 -2
- package/lib/typescript/src/hooks/useRookAppleHealth.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookConfiguration.d.ts +0 -8
- package/lib/typescript/src/hooks/useRookConfiguration.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookData.d.ts +2 -0
- 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 +11 -12
- package/lib/typescript/src/hooks/useRookPermissions.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookSamsungHealth.d.ts +7 -0
- package/lib/typescript/src/hooks/useRookSamsungHealth.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useRookSync.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookVariables.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +19 -4
- 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/AppleHealthPermissions.d.ts +50 -0
- package/lib/typescript/src/types/AppleHealthPermissions.d.ts.map +1 -0
- package/lib/typescript/src/types/AuthorizedSources.d.ts +3 -3
- package/lib/typescript/src/types/AuthorizedSources.d.ts.map +1 -1
- package/lib/typescript/src/types/DataSource.d.ts +8 -1
- package/lib/typescript/src/types/DataSource.d.ts.map +1 -1
- package/lib/typescript/src/types/HeartRateEvent.d.ts +24 -0
- package/lib/typescript/src/types/HeartRateEvent.d.ts.map +1 -0
- package/lib/typescript/src/types/PermissionsType.d.ts +0 -4
- package/lib/typescript/src/types/PermissionsType.d.ts.map +1 -1
- package/lib/typescript/src/types/Rook.d.ts +9 -0
- package/lib/typescript/src/types/Rook.d.ts.map +1 -0
- package/lib/typescript/src/types/SamsungHealthPermissions.d.ts +1 -0
- package/lib/typescript/src/types/SamsungHealthPermissions.d.ts.map +1 -1
- package/lib/typescript/src/types/SyncTypes.d.ts +28 -5
- package/lib/typescript/src/types/SyncTypes.d.ts.map +1 -1
- package/lib/typescript/src/utils/isModuleReady.d.ts.map +1 -1
- package/lib/typescript/src/utils/isValidDate.d.ts.map +1 -1
- package/package.json +94 -98
- package/src/NativeRookSdk.ts +282 -0
- package/{lib/commonjs/context/RookSyncGateContext.js → src/context/RookSyncGateContext.ts} +10 -13
- package/src/context/RookSyncGateProvider.tsx +78 -0
- package/{lib/commonjs/context/RookSyncGateReducer.js → src/context/RookSyncGateReducer.ts} +12 -33
- package/src/context/RookSyncGateTypes.ts +34 -0
- package/src/hooks/useRookAPISources.ts +83 -0
- package/src/hooks/useRookAndroidBackgroundSteps.ts +81 -0
- package/src/hooks/useRookAppleHealth.ts +55 -0
- package/src/hooks/useRookConfiguration.ts +82 -0
- package/src/hooks/useRookData.ts +122 -0
- package/src/hooks/useRookHealthConnect.ts +59 -0
- package/src/hooks/useRookPermissions.ts +224 -0
- package/src/hooks/useRookSamsungHealth.ts +37 -0
- package/src/hooks/useRookSync.ts +157 -0
- package/src/hooks/useRookVariables.ts +77 -0
- package/src/index.tsx +28 -0
- package/src/modules/hook/useRookAutoSync.ts +305 -0
- package/src/modules/types/sendMessageBroadcast.ts +5 -0
- package/src/modules/utils/errors.ts +9 -0
- package/src/types/ActivityEvent.ts +159 -0
- package/src/types/AppleHealthPermissions.ts +49 -0
- package/src/types/AuthorizedSources.ts +33 -0
- package/src/types/BodySummary.ts +116 -0
- package/src/types/DataSource.ts +16 -0
- package/src/types/HeartRateEvent.ts +26 -0
- package/src/types/PermissionsType.ts +9 -0
- package/src/types/PhysicalSummary.ts +84 -0
- package/src/types/Rook.ts +8 -0
- package/src/types/SDKSources.ts +5 -0
- package/src/types/SamsungHealthPermissions.ts +16 -0
- package/src/types/SleepSummary.ts +66 -0
- package/src/types/SummaryTypes.ts +70 -0
- package/src/types/SyncTypes.ts +63 -0
- package/{lib/commonjs/utils/isModuleReady.js → src/utils/isModuleReady.ts} +4 -10
- package/src/utils/isRunningOnAndroid.ts +10 -0
- package/src/utils/isRunningOniOS.ts +10 -0
- package/{lib/commonjs/utils/isValidDate.js → src/utils/isValidDate.ts} +5 -10
- package/android/src/main/AndroidManifestNew.xml +0 -36
- package/android/src/main/java/com/rooksdk/broadcasts/AndroidPermissionsReceiverTransmitter.kt +0 -65
- package/android/src/main/java/com/rooksdk/broadcasts/HealthConnectPermissionsReceiverTransmitter.kt +0 -70
- package/android/src/main/java/com/rooksdk/broadcasts/SamsungHealthPermissionsReceiverTransmitter.kt +0 -52
- package/android/src/main/java/com/rooksdk/modules/RookBackgroundSyncModule.kt +0 -85
- package/android/src/main/java/com/rooksdk/modules/RookConfigurationModule.kt +0 -148
- package/android/src/main/java/com/rooksdk/modules/RookLocalData.kt +0 -247
- package/android/src/main/java/com/rooksdk/modules/RookPermissionsModule.kt +0 -309
- package/android/src/main/java/com/rooksdk/modules/RookStepsModule.kt +0 -105
- package/android/src/main/java/com/rooksdk/modules/RookSyncModule.kt +0 -496
- package/android/src/main/java/com/rooksdk/utils/DatasourcesUtils.kt +0 -63
- package/android/src/main/java/com/rooksdk/utils/PermissionConversion.kt +0 -21
- package/android/src/main/java/com/rooksdk/utils/ReadableToWritable.kt +0 -64
- package/android/src/main/java/com/rooksdk/utils/RookDateTime.kt +0 -20
- package/android/src/main/java/com/rooksdk/utils/SamsungAvailability.kt +0 -21
- package/android/src/main/java/com/rooksdk/utils/Source.kt +0 -6
- package/android/src/main/java/com/rooksdk/utils/StringToSyncType.kt +0 -58
- package/android/src/main/java/com/rooksdk/utils/serializers/InstantSerializer.kt +0 -19
- package/android/src/main/java/com/rooksdk/utils/serializers/LocalDateSerializer.kt +0 -21
- package/android/src/main/res/drawable/ic_health_connect.xml +0 -19
- package/android/src/main/res/values/themes.xml +0 -3
- package/ios/EncodableRookDataSource.swift +0 -36
- package/ios/EncodableStatusDataSources.swift +0 -47
- package/ios/RookBackgroundModule.h +0 -5
- package/ios/RookBackgroundModule.mm +0 -89
- package/ios/RookConfigurationModule.h +0 -5
- package/ios/RookConfigurationModule.mm +0 -163
- package/ios/RookExternalModule.h +0 -5
- package/ios/RookExternalModule.m +0 -27
- package/ios/RookLocalData.swift +0 -152
- package/ios/RookPermissionsModule.h +0 -5
- package/ios/RookPermissionsModule.mm +0 -180
- package/ios/RookSourcesModule.h +0 -5
- package/ios/RookSourcesModule.mm +0 -67
- package/ios/RookSync.h +0 -5
- package/ios/RookSync.m +0 -27
- package/ios/RookSyncModule.h +0 -5
- package/ios/RookSyncModule.mm +0 -476
- package/ios/SwiftTest.swift +0 -18
- package/ios/react-native-rook-sdk-Bridging-Header.h +0 -12
- package/lib/commonjs/context/RookSyncGateContext.js.map +0 -1
- package/lib/commonjs/context/RookSyncGateProvider.js +0 -98
- package/lib/commonjs/context/RookSyncGateProvider.js.map +0 -1
- package/lib/commonjs/context/RookSyncGateReducer.js.map +0 -1
- package/lib/commonjs/context/RookSyncGateTypes.js +0 -6
- package/lib/commonjs/context/RookSyncGateTypes.js.map +0 -1
- package/lib/commonjs/context/index.js +0 -14
- package/lib/commonjs/context/index.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -90
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js +0 -100
- package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js.map +0 -1
- package/lib/commonjs/hooks/useRookAppleHealth.js +0 -74
- package/lib/commonjs/hooks/useRookAppleHealth.js.map +0 -1
- package/lib/commonjs/hooks/useRookAppleHealthVariables.js +0 -48
- package/lib/commonjs/hooks/useRookAppleHealthVariables.js.map +0 -1
- package/lib/commonjs/hooks/useRookConfiguration.js +0 -188
- package/lib/commonjs/hooks/useRookConfiguration.js.map +0 -1
- package/lib/commonjs/hooks/useRookData.js +0 -100
- package/lib/commonjs/hooks/useRookData.js.map +0 -1
- package/lib/commonjs/hooks/useRookDataSources.js +0 -118
- package/lib/commonjs/hooks/useRookDataSources.js.map +0 -1
- package/lib/commonjs/hooks/useRookEvents.js +0 -225
- package/lib/commonjs/hooks/useRookEvents.js.map +0 -1
- package/lib/commonjs/hooks/useRookHealthConnect.js +0 -70
- package/lib/commonjs/hooks/useRookHealthConnect.js.map +0 -1
- package/lib/commonjs/hooks/useRookPermissions.js +0 -226
- package/lib/commonjs/hooks/useRookPermissions.js.map +0 -1
- package/lib/commonjs/hooks/useRookSummaries.js +0 -85
- package/lib/commonjs/hooks/useRookSummaries.js.map +0 -1
- package/lib/commonjs/hooks/useRookSync.js +0 -147
- package/lib/commonjs/hooks/useRookSync.js.map +0 -1
- package/lib/commonjs/hooks/useRookVariables.js +0 -69
- package/lib/commonjs/hooks/useRookVariables.js.map +0 -1
- package/lib/commonjs/index.js +0 -56
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/modules/hook/useRookAutoSync.js +0 -262
- package/lib/commonjs/modules/hook/useRookAutoSync.js.map +0 -1
- package/lib/commonjs/modules/types/sendMessageBroadcast.js +0 -2
- package/lib/commonjs/modules/types/sendMessageBroadcast.js.map +0 -1
- package/lib/commonjs/modules/utils/errors.js +0 -12
- package/lib/commonjs/modules/utils/errors.js.map +0 -1
- package/lib/commonjs/types/ActivityEvent.js +0 -6
- package/lib/commonjs/types/ActivityEvent.js.map +0 -1
- package/lib/commonjs/types/AuthorizedSources.js +0 -2
- package/lib/commonjs/types/AuthorizedSources.js.map +0 -1
- package/lib/commonjs/types/BodySummary.js +0 -6
- package/lib/commonjs/types/BodySummary.js.map +0 -1
- package/lib/commonjs/types/DataSource.js +0 -2
- package/lib/commonjs/types/PermissionsType.js +0 -2
- package/lib/commonjs/types/PermissionsType.js.map +0 -1
- package/lib/commonjs/types/PhysicalSummary.js +0 -6
- package/lib/commonjs/types/PhysicalSummary.js.map +0 -1
- package/lib/commonjs/types/SDKSources.js +0 -13
- package/lib/commonjs/types/SDKSources.js.map +0 -1
- package/lib/commonjs/types/SamsungHealthPermissions.js +0 -23
- package/lib/commonjs/types/SamsungHealthPermissions.js.map +0 -1
- package/lib/commonjs/types/SleepSummary.js +0 -6
- package/lib/commonjs/types/SleepSummary.js.map +0 -1
- package/lib/commonjs/types/SummaryTypes.js +0 -2
- package/lib/commonjs/types/SummaryTypes.js.map +0 -1
- package/lib/commonjs/types/SyncTypes.js +0 -6
- package/lib/commonjs/utils/credentials.js +0 -12
- package/lib/commonjs/utils/credentials.js.map +0 -1
- package/lib/commonjs/utils/getNativeModule.js +0 -29
- package/lib/commonjs/utils/getNativeModule.js.map +0 -1
- package/lib/commonjs/utils/getRookModule.js +0 -28
- package/lib/commonjs/utils/getRookModule.js.map +0 -1
- package/lib/commonjs/utils/isModuleReady.js.map +0 -1
- package/lib/commonjs/utils/isRunningOnAndroid.js +0 -15
- package/lib/commonjs/utils/isRunningOnAndroid.js.map +0 -1
- package/lib/commonjs/utils/isRunningOniOS.js +0 -15
- package/lib/commonjs/utils/isRunningOniOS.js.map +0 -1
- package/lib/commonjs/utils/isValidDate.js.map +0 -1
- package/lib/commonjs/utils/nativeModules.js +0 -28
- package/lib/commonjs/utils/nativeModules.js.map +0 -1
- package/lib/commonjs/utils/packageInfo.js +0 -13
- package/lib/commonjs/utils/packageInfo.js.map +0 -1
- package/lib/module/context/index.js +0 -2
- package/lib/module/context/index.js.map +0 -1
- package/lib/module/hooks/index.js +0 -13
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/hooks/useRookAppleHealthVariables.js +0 -41
- package/lib/module/hooks/useRookAppleHealthVariables.js.map +0 -1
- package/lib/module/hooks/useRookDataSources.js +0 -110
- package/lib/module/hooks/useRookDataSources.js.map +0 -1
- package/lib/module/hooks/useRookEvents.js +0 -218
- package/lib/module/hooks/useRookEvents.js.map +0 -1
- package/lib/module/hooks/useRookSummaries.js +0 -78
- package/lib/module/hooks/useRookSummaries.js.map +0 -1
- package/lib/module/utils/credentials.js +0 -6
- package/lib/module/utils/credentials.js.map +0 -1
- package/lib/module/utils/getNativeModule.js +0 -23
- package/lib/module/utils/getNativeModule.js.map +0 -1
- package/lib/module/utils/getRookModule.js +0 -22
- package/lib/module/utils/getRookModule.js.map +0 -1
- package/lib/module/utils/nativeModules.js +0 -22
- package/lib/module/utils/nativeModules.js.map +0 -1
- package/lib/module/utils/packageInfo.js +0 -7
- package/lib/module/utils/packageInfo.js.map +0 -1
- package/lib/typescript/src/context/index.d.ts +0 -2
- package/lib/typescript/src/context/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/index.d.ts +0 -13
- package/lib/typescript/src/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useRookAppleHealthVariables.d.ts +0 -15
- package/lib/typescript/src/hooks/useRookAppleHealthVariables.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useRookDataSources.d.ts +0 -22
- package/lib/typescript/src/hooks/useRookDataSources.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useRookEvents.d.ts +0 -26
- package/lib/typescript/src/hooks/useRookEvents.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useRookSummaries.d.ts +0 -14
- package/lib/typescript/src/hooks/useRookSummaries.d.ts.map +0 -1
- package/lib/typescript/src/utils/credentials.d.ts +0 -5
- package/lib/typescript/src/utils/credentials.d.ts.map +0 -1
- package/lib/typescript/src/utils/getNativeModule.d.ts +0 -10
- package/lib/typescript/src/utils/getNativeModule.d.ts.map +0 -1
- package/lib/typescript/src/utils/getRookModule.d.ts +0 -9
- package/lib/typescript/src/utils/getRookModule.d.ts.map +0 -1
- package/lib/typescript/src/utils/nativeModules.d.ts +0 -23
- package/lib/typescript/src/utils/nativeModules.d.ts.map +0 -1
- package/lib/typescript/src/utils/packageInfo.d.ts +0 -6
- package/lib/typescript/src/utils/packageInfo.d.ts.map +0 -1
- package/react-native-rook-sdk.podspec +0 -45
package/ios/RookSyncModule.mm
DELETED
|
@@ -1,476 +0,0 @@
|
|
|
1
|
-
#import "RookSyncModule.h"
|
|
2
|
-
#import "RookSDK/RookSDK-Swift.h"
|
|
3
|
-
|
|
4
|
-
@implementation RookSyncModule
|
|
5
|
-
|
|
6
|
-
RCT_EXPORT_MODULE()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
RookSummaryManager *summaryManager;
|
|
10
|
-
RookEventsManager *eventsManager;
|
|
11
|
-
|
|
12
|
-
- (void) checkSummariesInstance {
|
|
13
|
-
if (summaryManager == nil) summaryManager = [RookSummaryManager new];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
- (void) checkEventsInstance {
|
|
17
|
-
if (eventsManager == nil) eventsManager = [RookEventsManager new];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// The above code is a function that takes a string representing a date in the
|
|
21
|
-
// format "yyyy-MM-dd" as input. It creates an instance of NSDateFormatter, sets the date format to
|
|
22
|
-
// "yyyy-MM-dd", and then uses the date formatter to convert the input string into an NSDate object
|
|
23
|
-
// representing the parsed date. Finally, it returns the parsed NSDate object.
|
|
24
|
-
NSDate *parseDateFromString(NSString * dateString) {
|
|
25
|
-
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
|
26
|
-
|
|
27
|
-
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
|
|
28
|
-
|
|
29
|
-
NSDate *date = [dateFormatter dateFromString:dateString];
|
|
30
|
-
|
|
31
|
-
return date;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Syncs the yesterday summaries
|
|
36
|
-
*
|
|
37
|
-
* @param resolve A block called with a boolean value indicating whether the summaries were successfully sync.
|
|
38
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
39
|
-
*/
|
|
40
|
-
RCT_EXPORT_METHOD(syncYesterdaySummaries: (RCTPromiseResolveBlock)resolve
|
|
41
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
42
|
-
[self checkSummariesInstance];
|
|
43
|
-
|
|
44
|
-
[summaryManager syncSummariesWithCompletion:^{
|
|
45
|
-
resolve(@(TRUE));
|
|
46
|
-
}];
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Sync sleep summary
|
|
52
|
-
*
|
|
53
|
-
* @param resolve A block called with a boolean value indicating whether the sleep summary were successfully sync.
|
|
54
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
55
|
-
*/
|
|
56
|
-
RCT_EXPORT_METHOD(syncSleepSummary: (NSString *) dateString
|
|
57
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
58
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
59
|
-
[self checkSummariesInstance];
|
|
60
|
-
|
|
61
|
-
[summaryManager syncSleepSummaryObjcWithForm:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
62
|
-
if(error != nil) {
|
|
63
|
-
reject(error.description, error.localizedDescription, error);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
resolve(@(success));
|
|
68
|
-
}];
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Sync physical summary
|
|
74
|
-
*
|
|
75
|
-
* @param resolve A block called with a boolean value indicating whether the physical summary were successfully sync.
|
|
76
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
77
|
-
*/
|
|
78
|
-
RCT_EXPORT_METHOD(syncPhysicalSummary: (NSString *) dateString
|
|
79
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
80
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
81
|
-
[self checkSummariesInstance];
|
|
82
|
-
|
|
83
|
-
[summaryManager syncPhysicalSummaryObjcWithForm:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
84
|
-
if(error != nil) {
|
|
85
|
-
reject(error.description, error.localizedDescription, error);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
resolve(@(success));
|
|
90
|
-
}];
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Sync body summary
|
|
96
|
-
*
|
|
97
|
-
* @param resolve A block called with a boolean value indicating whether the body summary were successfully sync.
|
|
98
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
99
|
-
*/
|
|
100
|
-
RCT_EXPORT_METHOD(syncBodySummary: (NSString *) dateString
|
|
101
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
102
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
103
|
-
[self checkSummariesInstance];
|
|
104
|
-
|
|
105
|
-
[summaryManager syncBodySummaryObjcFrom:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
106
|
-
if(error != nil) {
|
|
107
|
-
reject(error.description, error.localizedDescription, error);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
resolve(@(success));
|
|
112
|
-
}];
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Sync summaries that couldnt be sync due to an error
|
|
118
|
-
*
|
|
119
|
-
* @param resolve A block called with a boolean value indicating whether the summaries were successfully sync.
|
|
120
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
121
|
-
*/
|
|
122
|
-
RCT_EXPORT_METHOD(syncPendingSummaries: (RCTPromiseResolveBlock) resolve
|
|
123
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
124
|
-
[self checkSummariesInstance];
|
|
125
|
-
|
|
126
|
-
[summaryManager syncPendingSummariesObjcWithCompletion:^(BOOL success, NSError * _Nullable error) {
|
|
127
|
-
if(error != nil) {
|
|
128
|
-
reject(error.description, error.localizedDescription, error);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
resolve(@(success));
|
|
133
|
-
}];
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// MARK: - Events
|
|
138
|
-
/**
|
|
139
|
-
* Syncs the events
|
|
140
|
-
*
|
|
141
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
142
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
143
|
-
*/
|
|
144
|
-
RCT_EXPORT_METHOD(syncYesterdayEvents: (RCTPromiseResolveBlock)resolve
|
|
145
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
146
|
-
[self checkEventsInstance];
|
|
147
|
-
|
|
148
|
-
[eventsManager syncEventsWithCompletion:^{
|
|
149
|
-
resolve(@(TRUE));
|
|
150
|
-
}];
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Sync body heart rate event
|
|
156
|
-
*
|
|
157
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
158
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
159
|
-
*/
|
|
160
|
-
RCT_EXPORT_METHOD(syncBodyHeartRateEvent: (NSString *) dateString
|
|
161
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
162
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
163
|
-
[self checkEventsInstance];
|
|
164
|
-
|
|
165
|
-
[eventsManager syncBodyHeartRateEventObjcWithDate:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
166
|
-
if(error != nil) {
|
|
167
|
-
reject(error.description, error.localizedDescription, error);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
resolve(@(success));
|
|
172
|
-
}];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Sync physical heart rate event
|
|
177
|
-
*
|
|
178
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
179
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
180
|
-
*/
|
|
181
|
-
RCT_EXPORT_METHOD(syncPhysicalHeartRateEvent: (NSString *) dateString
|
|
182
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
183
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
184
|
-
[self checkEventsInstance];
|
|
185
|
-
|
|
186
|
-
[eventsManager
|
|
187
|
-
syncPhysicalHeartRateEventObjcWithDate:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
188
|
-
if(error != nil) {
|
|
189
|
-
reject(error.description, error.localizedDescription, error);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
resolve(@(success));
|
|
194
|
-
}];
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Sync body oxygenation event
|
|
199
|
-
*
|
|
200
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
201
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
202
|
-
*/
|
|
203
|
-
RCT_EXPORT_METHOD(syncBodyOxygenationEvent: (NSString *) dateString
|
|
204
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
205
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
206
|
-
[self checkEventsInstance];
|
|
207
|
-
|
|
208
|
-
[eventsManager syncBodyOxygenationEventObjcWithDate:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
209
|
-
if(error != nil) {
|
|
210
|
-
reject(error.description, error.localizedDescription, error);
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
resolve(@(success));
|
|
215
|
-
}];
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Sync physical oxygenation event
|
|
220
|
-
*
|
|
221
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
222
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
223
|
-
*/
|
|
224
|
-
RCT_EXPORT_METHOD(syncPhysicalOxygenationEvent: (NSString *) dateString
|
|
225
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
226
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
227
|
-
[self checkEventsInstance];
|
|
228
|
-
|
|
229
|
-
[eventsManager syncPhysicalOxygenationEventObjcWithDate:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
230
|
-
if(error != nil) {
|
|
231
|
-
reject(error.description, error.localizedDescription, error);
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
resolve(@(success));
|
|
236
|
-
}];
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Sync training event
|
|
241
|
-
*
|
|
242
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
243
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
244
|
-
*/
|
|
245
|
-
RCT_EXPORT_METHOD(syncTrainingEvent: (NSString *) dateString
|
|
246
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
247
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
248
|
-
[self checkEventsInstance];
|
|
249
|
-
|
|
250
|
-
[eventsManager syncTrainingEventObjcWithDate:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
251
|
-
if(error != nil) {
|
|
252
|
-
reject(error.description, error.localizedDescription, error);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
resolve(@(success));
|
|
257
|
-
}];
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Sync temperature event
|
|
262
|
-
*
|
|
263
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
264
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
265
|
-
*/
|
|
266
|
-
RCT_EXPORT_METHOD(syncTemperatureEvent: (NSString *) dateString
|
|
267
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
268
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
269
|
-
[self checkEventsInstance];
|
|
270
|
-
|
|
271
|
-
[eventsManager syncTemperatureEventsObjcWithDate:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
272
|
-
if(error != nil) {
|
|
273
|
-
reject(error.description, error.localizedDescription, error);
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
resolve(@(success));
|
|
278
|
-
}];
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Sync blood pressure event
|
|
283
|
-
*
|
|
284
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
285
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
286
|
-
*/
|
|
287
|
-
RCT_EXPORT_METHOD(syncPressureEvent: (NSString *) dateString
|
|
288
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
289
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
290
|
-
[self checkEventsInstance];
|
|
291
|
-
|
|
292
|
-
[eventsManager syncPressureEventsObjcWithDate:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
293
|
-
if(error != nil) {
|
|
294
|
-
reject(error.description, error.localizedDescription, error);
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
resolve(@(success));
|
|
299
|
-
}];
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Sync blood glucose event
|
|
304
|
-
*
|
|
305
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
306
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
307
|
-
*/
|
|
308
|
-
RCT_EXPORT_METHOD(syncGlucoseEvent: (NSString *) dateString
|
|
309
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
310
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
311
|
-
[self checkEventsInstance];
|
|
312
|
-
|
|
313
|
-
[eventsManager syncGlucoseEventsObjcWithDate:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
314
|
-
if(error != nil) {
|
|
315
|
-
reject(error.description, error.localizedDescription, error);
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
resolve(@(success));
|
|
320
|
-
}];
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Sync body metrics event
|
|
325
|
-
*
|
|
326
|
-
* @param resolve A block called with a boolean value indicating whether the events were successfully sync.
|
|
327
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
328
|
-
*/
|
|
329
|
-
RCT_EXPORT_METHOD(syncBodyMetricsEvent: (NSString *) dateString
|
|
330
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
331
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
332
|
-
[self checkEventsInstance];
|
|
333
|
-
|
|
334
|
-
[eventsManager syncBodyMetricsEventsObjcWithDate:parseDateFromString(dateString) completion:^(BOOL success, NSError * _Nullable error) {
|
|
335
|
-
if(error != nil) {
|
|
336
|
-
reject(error.description, error.localizedDescription, error);
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
resolve(@(success));
|
|
341
|
-
}];
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Extract the steps from apple health
|
|
346
|
-
*
|
|
347
|
-
* @param resolve A block called with a string value indicating the steps.
|
|
348
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
349
|
-
*/
|
|
350
|
-
RCT_EXPORT_METHOD(getTodaySteps: (RCTPromiseResolveBlock) resolve
|
|
351
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
352
|
-
[self checkEventsInstance];
|
|
353
|
-
|
|
354
|
-
[eventsManager getTodayStepCountWithCompletion:^(NSInteger steps, NSError * _Nullable error) {
|
|
355
|
-
if(error != nil) {
|
|
356
|
-
reject(error.description, error.localizedDescription, error);
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
resolve(@(steps));
|
|
360
|
-
}];
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Extract the calories from apple health
|
|
366
|
-
*
|
|
367
|
-
* @param resolve A block called with a string value indicating the steps.
|
|
368
|
-
* @param reject A block called if an error occurs, such as Apple Health not being installed.
|
|
369
|
-
*/
|
|
370
|
-
RCT_EXPORT_METHOD(syncTodayCaloriesCount: (RCTPromiseResolveBlock) resolve
|
|
371
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
372
|
-
[self checkEventsInstance];
|
|
373
|
-
|
|
374
|
-
[eventsManager getTodayCaloriesWithCompletion:^(NSDictionary<NSString *,id> * _Nullable data, NSError * _Nullable error) {
|
|
375
|
-
if(error != nil) {
|
|
376
|
-
reject(error.description, error.localizedDescription, error);
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
resolve(data);
|
|
381
|
-
}];
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/*
|
|
386
|
-
RCT_EXPORT_METHOD(sync: (RCTResponseSenderBlock)callback) {
|
|
387
|
-
|
|
388
|
-
[self checkSummariesInstance];
|
|
389
|
-
|
|
390
|
-
[summaryManager syncWithCompletion:^(BOOL result, NSError * _Nullable error) {
|
|
391
|
-
if (error) {
|
|
392
|
-
NSDictionary *dictionary = @{
|
|
393
|
-
@"code" : [NSString stringWithFormat: @"%ld", (long)error.code],
|
|
394
|
-
@"domain" : error.domain,
|
|
395
|
-
@"info" : error.userInfo,
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
callback(@[dictionary, @(result)]);
|
|
400
|
-
} else {
|
|
401
|
-
callback(@[[NSNull null], @(result)]);
|
|
402
|
-
}
|
|
403
|
-
}];
|
|
404
|
-
}*/
|
|
405
|
-
|
|
406
|
-
/*
|
|
407
|
-
RCT_EXPORT_METHOD(syncByDefinition: (NSString *) summary
|
|
408
|
-
syncDate: (NSString *) syncDate
|
|
409
|
-
callback: (RCTResponseSenderBlock)callback) {
|
|
410
|
-
|
|
411
|
-
[self checkSummariesInstance];
|
|
412
|
-
|
|
413
|
-
NSArray* types = [NSArray arrayWithObjects:summary, nil];
|
|
414
|
-
|
|
415
|
-
[summaryManager syncWithDate:parseDateFromString(syncDate)
|
|
416
|
-
summaryType:types
|
|
417
|
-
completion:^(BOOL result, NSError * _Nullable error) {
|
|
418
|
-
if (error) {
|
|
419
|
-
NSDictionary *dictionary = @{
|
|
420
|
-
@"code" : [NSString stringWithFormat: @"%ld", (long)error.code],
|
|
421
|
-
@"domain" : error.domain,
|
|
422
|
-
@"info" : error.userInfo,
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
callback(@[dictionary, @(result)]);
|
|
427
|
-
} else {
|
|
428
|
-
callback(@[[NSNull null], @(result)]);
|
|
429
|
-
}
|
|
430
|
-
}];
|
|
431
|
-
|
|
432
|
-
}*/
|
|
433
|
-
|
|
434
|
-
/*
|
|
435
|
-
RCT_EXPORT_METHOD(syncByDate: (NSString *) syncDate
|
|
436
|
-
callback: (RCTResponseSenderBlock)callback) {
|
|
437
|
-
|
|
438
|
-
[self checkSummariesInstance];
|
|
439
|
-
|
|
440
|
-
[summaryManager syncWithDate:parseDateFromString(syncDate)
|
|
441
|
-
completion:^(BOOL result, NSError * _Nullable error) {
|
|
442
|
-
if (error) {
|
|
443
|
-
NSDictionary *dictionary = @{
|
|
444
|
-
@"code" : [NSString stringWithFormat: @"%ld", (long)error.code],
|
|
445
|
-
@"domain" : error.domain,
|
|
446
|
-
@"info" : error.userInfo,
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
callback(@[dictionary, @(result)]);
|
|
451
|
-
} else {
|
|
452
|
-
callback(@[[NSNull null], @(result)]);
|
|
453
|
-
}
|
|
454
|
-
}];
|
|
455
|
-
|
|
456
|
-
}*/
|
|
457
|
-
|
|
458
|
-
/*
|
|
459
|
-
RCT_EXPORT_METHOD(syncEvent:(NSString *) syncDate
|
|
460
|
-
event: (NSString *) event
|
|
461
|
-
resolve: (RCTPromiseResolveBlock) resolve
|
|
462
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
463
|
-
|
|
464
|
-
[self checkEventsInstance];
|
|
465
|
-
|
|
466
|
-
[eventsManager syncEventsWithDate:parseDateFromString(syncDate) eventType:event completion:^(BOOL result, NSError * _Nullable error) {
|
|
467
|
-
if(error != nil) {
|
|
468
|
-
reject(error.description, error.localizedDescription, error);
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
resolve(@(result));
|
|
473
|
-
}];
|
|
474
|
-
|
|
475
|
-
}*/
|
|
476
|
-
@end
|
package/ios/SwiftTest.swift
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
|
|
3
|
-
// La clase debe heredar de NSObject y tener @objc para ser visible
|
|
4
|
-
@objc(SwiftTest)
|
|
5
|
-
public class SwiftTest: NSObject {
|
|
6
|
-
|
|
7
|
-
// Un método estático (de clase) que también debe ser @objc
|
|
8
|
-
@objc
|
|
9
|
-
public static func getGreeting(name: String) -> String {
|
|
10
|
-
return "Hello, \(name) from Swift! 👋"
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Un método de instancia
|
|
14
|
-
@objc
|
|
15
|
-
public func showMessage() {
|
|
16
|
-
print("This is a message from a Swift instance.")
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// react-native-rook-sdk-Bridging-Header.h
|
|
3
|
-
// Pods
|
|
4
|
-
//
|
|
5
|
-
// Created by Javier Villanueva on 04/09/25.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
#ifndef react_native_rook_sdk_Bridging_Header_h
|
|
9
|
-
#define react_native_rook_sdk_Bridging_Header_h
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
#endif /* react_native_rook_sdk_Bridging_Header_h */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","RookSyncGateContext","exports","createContext","undefined","useRookSyncGateContext","context","useContext","Error"],"sourceRoot":"../../../src","sources":["context/RookSyncGateContext.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AADA;;AAIA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,gBAAG,IAAAE,oBAAa,EAE9CC,SAAS,CAAC;;AAEZ;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EAC1C,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACN,mBAAmB,CAAC;EAC/C,IAAI,CAACK,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CACb,mEACF,CAAC;EACH;EACA,OAAOF,OAAO;AAChB,CAAC;AAACJ,OAAA,CAAAG,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _RookSyncGateReducer = require("./RookSyncGateReducer");
|
|
9
|
-
var _RookSyncGateContext = require("./RookSyncGateContext");
|
|
10
|
-
var _credentials = require("../utils/credentials");
|
|
11
|
-
var _getRookModule = require("../utils/getRookModule");
|
|
12
|
-
var _packageInfo = require("../utils/packageInfo");
|
|
13
|
-
var _useRookAutoSync = require("../modules/hook/useRookAutoSync");
|
|
14
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
17
|
-
|
|
18
|
-
// Importa el reducer
|
|
19
|
-
|
|
20
|
-
const initialState = {
|
|
21
|
-
clientUUID: '',
|
|
22
|
-
environment: 'sandbox',
|
|
23
|
-
password: '',
|
|
24
|
-
ready: false,
|
|
25
|
-
userID: '',
|
|
26
|
-
permissions: 0,
|
|
27
|
-
enableLogs: false
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/*
|
|
31
|
-
* This code snippet is defining a React functional component called `RookSyncGateProvider`.
|
|
32
|
-
* this define the provider for the SDK
|
|
33
|
-
*/
|
|
34
|
-
const RookSyncGateProvider = ({
|
|
35
|
-
environment,
|
|
36
|
-
clientUUID,
|
|
37
|
-
password,
|
|
38
|
-
children,
|
|
39
|
-
enableLogs = false,
|
|
40
|
-
enableBackgroundSync,
|
|
41
|
-
enableEventsBackgroundSync = true
|
|
42
|
-
}) => {
|
|
43
|
-
const [state, dispatch] = (0, _react.useReducer)(_RookSyncGateReducer.rookSyncGateReducer, initialState);
|
|
44
|
-
const {
|
|
45
|
-
startBackgroundServices
|
|
46
|
-
} = (0, _useRookAutoSync.useRookAutoSync)({
|
|
47
|
-
state,
|
|
48
|
-
enableBackground: enableBackgroundSync,
|
|
49
|
-
enableLogs
|
|
50
|
-
});
|
|
51
|
-
(0, _react.useEffect)(() => {
|
|
52
|
-
initModule();
|
|
53
|
-
}, [environment, clientUUID, password]);
|
|
54
|
-
const initModule = async () => {
|
|
55
|
-
dispatch({
|
|
56
|
-
type: 'SET_ROOK_ENVIRONMENT',
|
|
57
|
-
environment
|
|
58
|
-
});
|
|
59
|
-
dispatch({
|
|
60
|
-
type: 'SET_CLIENT_UUID',
|
|
61
|
-
clientUUID
|
|
62
|
-
});
|
|
63
|
-
dispatch({
|
|
64
|
-
type: 'SET_PASSWORD',
|
|
65
|
-
password
|
|
66
|
-
});
|
|
67
|
-
dispatch({
|
|
68
|
-
type: 'SET_ENABLE_LOGS',
|
|
69
|
-
enableLogs
|
|
70
|
-
});
|
|
71
|
-
try {
|
|
72
|
-
const rookSyncModule = (0, _getRookModule.getRookModule)();
|
|
73
|
-
await rookSyncModule.initRook({
|
|
74
|
-
environment: _packageInfo.packageInfo.debug ? 'development' : environment,
|
|
75
|
-
clientUUID: _packageInfo.packageInfo.debug ? _credentials.credentials.uuid : clientUUID,
|
|
76
|
-
password: _packageInfo.packageInfo.debug ? _credentials.credentials.pdw : password,
|
|
77
|
-
enableLogs,
|
|
78
|
-
enableEventsBackgroundSync,
|
|
79
|
-
enableBackground: enableBackgroundSync
|
|
80
|
-
});
|
|
81
|
-
if (enableBackgroundSync) startBackgroundServices();
|
|
82
|
-
dispatch({
|
|
83
|
-
type: 'SET_READY',
|
|
84
|
-
ready: true
|
|
85
|
-
});
|
|
86
|
-
} catch (error) {
|
|
87
|
-
console.log(error);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
return /*#__PURE__*/_react.default.createElement(_RookSyncGateContext.RookSyncGateContext.Provider, {
|
|
91
|
-
value: {
|
|
92
|
-
state,
|
|
93
|
-
dispatch
|
|
94
|
-
}
|
|
95
|
-
}, children);
|
|
96
|
-
};
|
|
97
|
-
var _default = exports.default = RookSyncGateProvider;
|
|
98
|
-
//# sourceMappingURL=RookSyncGateProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_RookSyncGateReducer","_RookSyncGateContext","_credentials","_getRookModule","_packageInfo","_useRookAutoSync","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","initialState","clientUUID","environment","password","ready","userID","permissions","enableLogs","RookSyncGateProvider","children","enableBackgroundSync","enableEventsBackgroundSync","state","dispatch","useReducer","rookSyncGateReducer","startBackgroundServices","useRookAutoSync","enableBackground","useEffect","initModule","type","rookSyncModule","getRookModule","initRook","packageInfo","debug","credentials","uuid","pdw","error","console","log","createElement","RookSyncGateContext","Provider","value","_default","exports"],"sourceRoot":"../../../src","sources":["context/RookSyncGateProvider.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAKA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AAAkE,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAXlE;;AAE6D;;AAW7D,MAAMW,YAA+B,GAAG;EACtCC,UAAU,EAAE,EAAE;EACdC,WAAW,EAAE,SAAS;EACtBC,QAAQ,EAAE,EAAE;EACZC,KAAK,EAAE,KAAK;EACZC,MAAM,EAAE,EAAE;EACVC,WAAW,EAAE,CAAC;EACdC,UAAU,EAAE;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,oBAAmD,GAAGA,CAAC;EAC3DN,WAAW;EACXD,UAAU;EACVE,QAAQ;EACRM,QAAQ;EACRF,UAAU,GAAG,KAAK;EAClBG,oBAAoB;EACpBC,0BAA0B,GAAG;AAC/B,CAAC,KAAK;EACJ,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,iBAAU,EAACC,wCAAmB,EAAEf,YAAY,CAAC;EAEvE,MAAM;IAAEgB;EAAwB,CAAC,GAAG,IAAAC,gCAAe,EAAC;IAClDL,KAAK;IACLM,gBAAgB,EAAER,oBAAoB;IACtCH;EACF,CAAC,CAAC;EAEF,IAAAY,gBAAS,EAAC,MAAM;IACdC,UAAU,CAAC,CAAC;EACd,CAAC,EAAE,CAAClB,WAAW,EAAED,UAAU,EAAEE,QAAQ,CAAC,CAAC;EAEvC,MAAMiB,UAAU,GAAG,MAAAA,CAAA,KAA2B;IAC5CP,QAAQ,CAAC;MAAEQ,IAAI,EAAE,sBAAsB;MAAEnB;IAAY,CAAC,CAAC;IACvDW,QAAQ,CAAC;MAAEQ,IAAI,EAAE,iBAAiB;MAAEpB;IAAW,CAAC,CAAC;IACjDY,QAAQ,CAAC;MAAEQ,IAAI,EAAE,cAAc;MAAElB;IAAS,CAAC,CAAC;IAC5CU,QAAQ,CAAC;MAAEQ,IAAI,EAAE,iBAAiB;MAAEd;IAAW,CAAC,CAAC;IAEjD,IAAI;MACF,MAAMe,cAAc,GAAG,IAAAC,4BAAa,EAAC,CAAC;MAEtC,MAAMD,cAAc,CAACE,QAAQ,CAAC;QAC5BtB,WAAW,EAAEuB,wBAAW,CAACC,KAAK,GAAG,aAAa,GAAGxB,WAAW;QAC5DD,UAAU,EAAEwB,wBAAW,CAACC,KAAK,GAAGC,wBAAW,CAACC,IAAI,GAAG3B,UAAU;QAC7DE,QAAQ,EAAEsB,wBAAW,CAACC,KAAK,GAAGC,wBAAW,CAACE,GAAG,GAAG1B,QAAQ;QACxDI,UAAU;QACVI,0BAA0B;QAC1BO,gBAAgB,EAAER;MACpB,CAAC,CAAC;MAEF,IAAIA,oBAAoB,EAAEM,uBAAuB,CAAC,CAAC;MAEnDH,QAAQ,CAAC;QAAEQ,IAAI,EAAE,WAAW;QAAEjB,KAAK,EAAE;MAAK,CAAC,CAAC;IAC9C,CAAC,CAAC,OAAO0B,KAAK,EAAE;MACdC,OAAO,CAACC,GAAG,CAACF,KAAK,CAAC;IACpB;EACF,CAAC;EAED,oBACE3D,MAAA,CAAAe,OAAA,CAAA+C,aAAA,CAAC1D,oBAAA,CAAA2D,mBAAmB,CAACC,QAAQ;IAACC,KAAK,EAAE;MAAExB,KAAK;MAAEC;IAAS;EAAE,GACtDJ,QAC2B,CAAC;AAEnC,CAAC;AAAC,IAAA4B,QAAA,GAAAC,OAAA,CAAApD,OAAA,GAEasB,oBAAoB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["rookSyncGateReducer","state","action","type","ready","environment","clientUUID","password","userID","enableLogs","permissions","exports"],"sourceRoot":"../../../src","sources":["context/RookSyncGateReducer.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAGA,CACjCC,KAAwB,EACxBC,MAAc,KACQ;EACtB,QAAQA,MAAM,CAACC,IAAI;IACjB,KAAK,WAAW;MACd,OAAO;QAAE,GAAGF,KAAK;QAAEG,KAAK,EAAEF,MAAM,CAACE;MAAM,CAAC;IAC1C,KAAK,sBAAsB;MACzB,OAAO;QAAE,GAAGH,KAAK;QAAEI,WAAW,EAAEH,MAAM,CAACG;MAAY,CAAC;IACtD,KAAK,iBAAiB;MACpB,OAAO;QAAE,GAAGJ,KAAK;QAAEK,UAAU,EAAEJ,MAAM,CAACI;MAAW,CAAC;IACpD,KAAK,cAAc;MACjB,OAAO;QAAE,GAAGL,KAAK;QAAEM,QAAQ,EAAEL,MAAM,CAACK;MAAS,CAAC;IAChD,KAAK,aAAa;MAChB,OAAO;QAAE,GAAGN,KAAK;QAAEO,MAAM,EAAEN,MAAM,CAACM;MAAO,CAAC;IAC5C,KAAK,iBAAiB;MACpB,OAAO;QAAE,GAAGP,KAAK;QAAEQ,UAAU,EAAEP,MAAM,CAACO;MAAW,CAAC;IACpD,KAAK,iBAAiB;MACpB,OAAO;QACL,GAAGR,KAAK;QACRS,WAAW,EAAET,KAAK,CAACS,WAAW,GAAG;MACnC,CAAC;IACH;MACE,OAAOT,KAAK;EAChB;AACF,CAAC;AAACU,OAAA,CAAAX,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["context/RookSyncGateTypes.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "RookSyncGate", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _RookSyncGateProvider.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _RookSyncGateProvider = _interopRequireDefault(require("./RookSyncGateProvider"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_RookSyncGateProvider","_interopRequireDefault","require","e","__esModule","default"],"sourceRoot":"../../../src","sources":["context/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|