react-native-visit-rn-sdk 6.0.4 → 7.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.
Files changed (93) hide show
  1. package/README.md +286 -195
  2. package/android/build.gradle +4 -1
  3. package/android/gradle.properties +4 -4
  4. package/android/src/main/AndroidManifest.xml +11 -5
  5. package/android/src/main/AndroidManifestNew.xml +11 -5
  6. package/android/src/main/java/com/visitrnsdk/VisitFitnessModule.kt +642 -0
  7. package/android/src/main/java/com/visitrnsdk/VisitRnSdkPackage.kt +1 -1
  8. package/android/src/main/java/com/visitrnsdk/VisitSessionStorage.kt +50 -0
  9. package/ios/VisitRnSdkViewManager.h +23 -1
  10. package/ios/VisitRnSdkViewManager.m +1259 -8
  11. package/lib/commonjs/Services.js +35 -0
  12. package/lib/commonjs/Services.js.map +1 -0
  13. package/lib/commonjs/constants.js +11 -0
  14. package/lib/commonjs/constants.js.map +1 -0
  15. package/lib/commonjs/index.android.js +451 -206
  16. package/lib/commonjs/index.android.js.map +1 -1
  17. package/lib/commonjs/index.ios.js +266 -114
  18. package/lib/commonjs/index.ios.js.map +1 -1
  19. package/lib/module/Services.js +27 -0
  20. package/lib/module/Services.js.map +1 -0
  21. package/lib/module/constants.js +5 -0
  22. package/lib/module/constants.js.map +1 -0
  23. package/lib/module/index.android.js +451 -207
  24. package/lib/module/index.android.js.map +1 -1
  25. package/lib/module/index.ios.js +268 -116
  26. package/lib/module/index.ios.js.map +1 -1
  27. package/lib/typescript/Services.d.ts +3 -0
  28. package/lib/typescript/Services.d.ts.map +1 -0
  29. package/lib/typescript/constants.d.ts +6 -0
  30. package/lib/typescript/constants.d.ts.map +1 -0
  31. package/lib/typescript/index.android.d.ts +26 -3
  32. package/lib/typescript/index.android.d.ts.map +1 -1
  33. package/lib/typescript/index.ios.d.ts +20 -3
  34. package/lib/typescript/index.ios.d.ts.map +1 -1
  35. package/package.json +16 -26
  36. package/react-native-visit-rn-sdk.podspec +2 -1
  37. package/src/Services.js +37 -0
  38. package/src/constants.js +4 -0
  39. package/src/index.android.js +773 -0
  40. package/src/index.ios.js +429 -0
  41. package/android/src/main/java/com/visitrnsdk/VisitRnSdkLocationModule.kt +0 -37
  42. package/lib/commonjs/assets/video-call/connecting-lottie.gif +0 -0
  43. package/lib/commonjs/assets/video-call/end-call.png +0 -0
  44. package/lib/commonjs/assets/video-call/mic-off.png +0 -0
  45. package/lib/commonjs/assets/video-call/reconnecting.gif +0 -0
  46. package/lib/commonjs/assets/video-call/switch-camera.png +0 -0
  47. package/lib/commonjs/assets/video-call/toggle-down.png +0 -0
  48. package/lib/commonjs/assets/video-call/toggle-up.png +0 -0
  49. package/lib/commonjs/assets/video-call/video-off.png +0 -0
  50. package/lib/commonjs/components/VideoCallComponent.js +0 -1088
  51. package/lib/commonjs/components/VideoCallComponent.js.map +0 -1
  52. package/lib/commonjs/index.js +0 -6
  53. package/lib/commonjs/index.js.map +0 -1
  54. package/lib/commonjs/shims.d.js +0 -2
  55. package/lib/commonjs/shims.d.js.map +0 -1
  56. package/lib/commonjs/types.js +0 -2
  57. package/lib/commonjs/types.js.map +0 -1
  58. package/lib/module/assets/video-call/connecting-lottie.gif +0 -0
  59. package/lib/module/assets/video-call/end-call.png +0 -0
  60. package/lib/module/assets/video-call/mic-off.png +0 -0
  61. package/lib/module/assets/video-call/reconnecting.gif +0 -0
  62. package/lib/module/assets/video-call/switch-camera.png +0 -0
  63. package/lib/module/assets/video-call/toggle-down.png +0 -0
  64. package/lib/module/assets/video-call/toggle-up.png +0 -0
  65. package/lib/module/assets/video-call/video-off.png +0 -0
  66. package/lib/module/components/VideoCallComponent.js +0 -1081
  67. package/lib/module/components/VideoCallComponent.js.map +0 -1
  68. package/lib/module/index.js +0 -2
  69. package/lib/module/index.js.map +0 -1
  70. package/lib/module/shims.d.js +0 -2
  71. package/lib/module/shims.d.js.map +0 -1
  72. package/lib/module/types.js +0 -2
  73. package/lib/module/types.js.map +0 -1
  74. package/lib/typescript/components/VideoCallComponent.d.ts +0 -79
  75. package/lib/typescript/components/VideoCallComponent.d.ts.map +0 -1
  76. package/lib/typescript/index.d.ts +0 -17
  77. package/lib/typescript/index.d.ts.map +0 -1
  78. package/lib/typescript/types.d.ts +0 -24
  79. package/lib/typescript/types.d.ts.map +0 -1
  80. package/src/assets/video-call/connecting-lottie.gif +0 -0
  81. package/src/assets/video-call/end-call.png +0 -0
  82. package/src/assets/video-call/mic-off.png +0 -0
  83. package/src/assets/video-call/reconnecting.gif +0 -0
  84. package/src/assets/video-call/switch-camera.png +0 -0
  85. package/src/assets/video-call/toggle-down.png +0 -0
  86. package/src/assets/video-call/toggle-up.png +0 -0
  87. package/src/assets/video-call/video-off.png +0 -0
  88. package/src/components/VideoCallComponent.tsx +0 -1484
  89. package/src/index.android.tsx +0 -459
  90. package/src/index.ios.tsx +0 -238
  91. package/src/index.tsx +0 -25
  92. package/src/shims.d.ts +0 -49
  93. package/src/types.ts +0 -25
package/README.md CHANGED
@@ -1,249 +1,340 @@
1
- # react-native-visit-rn-sdk
1
+ ### **Instructions for configuring your Android Project**
2
+
3
+ * Install Visit React Native Plugin
4
+ `npm install react-native-visit-rn-sdk@7.0.0`
5
+ * Install these transitive plugins that Visit Plugin requires internally:
6
+ `npm install react-native-device-info`
7
+ `npm install https://github.com/sashko9807/react-native-location-enabler`
8
+ `npm install react-native-event-listeners`
9
+ `npm install react-native-webview`
10
+ * Add `https://jitpack.io` to the host app’s Gradle repositories for `com.github.VisitApp:AndroidSDK`.
11
+ * Enable code desugaring in your app, or there add the dependency.
2
12
 
3
- React Native SDK for displaying the Visit Health PWA and exchanging events
4
- between the PWA and its host app.
5
-
6
- ## Installation
7
-
8
- ```sh
9
- npm install react-native-visit-rn-sdk@6.0.4 @twilio/video-react-native-sdk@3.5.0 react-native-permissions@4.1.5 react-native-webview@^13.16.0
13
+ ```
14
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
10
15
  ```
11
16
 
12
- `@twilio/video-react-native-sdk`, `react-native-permissions`, and
13
- `react-native-webview` are required peer dependencies; they are not bundled
14
- in the SDK. Install them in the host app as shown above.
15
-
16
- The Twilio `3.5.0` peer metadata requires React `^19.1.0` and React Native
17
- `^0.81.0`. If an existing project has npm peer-resolution errors, first verify
18
- that its React and React Native versions are compatible. Use
19
- `--legacy-peer-deps` only when the project's dependency policy intentionally
20
- allows npm to skip peer-dependency enforcement; the flag does not make
21
- incompatible native versions compatible.
17
+ * Inside the `:app` `build.gradle` android block specify these.
22
18
 
23
- SDK `6.0.4` requires Node.js `16` or newer, Android API `21` or newer, and an
24
- iOS deployment target of `12.4` or newer. React Native and other native
25
- dependencies may impose higher platform minimums. After installing or changing
26
- iOS native dependencies, run:
19
+ ```
27
20
 
28
- ```sh
29
- npx pod-install
21
+ android {
22
+ compileOptions {
23
+ coreLibraryDesugaringEnabled true
24
+ sourceCompatibility JavaVersion.VERSION_17
25
+ targetCompatibility JavaVersion.VERSION_17
26
+ }
27
+ }
30
28
  ```
31
29
 
32
- ## Usage
30
+ * In the `AndroidManifest.xml` file, add the metadata tag to serve the privacy manifest URL
33
31
 
34
- ```tsx
35
- import { useRef } from 'react';
36
- import VisitRnSdkView, {
37
- type VisitRnSdkViewHandle,
38
- type VisitRnSdkViewProps,
39
- } from 'react-native-visit-rn-sdk';
32
+ ```
33
+ <meta-data
34
+ android:name="visit_android_sdk.health_connect_privacy_policy_url"
35
+ android:value="https://www.google.com" />
36
+ ```
37
+ * Version Requirement:
38
+ AGP: `8.13.2` or higher
39
+ Kotlin: `1.9.25`or higher
40
+ `compileSdkVersion`: 36 or higher
40
41
 
41
- const sdkRef = useRef<VisitRnSdkViewHandle>(null);
42
+ ‌
42
43
 
43
- const props: VisitRnSdkViewProps = {
44
- ssoLink: '<pre-generated SSO link>',
45
- // isLoggingEnabled is optional (boolean); defaults to false
46
- onEvent: (eventName, properties) => {
47
- if (eventName === 'INITIATE_PAYMENT') {
48
- // Open the host payment PWA. Keep VisitRnSdkView mounted.
49
- }
50
- },
51
- };
44
+ ### **Instructions for configuring Plugin in iOS project**
52
45
 
53
- <VisitRnSdkView {...props} ref={sdkRef} />;
46
+ * Add the plugin `npm install react-native-visit-rn-sdk@7.0.0 && npx pod-install`
47
+ * Install pods(for M1 processors running build on `x86_64` hardware)
54
48
 
55
- // After the host payment PWA finishes:
56
- sdkRef.current?.sendEvent('PAYMENT_STATUS', { status: 'success' });
57
- ```
49
+ `arch -x86_64 pod install`
58
50
 
59
- `isLoggingEnabled` is optional. When omitted it defaults to `false`; if you pass it, the value must be a `boolean`.
60
51
 
61
- Provide a non-empty, pre-generated URL in `ssoLink`. Although the prop is
62
- optional at the type level, an omitted or blank value causes the SDK to render
63
- no WebView.
52
+ * In the Signing & Capabilities section in Xcode, add HealthKit as a capability
53
+ * Add this read-only HealthKit key inside the `Info.plist` file. Use it to explain why the app reads steps, calories, distance, and sleep from HealthKit.
64
54
 
65
- `VisitRnSdkViewProps`, `VisitRnSdkViewHandle`, and `VisitEventProperties` are
66
- exported for host apps that want to type wrappers, refs, callbacks, or event
67
- payloads.
68
-
69
- ### Host ↔ Visit PWA events (6.0.4)
55
+ ```
56
+ <key>NSHealthShareUsageDescription</key>
57
+ <string>Visit requires your permission to read health and fitness data.</string>
58
+ ```
70
59
 
71
- The event bridge works the same way on Android and iOS. Keep
72
- `VisitRnSdkView` mounted while the React Native client app displays any
73
- external host UI so the SDK ref remains available.
60
+ # **Usage**
74
61
 
75
- #### Visit PWA / SDK → React Native client app
62
+ ```
63
+ import React from 'react';
64
+ import VisitRnSdkView from 'react-native-visit-rn-sdk';
65
+ import {EventRegister} from 'react-native-event-listeners';
66
+ import {SafeAreaView, Alert} from 'react-native';
67
+
68
+ function App() {
69
+
70
+ return (
71
+ <SafeAreaView style={{flex: 1}}>
72
+ <VisitRnSdkView
73
+ magicLink={<Enter the sso link here>}
74
+ isLoggingEnabled={true}
75
+ }
76
+ />
77
+ </SafeAreaView>
78
+ );
79
+ }
80
+
81
+ export default App;
82
+ ```
76
83
 
77
- The Visit PWA sends a JSON message through the React Native WebView. Use
78
- `sendEventToHost` as the method and provide a non-empty `eventName`:
84
+ To see the full usage code for getting Health Connect/HealthKit connection status and retrieving health data, refer [here](https://github.com/VisitApp/Visit-ReactNative/blob/mchi-rn-sdk-3x/example/App.js).
85
+
86
+ ## **Example App SDK Initialization and Manual Step Sync**
87
+
88
+ The example app separates health SDK setup, WebView-driven sync setup, and the
89
+ sync request itself. On the first eligible `Home` focus, it automatically
90
+ checks the platform connection, fetches today's metrics, and starts manual
91
+ sync only if the step read succeeds. The button remains available for later
92
+ manual retries.
93
+
94
+ ```mermaid
95
+ flowchart TD
96
+ A["App opens on Home"] --> B{"Platform"}
97
+ B -->|Android| C["Home useEffect calls<br/>VisitFitnessModule.initiateSDK(true)"]
98
+ C --> D["Native module creates the Health Connect utility,<br/>step-sync helper, and session storage"]
99
+ D --> E["Home focus checks Health Connect status"]
100
+ B -->|iOS| F["Home focus checks HealthKit status<br/>No explicit initiateSDK call"]
101
+ F --> G{"Health status"}
102
+ E --> G
103
+ G -->|CONNECTED| H["Fetch today's metrics"]
104
+ G -->|Any other status| I["Do not sync and keep<br/>Start Step Sync disabled"]
105
+ H --> Y{"Today step count fetched?"}
106
+ Y -->|No| Z["Show an error and do not sync"]
107
+ Y -->|Yes| AA{"First eligible Home focus?"}
108
+ AA -->|Yes| R["Start automatic manual sync"]
109
+ AA -->|No| Q["Refresh metrics and keep<br/>Start Step Sync available"]
110
+
111
+ A --> J["User selects Go to next page"]
112
+ J --> K["VisitPage mounts VisitRnSdkView"]
113
+ K --> L["Visit WebView loads the SSO URL"]
114
+ L --> M["PWA posts UPDATE_API_BASE_URL"]
115
+ M --> N["Native layer stores API credentials<br/>and daily/hourly timestamps"]
116
+ N --> O["Native layer attempts the initial sync<br/>when its platform preconditions pass"]
117
+ O --> P["User returns to Home"]
118
+ P --> G
119
+
120
+ Q --> AB["User selects Start Step Sync"]
121
+ AB --> R
122
+ R --> S{"Platform"}
123
+ S -->|Android| T["VisitFitnessModule.triggerManualSync()"]
124
+ S -->|iOS| U["VisitRnSdkViewManager.triggerManualSync()"]
125
+ T --> V["Validate state, collect hourly/daily steps,<br/>and send them to Visit"]
126
+ U --> V
127
+ V -->|Resolved| W["Show the success message"]
128
+ V -->|Rejected| X["Show the native error message"]
129
+ ```
79
130
 
80
- ```js
131
+ ### **1. Home Mount and Health Status**
132
+
133
+ On Android, the `Home` component's mount effect calls
134
+ `NativeModules.VisitFitnessModule.initiateSDK(true)`. The native method uses
135
+ the current Activity to create `HealthConnectUtil`, `VisitStepSyncHelper`, and
136
+ `VisitSessionStorage`. `App.js` then immediately sets
137
+ `isAndroidSDKInitialized` to `true`; `initiateSDK` is a void bridge call, so
138
+ this React state does not confirm that native initialization succeeded. If
139
+ `currentActivity` is `null`, the native method skips initialization. Mounting
140
+ `VisitRnSdkView` on Android calls `initiateSDK` again, which gives the SDK
141
+ another opportunity to initialize with an available Activity.
142
+
143
+ Once the Android React flag is true and `Home` is focused,
144
+ `runHealthStatusFlow()` calls `getHealthConnectStatus()`. On iOS, there is no
145
+ equivalent `initiateSDK` call in `App.js`; each `Home` focus calls
146
+ `VisitRnSdkViewManager.getHealthKitConnectStatus()` directly.
147
+
148
+ For either platform, a `CONNECTED` result triggers
149
+ `fetchTodayHealthMetrics()`, which requests today's steps, sleep minutes, and
150
+ calories from the platform-native module. The helper reports whether the step
151
+ request succeeded. On the first eligible `Home` focus, a successful step read
152
+ continues directly into manual sync; a failed step read shows an error and
153
+ blocks that automatic attempt. Other connection states do not fetch metrics or
154
+ start sync.
155
+
156
+ An in-memory ref records the first automatic attempt. Later `Home` focuses
157
+ refresh connection status and metrics but do not automatically sync again
158
+ during the same component lifetime.
159
+
160
+ ### **2. WebView Setup and Initial Sync**
161
+
162
+ Selecting **Go to next page** navigates to `VisitPage` and mounts
163
+ `VisitRnSdkView` with the entered SSO URL. After the Visit PWA loads, it must
164
+ post an `UPDATE_API_BASE_URL` message containing `apiBaseUrl`, `authtoken`,
165
+ `googleFitLastSync`, and `gfHourlyLastSync`.
166
+
167
+ The SDK handles that message as follows:
168
+
169
+ * Android calls `VisitFitnessModule.updateApiBaseUrl()`, which stores the
170
+ values in `VisitSessionStorage` and starts the initial sync once per native
171
+ module lifecycle, unless a sync is already running. A failed initial sync
172
+ can be attempted again when the values are updated later.
173
+ * iOS calls `VisitRnSdkViewManager.updateApiUrl()` once per mounted
174
+ `VisitRnSdkView`, stores the available non-empty credentials and positive
175
+ timestamps in `NSUserDefaults`, and attempts the initial sync when HealthKit
176
+ is available, credentials are present, permission is available, and no
177
+ other sync is running.
178
+
179
+ The initial sync and the manual sync share the same native in-progress guard.
180
+ Returning to `Home` while the initial sync is still running can therefore make
181
+ an explicit button attempt reject with `SYNC_IN_PROGRESS`.
182
+
183
+ > **Ordering requirement:** `CONNECTED` only represents Health Connect or
184
+ > HealthKit access. It does not mean that the Visit API credentials and sync
185
+ > timestamps are ready. On a fresh install or after clearing app data, mount
186
+ > `VisitRnSdkView` and allow it to process `UPDATE_API_BASE_URL` before either
187
+ > automatic or button-driven sync. Otherwise, sync can reject with
188
+ > `MISSING_SYNC_CREDENTIALS` or `MISSING_SYNC_TIMESTAMPS` even though health
189
+ > access is connected. The automatic attempt runs only once per `Home` mount,
190
+ > so after visiting `VisitPage`, use **Start Step Sync** to retry.
191
+
192
+ ### **3. Automatic and Button-Driven Step Sync**
193
+
194
+ The first eligible `Home` focus uses a shared in-flight lock while it checks
195
+ the connection and fetches today's metrics. This disables **Start Step Sync**
196
+ during preparation and prevents the button from overlapping the automatic
197
+ request. A successful step read calls the shared native sync executor.
198
+
199
+ The button remains enabled when the health connection status is `CONNECTED`
200
+ and no sync flow is running. Automatic and button-driven requests both:
201
+
202
+ 1. Set `syncStatus` to `syncing` and show **Syncing in progress...**.
203
+ 2. Call `VisitFitnessModule.triggerManualSync()` on Android or
204
+ `VisitRnSdkViewManager.triggerManualSync()` on iOS.
205
+ 3. Let the native module validate its prerequisites and then collect and
206
+ upload the hourly and daily step data using the stored timestamps,
207
+ credentials, and Visit endpoints.
208
+ 4. On resolution, set the status to `success` and show **Syncing has been
209
+ done successfully**. On rejection, set the status to `error` and show
210
+ the native error message.
211
+
212
+ The resolved native status string is written to the console, but the example
213
+ shows its own fixed success message. A completed manual sync also does not
214
+ automatically reload the three metric cards; those are refreshed the next
215
+ time the focused-screen status flow calls `fetchTodayHealthMetrics()`.
216
+
217
+ ### **Manual Sync Preflight and Failures**
218
+
219
+ | Platform | Code | When it occurs |
220
+ | --- | --- | --- |
221
+ | Android | `SDK_NOT_INITIALIZED` | Session storage, the Health Connect utility, or the step-sync helper was not initialized. |
222
+ | iOS | `HEALTH_DATA_UNAVAILABLE` | HealthKit is unavailable on the device. |
223
+ | Both | `SYNC_IN_PROGRESS` | The initial WebView-driven sync or another manual sync is still running. |
224
+ | Both | `MISSING_SYNC_CREDENTIALS` | The WebView has not stored a non-empty Visit API base URL and auth token. |
225
+ | Android | `MISSING_SYNC_TIMESTAMPS` | Either the stored daily or hourly timestamp is negative. |
226
+ | iOS | `MISSING_SYNC_TIMESTAMPS` | Both stored timestamps are zero or missing. |
227
+ | iOS | `PERMISSION_DENIED` | HealthKit access is not available when the manual sync starts. |
228
+ | Both | `SYNC_FAILED` | The native sync pipeline reports a failure; on iOS this contains the first network or non-2xx Visit response. |
229
+
230
+ After the preflight passes, Android delegates the hourly and daily work to
231
+ `VisitStepSyncHelper`. iOS runs both flows through its shared sync executor.
232
+ The iOS executor posts hourly batches to `/users/embellish-sync` and daily
233
+ data to `/users/data-sync`; the manual promise resolves only after both flows
234
+ finish.
235
+
236
+ ## Fitness data and Health Connect connection
237
+
238
+ The SDK reads steps, calories, distance, and sleep from Health Connect on Android
239
+ and HealthKit on iOS. Android also reads exercise duration for activity totals.
240
+ Health Connect history access is optional. The iOS host app needs the HealthKit
241
+ capability and an `NSHealthShareUsageDescription` that explains the four metrics.
242
+
243
+ For Android, declare steps, distance, total calories, sleep, exercise, and optional
244
+ history access in the host app's Google Play Health Apps form. Use the merged
245
+ manifest to verify the permission list. See [Google Play's Health Connect publishing guide](https://developer.android.com/health-and-fitness/health-connect/publish).
246
+
247
+ To start the Android connection flow, send:
248
+
249
+ ```javascript
81
250
  window.ReactNativeWebView.postMessage(
82
- JSON.stringify({
83
- method: 'sendEventToHost',
84
- eventName: 'INITIATE_PAYMENT',
85
- orderId: '<order-id>',
86
- })
251
+ JSON.stringify({ method: 'CONNECT_TO_GOOGLE_FIT' })
87
252
  );
88
253
  ```
89
254
 
90
- The SDK removes `method` and `eventName` from the message and passes every
91
- remaining top-level field to the client app as `properties`. Receive the event
92
- through the optional `onEvent` callback:
93
-
94
- ```tsx
95
- import { useRef } from 'react';
96
- import VisitRnSdkView, {
97
- type VisitRnSdkViewHandle,
98
- } from 'react-native-visit-rn-sdk';
99
-
100
- const sdkRef = useRef<VisitRnSdkViewHandle>(null);
101
-
102
- <VisitRnSdkView
103
- ref={sdkRef}
104
- ssoLink="<pre-generated SSO link>"
105
- onEvent={(eventName, properties) => {
106
- if (eventName === 'INITIATE_PAYMENT') {
107
- // Open the client app's payment UI.
108
- // Read the example order ID from properties?.orderId.
109
- }
110
- }}
111
- />;
112
- ```
255
+ The native SDK requests Health Connect permissions or opens its Play Store page
256
+ if installation or an update is required. Send the same message again after
257
+ returning from the store. The PWA can request the current state with
258
+ `GET_HEALTH_CONNECT_STATUS`. The native bridge reports `NOT_SUPPORTED`,
259
+ `NOT_INSTALLED`, `INSTALLED`, or `CONNECTED`.
113
260
 
114
- #### React Native client app → Visit PWA / SDK
261
+ Both platforms accept `GET_DATA_TO_GENERATE_GRAPH` for steps, calories, and
262
+ distance by day, week, and month, and for sleep by day and week. The SDK
263
+ delivers the existing `DetailedGraph` callbacks and supplies steps and sleep
264
+ minutes to `updateFitnessPermissions` on connection.
115
265
 
116
- Call `sendEvent(eventName, properties)` on the SDK ref to send an event back
117
- into the Visit PWA. For example, after the client app finishes the payment
118
- flow:
266
+ ### **7.0.0**
119
267
 
120
- ```tsx
121
- sdkRef.current?.sendEvent('PAYMENT_STATUS', {
122
- status: 'success',
123
- });
124
- ```
268
+ * Restore steps, calories, distance, and sleep on Android and iOS.
269
+ * Use AndroidSDK `v7.0.0` and start the native Health Connect permission flow directly.
270
+ * Remove the Android PWA disclaimer callback.
125
271
 
126
- The SDK invokes `window.sendEventToVisit(eventName, properties)` inside the
127
- Visit PWA. The Visit PWA must define that function:
272
+ ### **3.0.15**
128
273
 
129
- ```js
130
- window.sendEventToVisit = function (eventName, properties) {
131
- if (eventName === 'PAYMENT_STATUS') {
132
- // Continue the Visit flow using properties.status.
133
- }
134
- };
135
- ```
274
+ * Detect when iOS step-read access is unavailable after the HealthKit authorization sheet has already been answered.
275
+ * Show recovery instructions when HealthKit access is denied and offer to open the Health settings page.
276
+ * Refresh the PWA's HealthKit permission state when the iOS app returns to the foreground.
136
277
 
137
- - `properties` is optional. When omitted, the SDK passes an empty object (`{}`).
138
- - `eventName` must be a non-empty string. `sendEvent` also rejects names that
139
- contain only whitespace. Messages without a valid event name are ignored.
140
- - Built-in WebView bridge messages are handled internally. Only messages using
141
- `method: 'sendEventToHost'` are delivered through `onEvent`.
142
- - Keep `VisitRnSdkView` mounted while external client-app UI is open so
143
- `sdkRef.current` remains available.
278
+ ### **3.0.14**
144
279
 
145
- ## Location permissions
280
+ * Request read-only HealthKit access for step data on iOS without requesting write permission.
281
+ * Determine HealthKit connection status without writing and deleting a probe step sample.
282
+ * Keep the existing JavaScript APIs and callback signatures unchanged.
146
283
 
147
- Android host apps that use Visit's location flow must declare both foreground
148
- location permissions:
284
+ ### **3.0.13**
149
285
 
150
- ```xml
151
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
152
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
153
- ```
286
+ * Add iOS compatibility methods for `getTodaySleepMinutes()` and `getTodayCalorieCount()` that resolve to `0`.
287
+ * Keep the existing JavaScript APIs and callback signatures unchanged.
154
288
 
155
- When the web application sends `GET_LOCATION_PERMISSIONS`, the Android SDK
156
- checks for fine-location access. It requests fine location through the normal
157
- runtime permission dialog when possible. If permission is blocked, the SDK
158
- offers to open the app's settings page. Runtime permission handling uses the
159
- required `react-native-permissions` peer dependency.
289
+ ### **3.0.12**
160
290
 
161
- After permission is granted, the SDK checks the phone's Location Services
162
- setting. It never displays an in-app GPS enable prompt; instead, it offers to
163
- open the phone's Location settings. When the user returns, the SDK rechecks
164
- both states and calls the existing web callback:
291
+ * Rely on the PWA's `GET_HEALTH_CONNECT_STATUS` request instead of automatically refreshing Health Connect status whenever the Android app returns to the foreground.
165
292
 
166
- ```js
167
- window.checkTheGpsPermission(true); // Fine location and Location Services enabled
168
- window.checkTheGpsPermission(false); // Either requirement is unavailable
169
- ```
293
+ ### **3.0.11**
170
294
 
171
- Approximate/coarse-only location access is not sufficient. On iOS,
172
- `GET_LOCATION_PERMISSIONS` currently calls
173
- `window.checkTheGpsPermission(true)` without requesting or checking an iOS
174
- location permission. Do not treat that callback as proof that the host app has
175
- iOS location authorization.
295
+ * Upgrade AndroidSDK to `v3.13`.
296
+ * Reconcile hourly step buckets with Health Connect's exact daily aggregate so the graph total matches the daily total despite hourly fractional-step truncation.
297
+ * Keep the existing React Native APIs and PWA callback signatures unchanged.
176
298
 
177
- ## Dependency and event migration
299
+ ### **3.0.10**
178
300
 
179
- `react-native-event-listeners` and
180
- `@visit-health/react-native-location-enabler` are no longer used by the SDK.
181
- Remove them from the host app if nothing else requires them, and install the
182
- `react-native-permissions` peer dependency shown above.
301
+ * Upgrade AndroidSDK to `v3.12`.
302
+ * Keep the existing React Native APIs and PWA callbacks unchanged while Android returns compatibility zero values for removed calorie, distance, and sleep Health Connect data.
183
303
 
184
- The SDK no longer emits the global `visit-event`. In particular,
185
- `OPEN_FACE_SCAN_FLOW` and WebView errors are no longer forwarded through a
186
- global event emitter, and the example app's unused
187
- `unauthorized-wellness-access` listener has been removed. WebView errors are
188
- logged only when `isLoggingEnabled={true}`.
304
+ ### **3.0.9**
189
305
 
190
- ## Migrating from versions before 6.0.1
306
+ * Check Health Connect installation status before native step capability.
307
+ * Route `NOT_INSTALLED` directly to the native install/permission flow instead of the PWA disclaimer.
308
+ * Route Health Connect status-check failures to the permission flow.
309
+ * Keep capability-check failures on the PWA disclaimer fallback.
191
310
 
192
- Pass the pre-generated SSO URL through `ssoLink`. This is the only URL prop;
193
- `isLoggingEnabled` remains optional and defaults to `false`.
311
+ ### **3.0.8**
194
312
 
195
- ## Migrating to 6.0.0
313
+ * Remove duplicate-request suppression so the PWA can restart the flow after the user returns from the Health Connect Play Store page.
196
314
 
197
- Apple Health and Health Connect functionality has been removed in `6.0.0`.
198
- Host apps no longer need to add HealthKit entitlements, HealthKit usage
199
- descriptions, Health Connect permissions, or Health Connect rationale screens
200
- for this package.
315
+ ### **3.0.7**
201
316
 
202
- The SDK no longer accepts `cpsid`, `baseUrl`, `errorBaseUrl`, `token`,
203
- `moduleName`, or `environment`, and it no longer generates magic links
204
- internally. The current `6.0.4` component props are `ssoLink`,
205
- `isLoggingEnabled`, and `onEvent`; its ref exposes `sendEvent`.
317
+ * Add Android native step-tracking capability detection through AndroidSDK `v3.11`.
318
+ * Add the `window.showHealthConnectDisclaimer()` PWA callback and strict `disclaimerAccepted: true` continuation contract.
319
+ * Add Health Connect routing logs for supported, unsupported, and failed capability checks.
206
320
 
207
- ## Video calling
321
+ ### **Sample Project**
208
322
 
209
- `react-native-visit-rn-sdk@6.0.4` declares
210
- [`@twilio/video-react-native-sdk`](https://www.npmjs.com/package/@twilio/video-react-native-sdk)
211
- `3.5.0` as an exact peer dependency. Install it with the SDK as shown in the
212
- [Installation](#installation) section.
323
+ Please use the below project which demonstrates how to use the SDK. `https://github.com/VisitApp/Visit-ReactNative/tree/mchi-rn-sdk-3x/example`
213
324
 
214
- Twilio's Android library declares its camera and audio permissions in its own
215
- manifest, so Android's manifest merger normally adds them to the host app.
216
- Verify that the merged release manifest contains:
217
-
218
- ```xml
219
- <uses-permission android:name="android.permission.CAMERA" />
220
- <uses-permission android:name="android.permission.RECORD_AUDIO" />
221
- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
222
- ```
223
-
224
- The iOS host app must provide camera and microphone usage descriptions in
225
- `Info.plist`:
226
-
227
- ```xml
228
- <key>NSCameraUsageDescription</key>
229
- <string>Visit needs camera access for video consultations.</string>
230
- <key>NSMicrophoneUsageDescription</key>
231
- <string>Visit needs microphone access for video consultations.</string>
232
- ```
325
+ **Permission Usage Declaration:**
233
326
 
234
- Twilio `3.5.0` does not prescribe extra app-level ProGuard/R8 rules in its
235
- published React Native setup. If a minified release reports shrinker errors,
236
- resolve those specific diagnostics for the dependency versions in that app
237
- instead of applying blanket keep and `-dontwarn` rules.
327
+ 1\. For android, Google needs the declaration of how you are using the Health Data in your organisation privacy policy webpage.
328
+ Description for this is present inside this document along with the permission that needs to be added in the Google Play Console
329
+ <custom data-type="smartlink" data-id="id-0">https://docs.google.com/document/d/1QKtC9ofRtrLIroBzW0pG7BrdrpG_KorHbM5Y0zcgGQI/edit?usp=sharing</custom>
330
+
238
331
 
239
- ## Contributing
332
+ 2. For iOS, Health and Fitness permission needs to be added in the App Store Connect Dashboard.
240
333
 
241
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
334
+ ![](blob:https://media.staging.atl-paas.net/?type=file&localId=d0ec2b9a9fa8&id=e6019c8d-ca4b-4cae-bbae-9434437759ca&&collection=contentId-2202599425&height=523&occurrenceKey=null&width=1181&__contextId=null&__displayType=null&__external=false&__fileMimeType=null&__fileName=null&__fileSize=null&__mediaTraceId=null&url=null)
242
335
 
243
- ## License
336
+
244
337
 
245
- MIT
246
338
 
247
- ---
248
339
 
249
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
340
+ ‌
@@ -101,7 +101,10 @@ dependencies {
101
101
  //noinspection GradleDynamicVersion
102
102
  implementation "com.facebook.react:react-native:+"
103
103
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
104
- implementation "androidx.appcompat:appcompat:1.7.1"
104
+ implementation "com.github.VisitApp:AndroidSDK:v7.0.0"
105
+ implementation "androidx.health.connect:connect-client:1.1.0"
106
+ implementation "com.jakewharton.timber:timber:5.0.1"
107
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1"
105
108
  }
106
109
 
107
110
  if (isNewArchitectureEnabled()) {
@@ -1,5 +1,5 @@
1
- VisitRnSdk_kotlinVersion=1.7.0
2
- VisitRnSdk_minSdkVersion=21
3
- VisitRnSdk_targetSdkVersion=31
4
- VisitRnSdk_compileSdkVersion=31
1
+ VisitRnSdk_kotlinVersion=1.9.25
2
+ VisitRnSdk_minSdkVersion=23
3
+ VisitRnSdk_targetSdkVersion=35
4
+ VisitRnSdk_compileSdkVersion=36
5
5
  VisitRnSdk_ndkversion=21.4.7075529
@@ -1,8 +1,14 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- xmlns:tools="http://schemas.android.com/tools"
3
- package="com.visitrnsdk">
2
+ package="com.visitrnsdk">
4
3
 
5
- <uses-permission
6
- android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"
7
- tools:node="remove" />
4
+ <uses-permission android:name="android.permission.CAMERA" />
5
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
6
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
7
+
8
+ <uses-feature
9
+ android:name="android.hardware.camera"
10
+ android:required="false" />
11
+ <uses-feature
12
+ android:name="android.hardware.camera.front"
13
+ android:required="false" />
8
14
  </manifest>
@@ -1,7 +1,13 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- xmlns:tools="http://schemas.android.com/tools">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
 
4
- <uses-permission
5
- android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"
6
- tools:node="remove" />
3
+ <uses-permission android:name="android.permission.CAMERA" />
4
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
5
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
6
+
7
+ <uses-feature
8
+ android:name="android.hardware.camera"
9
+ android:required="false" />
10
+ <uses-feature
11
+ android:name="android.hardware.camera.front"
12
+ android:required="false" />
7
13
  </manifest>