react-native-rook-sdk 1.0.0 → 1.1.0-rc.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.
Files changed (73) hide show
  1. package/android/build.gradle +3 -1
  2. package/android/src/main/java/com/rooksdk/modules/RookSyncModule.kt +15 -0
  3. package/android/src/main/java/com/rooksdk/utils/DatasourcesUtils.kt +1 -1
  4. package/ios/RookBackgroundModule.h +5 -0
  5. package/ios/RookBackgroundModule.mm +89 -0
  6. package/ios/RookConfigurationModule.h +5 -0
  7. package/ios/RookConfigurationModule.mm +163 -0
  8. package/ios/RookPermissionsModule.h +5 -0
  9. package/ios/RookPermissionsModule.mm +180 -0
  10. package/ios/RookSdk.h +0 -7
  11. package/ios/RookSdk.mm +0 -796
  12. package/ios/RookSourcesModule.h +5 -0
  13. package/ios/RookSourcesModule.mm +116 -0
  14. package/ios/RookSyncModule.h +5 -0
  15. package/ios/RookSyncModule.mm +363 -0
  16. package/lib/commonjs/context/index.js +1 -1
  17. package/lib/commonjs/context/index.js.map +1 -1
  18. package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js +1 -1
  19. package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js.map +1 -1
  20. package/lib/commonjs/hooks/useRookAppleHealth.js +2 -2
  21. package/lib/commonjs/hooks/useRookAppleHealth.js.map +1 -1
  22. package/lib/commonjs/hooks/useRookAppleHealthVariables.js +2 -2
  23. package/lib/commonjs/hooks/useRookAppleHealthVariables.js.map +1 -1
  24. package/lib/commonjs/hooks/useRookConfiguration.js +2 -2
  25. package/lib/commonjs/hooks/useRookConfiguration.js.map +1 -1
  26. package/lib/commonjs/hooks/useRookDataSources.js +21 -3
  27. package/lib/commonjs/hooks/useRookDataSources.js.map +1 -1
  28. package/lib/commonjs/hooks/useRookEvents.js +2 -2
  29. package/lib/commonjs/hooks/useRookEvents.js.map +1 -1
  30. package/lib/commonjs/hooks/useRookPermissions.js +2 -2
  31. package/lib/commonjs/hooks/useRookPermissions.js.map +1 -1
  32. package/lib/commonjs/hooks/useRookSummaries.js +2 -2
  33. package/lib/commonjs/hooks/useRookSummaries.js.map +1 -1
  34. package/lib/commonjs/modules/hook/useRookAutoSync.js +1 -1
  35. package/lib/commonjs/modules/hook/useRookAutoSync.js.map +1 -1
  36. package/lib/commonjs/types/AuthorizedSources.js +2 -0
  37. package/lib/commonjs/types/AuthorizedSources.js.map +1 -0
  38. package/lib/commonjs/utils/getNativeModule.js.map +1 -1
  39. package/lib/commonjs/utils/getRookModule.js.map +1 -1
  40. package/lib/commonjs/utils/isValidDate.js.map +1 -1
  41. package/lib/commonjs/utils/nativeModules.js +6 -1
  42. package/lib/commonjs/utils/nativeModules.js.map +1 -1
  43. package/lib/module/hooks/useRookAppleHealth.js +1 -1
  44. package/lib/module/hooks/useRookAppleHealth.js.map +1 -1
  45. package/lib/module/hooks/useRookAppleHealthVariables.js +1 -1
  46. package/lib/module/hooks/useRookAppleHealthVariables.js.map +1 -1
  47. package/lib/module/hooks/useRookConfiguration.js +1 -1
  48. package/lib/module/hooks/useRookConfiguration.js.map +1 -1
  49. package/lib/module/hooks/useRookDataSources.js +20 -2
  50. package/lib/module/hooks/useRookDataSources.js.map +1 -1
  51. package/lib/module/hooks/useRookEvents.js +1 -1
  52. package/lib/module/hooks/useRookEvents.js.map +1 -1
  53. package/lib/module/hooks/useRookPermissions.js +1 -1
  54. package/lib/module/hooks/useRookPermissions.js.map +1 -1
  55. package/lib/module/hooks/useRookSummaries.js +1 -1
  56. package/lib/module/hooks/useRookSummaries.js.map +1 -1
  57. package/lib/module/types/AuthorizedSources.js +2 -0
  58. package/lib/module/types/AuthorizedSources.js.map +1 -0
  59. package/lib/module/utils/getNativeModule.js.map +1 -1
  60. package/lib/module/utils/getRookModule.js.map +1 -1
  61. package/lib/module/utils/isRunningOnAndroid.js +2 -2
  62. package/lib/module/utils/isRunningOnAndroid.js.map +1 -1
  63. package/lib/module/utils/isValidDate.js.map +1 -1
  64. package/lib/module/utils/nativeModules.js +6 -1
  65. package/lib/module/utils/nativeModules.js.map +1 -1
  66. package/lib/typescript/src/hooks/useRookDataSources.d.ts +2 -0
  67. package/lib/typescript/src/hooks/useRookDataSources.d.ts.map +1 -1
  68. package/lib/typescript/src/types/AuthorizedSources.d.ts +13 -0
  69. package/lib/typescript/src/types/AuthorizedSources.d.ts.map +1 -0
  70. package/lib/typescript/src/utils/nativeModules.d.ts +5 -0
  71. package/lib/typescript/src/utils/nativeModules.d.ts.map +1 -1
  72. package/package.json +1 -1
  73. package/react-native-rook-sdk.podspec +1 -1
@@ -90,6 +90,8 @@ dependencies {
90
90
  //noinspection GradleDynamicVersion
91
91
  implementation "com.facebook.react:react-native:+"
92
92
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
93
- implementation 'com.rookmotion.android:rook-sdk:1.8.0'
93
+ implementation 'com.google.code.gson:gson:2.11.0'
94
+
95
+ implementation 'com.rookmotion.android:rook-sdk:1.9.0-alpha01'
94
96
  }
95
97
 
@@ -6,6 +6,7 @@ import com.facebook.react.bridge.ReactApplicationContext
6
6
  import com.facebook.react.bridge.ReactContextBaseJavaModule
7
7
  import com.facebook.react.bridge.ReactMethod
8
8
  import com.facebook.react.bridge.ReadableMap
9
+ import com.google.gson.Gson
9
10
  import com.rookmotion.rook.sdk.RookConfigurationManager
10
11
  import com.rookmotion.rook.sdk.RookContinuousUploadManager
11
12
  import com.rookmotion.rook.sdk.RookDataSources
@@ -473,6 +474,20 @@ class RookSyncModule(
473
474
  }
474
475
  }
475
476
 
477
+ @ReactMethod
478
+ fun getAuthorizedDataSources(promise: Promise) {
479
+ scope.launch {
480
+ rookDataSources.getAuthorizedDataSources().fold(
481
+ {
482
+ val gson = Gson()
483
+ promise.resolve(gson.toJson(it))
484
+ }, {
485
+ promise.reject(it)
486
+ }
487
+ )
488
+ }
489
+ }
490
+
476
491
  override fun getName(): String {
477
492
  return "RookSyncModule"
478
493
  }
@@ -39,7 +39,7 @@ object DatasourcesUtils {
39
39
  map.putString("imageUrl", dataSource.imageUrl)
40
40
  map.putBoolean("connected", dataSource.connected)
41
41
  dataSource.authorizationUrl?.let {
42
- map.putString("authorizationUrl", it)
42
+ map.putString("authorizationURL", it)
43
43
  }
44
44
  array.pushMap(map)
45
45
  }
@@ -0,0 +1,5 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RookBackgroundModule : NSObject<RCTBridgeModule>
4
+
5
+ @end
@@ -0,0 +1,89 @@
1
+ #import "RookBackgroundModule.h"
2
+ #import "RookSDK/RookSDK-Swift.h"
3
+
4
+ @implementation RookBackgroundModule
5
+
6
+ RCT_EXPORT_MODULE()
7
+
8
+ /**
9
+ * Enable the background sync, this will automatically upload events and summaries
10
+ * at the moment the user enables this feature.
11
+ *
12
+ * @param resolve A block called with a boolean value indicating whether the events were successfully sync.
13
+ * @param reject A block called if an error occurs, such as Apple Health not being installed.
14
+ */
15
+ RCT_EXPORT_METHOD(enableBackGroundUpdates: (RCTPromiseResolveBlock) resolve
16
+ reject:(RCTPromiseRejectBlock)reject) {
17
+
18
+ [[RookBackGroundSync shared] enableBackGroundForSummaries];
19
+ [[RookBackGroundSync shared] enableBackGroundForEvents];
20
+ resolve(@(YES));
21
+ }
22
+
23
+ /**
24
+ * Disable the background sync
25
+ *
26
+ * @param resolve A block called with a boolean value indicating whether the events were successfully sync.
27
+ * @param reject A block called if an error occurs, such as Apple Health not being installed.
28
+ */
29
+ RCT_EXPORT_METHOD(disableBackGroundUpdates: (RCTPromiseResolveBlock) resolve
30
+ reject:(RCTPromiseRejectBlock)reject) {
31
+
32
+ [[RookBackGroundSync shared] disableBackGroundForSummaries];
33
+
34
+ [[RookBackGroundSync shared] disableBackGroundForEvents];
35
+
36
+ resolve(@(YES));
37
+ }
38
+
39
+ /**
40
+ * Enable background sync for summaries only
41
+ *
42
+ * @param resolve A block called with a boolean value indicating whether the events were successfully sync.
43
+ * @param reject A block called if an error occurs, such as Apple Health not being installed.
44
+ */
45
+ RCT_EXPORT_METHOD(enableBackGroundEventUpdates: (RCTPromiseResolveBlock) resolve
46
+ reject:(RCTPromiseRejectBlock)reject) {
47
+ [[RookBackGroundSync shared] enableBackGroundForEvents];
48
+ resolve(@(YES));
49
+ }
50
+
51
+ /**
52
+ * Disable the backGround sync just for events
53
+ *
54
+ * @param resolve A block called with a boolean value indicating whether the events were successfully sync.
55
+ * @param reject A block called if an error occurs, such as Apple Health not being installed.
56
+ */
57
+ RCT_EXPORT_METHOD(disableBackGroundEventUpdates: (RCTPromiseResolveBlock) resolve
58
+ reject:(RCTPromiseRejectBlock)reject) {
59
+
60
+ [[RookBackGroundSync shared] disableBackGroundForEvents];
61
+ }
62
+
63
+ /**
64
+ * Check if the background sync for summaries are enabled
65
+ *
66
+ * @param resolve A block called with a boolean value indicating whether the events were successfully sync.
67
+ * @param reject A block called if an error occurs, such as Apple Health not being installed.
68
+ */
69
+ RCT_EXPORT_METHOD(isBackGroundForSummariesEnable: (RCTPromiseResolveBlock) resolve
70
+ reject:(RCTPromiseRejectBlock)reject) {
71
+
72
+ bool result = [[RookBackGroundSync shared] isBackGroundForSummariesEnable];
73
+ resolve(@(result));
74
+ }
75
+
76
+ /**
77
+ * Check if the background sync for events are enabled
78
+ *
79
+ * @param resolve A block called with a boolean value indicating whether the events were successfully sync.
80
+ * @param reject A block called if an error occurs, such as Apple Health not being installed.
81
+ */
82
+ RCT_EXPORT_METHOD(isBackGroundForEventsEnable: (RCTPromiseResolveBlock) resolve
83
+ reject:(RCTPromiseRejectBlock)reject) {
84
+
85
+ bool result = [[RookBackGroundSync shared] isBackGroundForEventsEnable];
86
+ resolve(@(result));
87
+ }
88
+
89
+ @end
@@ -0,0 +1,5 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RookConfigurationModule : NSObject<RCTBridgeModule>
4
+
5
+ @end
@@ -0,0 +1,163 @@
1
+ #import "RookConfigurationModule.h"
2
+ #import "RookSDK/RookSDK-Swift.h"
3
+
4
+ @implementation RookConfigurationModule
5
+
6
+ RCT_EXPORT_MODULE()
7
+
8
+ UserManager* userManager;
9
+ RookConnectConfigurationManagerObjc *configShared;
10
+
11
+ - (void) checkInstance {
12
+ if (userManager == nil) userManager = [UserManager new];
13
+ }
14
+
15
+ /**
16
+ * Enables background sync.
17
+ *
18
+ * @param resolve A block called upon successfully enabling sync.
19
+ * @param reject A block called if an error occurs (not applicable here).
20
+ */
21
+ RCT_EXPORT_METHOD(enableSync: (RCTPromiseResolveBlock)resolve
22
+ reject:(RCTPromiseRejectBlock)reject) {
23
+
24
+ [configShared enableSync];
25
+ resolve(@(YES));
26
+
27
+ }
28
+
29
+ /**
30
+ * Disable background sync.
31
+ *
32
+ * @param resolve A block called upon successfully enabling sync.
33
+ * @param reject A block called if an error occurs (not applicable here).
34
+ */
35
+ RCT_EXPORT_METHOD(disableSync: (RCTPromiseResolveBlock)resolve
36
+ reject:(RCTPromiseRejectBlock)reject) {
37
+
38
+ [configShared disableSync];
39
+ resolve(@(YES));
40
+ }
41
+
42
+ /**
43
+ * Checks if background sync is enabled.
44
+ *
45
+ * @param resolve A block called with a boolean value indicating whether sync is enabled.
46
+ * @param reject A block called if an error occurs (not applicable here).
47
+ */
48
+ RCT_EXPORT_METHOD(isSyncEnable: (RCTPromiseResolveBlock)resolve
49
+ reject:(RCTPromiseRejectBlock)reject) {
50
+
51
+ bool result = [configShared isSyncEnable];
52
+ resolve(@(result));
53
+ }
54
+
55
+ /**
56
+ * Retrieves the user ID from the user manager.
57
+ *
58
+ * @param resolve A block called with the user ID if the operation is successful.
59
+ * @param reject A block called if an error occurs while retrieving the user ID.
60
+ */
61
+ RCT_EXPORT_METHOD(getUserID: (RCTPromiseResolveBlock)resolve
62
+ reject:(RCTPromiseRejectBlock)reject) {
63
+ [self checkInstance];
64
+
65
+ [userManager readUserIdWithCompletion:^(NSString * _Nullable userID, NSError * _Nullable error) {
66
+
67
+ if(error != nil) {
68
+ reject(error.description, error.localizedDescription, error);
69
+ return;
70
+ }
71
+
72
+ resolve(userID);
73
+
74
+ }];
75
+
76
+ }
77
+
78
+ /**
79
+ * Update the user ID from the user manager.
80
+ *
81
+ * @param resolve A block called with the user ID if the operation is successful.
82
+ * @param reject A block called if an error occurs while retrieving the user ID.
83
+ */
84
+ RCT_EXPORT_METHOD(updateUserID: (NSString *) userID
85
+ resolve:(RCTPromiseResolveBlock)resolve
86
+ reject:(RCTPromiseRejectBlock)reject) {
87
+ [self checkInstance];
88
+
89
+ [userManager updateUserId:userID completion:^(BOOL success, NSError * _Nullable error) {
90
+
91
+ if(error != nil) {
92
+ reject(error.description, error.localizedDescription, error);
93
+ return;
94
+ }
95
+
96
+ resolve(@(success));
97
+ }];
98
+
99
+ }
100
+
101
+ /**
102
+ * Clear the user ID from the user manager.
103
+ *
104
+ * @param resolve A block called with the user ID if the operation is successful.
105
+ * @param reject A block called if an error occurs while retrieving the user ID.
106
+ */
107
+ RCT_EXPORT_METHOD(clearUserID: (RCTPromiseResolveBlock)resolve
108
+ reject:(RCTPromiseRejectBlock)reject) {
109
+ [self checkInstance];
110
+
111
+ [userManager clearUserWithCompletion:^(BOOL success, NSError * _Nullable error) {
112
+ if(error != nil) {
113
+ reject(error.description, error.localizedDescription, error);
114
+ return;
115
+ }
116
+
117
+ resolve(@(success));
118
+ }];
119
+
120
+ }
121
+
122
+ /**
123
+ * Removes the user ID from the ROOK services.
124
+ *
125
+ * @param resolve A block called with the user ID if the operation is successful.
126
+ * @param reject A block called if an error occurs while retrieving the user ID.
127
+ */
128
+ RCT_EXPORT_METHOD(removeUserFromRook: (RCTPromiseResolveBlock)resolve
129
+ reject:(RCTPromiseRejectBlock)reject) {
130
+ [self checkInstance];
131
+
132
+ [userManager removeUserFromRookWithCompletion:^(BOOL success, NSError * _Nullable error) {
133
+ if(error != nil) {
134
+ reject(error.description, error.localizedDescription, error);
135
+ return;
136
+ }
137
+
138
+ resolve(@(success));
139
+ }];
140
+
141
+ }
142
+
143
+ /**
144
+ * Synchronizes the user's time zone with the user manager.
145
+ *
146
+ * @param resolve A block called with a boolean value indicating whether the time zone sync was successful.
147
+ * @param reject A block called if an error occurs during the sync process.
148
+ */
149
+ RCT_EXPORT_METHOD(syncUserTimeZone: (RCTPromiseResolveBlock)resolve
150
+ reject:(RCTPromiseRejectBlock)reject) {
151
+ [self checkInstance];
152
+
153
+ [userManager syncUserTimeZoneWithCompletion:^(BOOL success, NSError * _Nullable error) {
154
+ if(error != nil) {
155
+ reject(error.description, error.localizedDescription, error);
156
+ return;
157
+ }
158
+
159
+ resolve(@(success));
160
+ }];
161
+ }
162
+
163
+ @end
@@ -0,0 +1,5 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RookPermissionsModule : NSObject<RCTBridgeModule>
4
+
5
+ @end
@@ -0,0 +1,180 @@
1
+ #import "RookPermissionsModule.h"
2
+ #import "RookSDK/RookSDK-Swift.h"
3
+
4
+ @implementation RookPermissionsModule
5
+
6
+ RCT_EXPORT_MODULE()
7
+
8
+ RookConnectPermissionsManager *permissionsManager;
9
+
10
+ - (void) checkInstance {
11
+ if (permissionsManager == nil) permissionsManager = [RookConnectPermissionsManager new];
12
+ }
13
+
14
+ RCT_EXPORT_METHOD(requestPermissions: (NSArray<NSString *> * _Nullable)permissions
15
+ resolve:(RCTPromiseResolveBlock)resolve
16
+ reject:(RCTPromiseRejectBlock)reject) {
17
+ [self checkInstance];
18
+
19
+ [permissionsManager requestPermissions:permissions completion:^(BOOL success, NSError * _Nullable error) {
20
+ if(error != nil) {
21
+ reject(error.description, error.localizedDescription, error);
22
+ return;
23
+ }
24
+
25
+ resolve(@(success));
26
+ }];
27
+ }
28
+
29
+ /**
30
+ * Requests all available permissions from the permissions manager.
31
+ *
32
+ * @param resolve A block called with a boolean value indicating whether all permissions were successfully requested.
33
+ * @param reject A block called if an error occurs during the permission request process.
34
+ */
35
+ RCT_EXPORT_METHOD(requestAllPermissions: (RCTPromiseResolveBlock)resolve
36
+ reject:(RCTPromiseRejectBlock)reject) {
37
+ [self checkInstance];
38
+
39
+ [permissionsManager requestAllPermissionsObjcWithCompletion:^(BOOL success, NSError * _Nullable error) {
40
+ if(error != nil) {
41
+ reject(error.description, error.localizedDescription, error);
42
+ return;
43
+ }
44
+
45
+ resolve(@(success));
46
+ }];
47
+
48
+ }
49
+
50
+ /**
51
+ * Requests sleep permissions from the permissions manager.
52
+ *
53
+ * @param resolve A block called with a boolean value indicating whether all permissions were successfully requested.
54
+ * @param reject A block called if an error occurs during the permission request process.
55
+ */
56
+ RCT_EXPORT_METHOD(requestSleepPermissions: (RCTPromiseResolveBlock)resolve
57
+ reject:(RCTPromiseRejectBlock)reject) {
58
+ [self checkInstance];
59
+
60
+ [permissionsManager requestSleepPermissionsObjcWithCompletion:^(BOOL success, NSError * _Nullable error) {
61
+ if(error != nil) {
62
+ reject(error.description, error.localizedDescription, error);
63
+ return;
64
+ }
65
+
66
+ resolve(@(success));
67
+ }];
68
+
69
+ }
70
+
71
+ /**
72
+ * Requests user info permissions from the permissions manager.
73
+ *
74
+ * @param resolve A block called with a boolean value indicating whether all permissions were successfully requested.
75
+ * @param reject A block called if an error occurs during the permission request process.
76
+ */
77
+ RCT_EXPORT_METHOD(requestUserInfoPermissions: (RCTPromiseResolveBlock)resolve
78
+ reject:(RCTPromiseRejectBlock)reject) {
79
+ [self checkInstance];
80
+
81
+ [permissionsManager requestUserInfoPermissionsObjcWithCompletion:^(BOOL success, NSError * _Nullable error) {
82
+ if(error != nil) {
83
+ reject(error.description, error.localizedDescription, error);
84
+ return;
85
+ }
86
+
87
+ resolve(@(success));
88
+ }];
89
+
90
+ }
91
+
92
+ /**
93
+ * Requests physical permissions from the permissions manager.
94
+ *
95
+ * @param resolve A block called with a boolean value indicating whether all permissions were successfully requested.
96
+ * @param reject A block called if an error occurs during the permission request process.
97
+ */
98
+ RCT_EXPORT_METHOD(requestPhysicalPermissions: (RCTPromiseResolveBlock)resolve
99
+ reject:(RCTPromiseRejectBlock)reject) {
100
+ [self checkInstance];
101
+
102
+ [permissionsManager requestPhysicalPermissionsObjcWithCompletion:^(BOOL success, NSError * _Nullable error) {
103
+ if(error != nil) {
104
+ reject(error.description, error.localizedDescription, error);
105
+ return;
106
+ }
107
+
108
+ resolve(@(success));
109
+ }];
110
+
111
+ }
112
+
113
+ /**
114
+ * Requests body permissions from the permissions manager.
115
+ *
116
+ * @param resolve A block called with a boolean value indicating whether all permissions were successfully requested.
117
+ * @param reject A block called if an error occurs during the permission request process.
118
+ */
119
+ RCT_EXPORT_METHOD(requestBodyPermissions: (RCTPromiseResolveBlock)resolve
120
+ reject:(RCTPromiseRejectBlock)reject) {
121
+ [self checkInstance];
122
+
123
+ [permissionsManager requestBodyPermissionsObjcWithCompletion:^(BOOL success, NSError * _Nullable error) {
124
+ if(error != nil) {
125
+ reject(error.description, error.localizedDescription, error);
126
+ return;
127
+ }
128
+
129
+ resolve(@(success));
130
+ }];
131
+
132
+ }
133
+
134
+ /**
135
+ * Opens the Apple Health settings on the user's device.
136
+ *
137
+ * @param resolve A block called with a boolean value indicating whether the Apple Health settings were successfully opened.
138
+ * @param reject A block called if an error occurs, such as Apple Health not being installed.
139
+ */
140
+ RCT_EXPORT_METHOD(openAppleHealthSettings: (RCTPromiseResolveBlock)resolve
141
+ reject:(RCTPromiseRejectBlock)reject) {
142
+
143
+ NSURL *urlSettings = [NSURL URLWithString:@"x-apple-health://"];
144
+
145
+ if (!urlSettings) {
146
+ NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"Apple Health is not installed on iOS."};
147
+ NSError *error = [NSError errorWithDomain:@"io.ROOK.SDK" code:1001 userInfo:userInfo];
148
+ reject(error.description, error.localizedDescription, error);
149
+ return;
150
+ }
151
+
152
+
153
+ dispatch_async(dispatch_get_main_queue(), ^{
154
+ [[UIApplication sharedApplication] openURL:urlSettings options:@{} completionHandler:^(BOOL success) {
155
+ resolve(@(success));
156
+ }];
157
+ });
158
+ }
159
+
160
+ /**
161
+ * Checks the permission status for a specific data type in Apple Health.
162
+ *
163
+ * @param type The type of data for which the permission status is being checked (e.g., steps, sleep).
164
+ * @param resolve A block called with the permission status (e.g., authorized, denied, not determined).
165
+ * @param reject A block called if an error occurs (not used here).
166
+ */
167
+ RCT_EXPORT_METHOD(checkPermissionsStatus: (NSString * _Nullable) type
168
+ resolve: (RCTPromiseResolveBlock) resolve
169
+ reject: (RCTPromiseRejectBlock) reject) {
170
+ [self checkInstance];
171
+
172
+ [permissionsManager checkPermissionStatusWithType:type completionHandler:^(NSString * _Nonnull status) {
173
+
174
+ resolve(status);
175
+
176
+ }];
177
+
178
+ }
179
+
180
+ @end
package/ios/RookSdk.h CHANGED
@@ -1,13 +1,6 @@
1
1
  #import <React/RCTEventEmitter.h>
2
-
3
- #ifdef RCT_NEW_ARCH_ENABLED
4
- #import "RNRookSdkSpec.h"
5
-
6
- @interface RookSdk : RCTEventEmitter <NativeRookSdkSpec>
7
- #else
8
2
  #import <React/RCTBridgeModule.h>
9
3
 
10
4
  @interface RookSdk : RCTEventEmitter <RCTBridgeModule>
11
- #endif
12
5
 
13
6
  @end