react-native-visit-rn-sdk 6.0.4 → 7.1.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/README.md +297 -191
- package/android/build.gradle +4 -1
- package/android/gradle.properties +4 -4
- package/android/src/main/AndroidManifest.xml +11 -5
- package/android/src/main/AndroidManifestNew.xml +11 -5
- package/android/src/main/java/com/visitrnsdk/VisitFitnessModule.kt +642 -0
- package/android/src/main/java/com/visitrnsdk/VisitRnSdkPackage.kt +1 -1
- package/android/src/main/java/com/visitrnsdk/VisitSessionStorage.kt +50 -0
- package/ios/VisitRnSdkViewManager.h +23 -1
- package/ios/VisitRnSdkViewManager.m +1259 -8
- package/lib/commonjs/index.android.js +328 -205
- package/lib/commonjs/index.android.js.map +1 -1
- package/lib/commonjs/index.ios.js +159 -116
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/module/index.android.js +328 -206
- package/lib/module/index.android.js.map +1 -1
- package/lib/module/index.ios.js +161 -117
- package/lib/module/index.ios.js.map +1 -1
- package/lib/typescript/index.android.d.ts +8 -3
- package/lib/typescript/index.android.d.ts.map +1 -1
- package/lib/typescript/index.ios.d.ts +6 -3
- package/lib/typescript/index.ios.d.ts.map +1 -1
- package/package.json +18 -26
- package/react-native-visit-rn-sdk.podspec +2 -1
- package/src/index.android.js +579 -0
- package/src/index.ios.js +284 -0
- package/android/src/main/java/com/visitrnsdk/VisitRnSdkLocationModule.kt +0 -37
- package/lib/commonjs/assets/video-call/connecting-lottie.gif +0 -0
- package/lib/commonjs/assets/video-call/end-call.png +0 -0
- package/lib/commonjs/assets/video-call/mic-off.png +0 -0
- package/lib/commonjs/assets/video-call/reconnecting.gif +0 -0
- package/lib/commonjs/assets/video-call/switch-camera.png +0 -0
- package/lib/commonjs/assets/video-call/toggle-down.png +0 -0
- package/lib/commonjs/assets/video-call/toggle-up.png +0 -0
- package/lib/commonjs/assets/video-call/video-off.png +0 -0
- package/lib/commonjs/components/VideoCallComponent.js +0 -1088
- package/lib/commonjs/components/VideoCallComponent.js.map +0 -1
- package/lib/commonjs/index.js +0 -6
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/shims.d.js +0 -2
- package/lib/commonjs/shims.d.js.map +0 -1
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/assets/video-call/connecting-lottie.gif +0 -0
- package/lib/module/assets/video-call/end-call.png +0 -0
- package/lib/module/assets/video-call/mic-off.png +0 -0
- package/lib/module/assets/video-call/reconnecting.gif +0 -0
- package/lib/module/assets/video-call/switch-camera.png +0 -0
- package/lib/module/assets/video-call/toggle-down.png +0 -0
- package/lib/module/assets/video-call/toggle-up.png +0 -0
- package/lib/module/assets/video-call/video-off.png +0 -0
- package/lib/module/components/VideoCallComponent.js +0 -1081
- package/lib/module/components/VideoCallComponent.js.map +0 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +0 -1
- package/lib/module/shims.d.js +0 -2
- package/lib/module/shims.d.js.map +0 -1
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/components/VideoCallComponent.d.ts +0 -79
- package/lib/typescript/components/VideoCallComponent.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -17
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/types.d.ts +0 -24
- package/lib/typescript/types.d.ts.map +0 -1
- package/src/assets/video-call/connecting-lottie.gif +0 -0
- package/src/assets/video-call/end-call.png +0 -0
- package/src/assets/video-call/mic-off.png +0 -0
- package/src/assets/video-call/reconnecting.gif +0 -0
- package/src/assets/video-call/switch-camera.png +0 -0
- package/src/assets/video-call/toggle-down.png +0 -0
- package/src/assets/video-call/toggle-up.png +0 -0
- package/src/assets/video-call/video-off.png +0 -0
- package/src/components/VideoCallComponent.tsx +0 -1484
- package/src/index.android.tsx +0 -459
- package/src/index.ios.tsx +0 -238
- package/src/index.tsx +0 -25
- package/src/shims.d.ts +0 -49
- package/src/types.ts +0 -25
package/README.md
CHANGED
|
@@ -1,249 +1,355 @@
|
|
|
1
|
-
|
|
1
|
+
## PMLI SDK `7.1.0`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
between the PWA and its host app.
|
|
3
|
+
Install the release with `npm install react-native-visit-rn-sdk@7.1.0`.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
When upgrading from `7.0.0`, rename the `magicLink` prop to `ssoURL` and pass the
|
|
6
|
+
SSO URL issued for the current session. Remove the legacy URL-generation props.
|
|
7
|
+
Remove `react-native-device-info` from the host app if the Visit SDK was its only consumer.
|
|
7
8
|
|
|
8
|
-
|
|
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
|
|
10
|
-
```
|
|
9
|
+
### **Instructions for configuring your Android Project**
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
`react-native-
|
|
14
|
-
|
|
11
|
+
* Install the host app dependencies used by the Visit SDK.
|
|
12
|
+
`npm install https://github.com/sashko9807/react-native-location-enabler`
|
|
13
|
+
`npm install react-native-event-listeners`
|
|
14
|
+
`npm install react-native-webview`
|
|
15
|
+
* Add `https://jitpack.io` to the host app’s Gradle repositories for `com.github.VisitApp:AndroidSDK`.
|
|
16
|
+
* Enable code desugaring in your app, or there add the dependency.
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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.
|
|
18
|
+
```
|
|
19
|
+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
|
|
20
|
+
```
|
|
22
21
|
|
|
23
|
-
|
|
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:
|
|
22
|
+
* Inside the `:app` `build.gradle` android block specify these.
|
|
27
23
|
|
|
28
|
-
```sh
|
|
29
|
-
npx pod-install
|
|
30
24
|
```
|
|
31
25
|
|
|
32
|
-
|
|
26
|
+
android {
|
|
27
|
+
compileOptions {
|
|
28
|
+
coreLibraryDesugaringEnabled true
|
|
29
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
30
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
import { useRef } from 'react';
|
|
36
|
-
import VisitRnSdkView, {
|
|
37
|
-
type VisitRnSdkViewHandle,
|
|
38
|
-
type VisitRnSdkViewProps,
|
|
39
|
-
} from 'react-native-visit-rn-sdk';
|
|
35
|
+
* In the `AndroidManifest.xml` file, add the metadata tag to serve the privacy manifest URL
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
```
|
|
38
|
+
<meta-data
|
|
39
|
+
android:name="visit_android_sdk.health_connect_privacy_policy_url"
|
|
40
|
+
android:value="https://www.google.com" />
|
|
41
|
+
```
|
|
42
|
+
* Version Requirement:
|
|
43
|
+
AGP: `8.13.2` or higher
|
|
44
|
+
Kotlin: `1.9.25`or higher
|
|
45
|
+
`compileSdkVersion`: 36 or higher
|
|
42
46
|
|
|
43
|
-
|
|
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
|
-
};
|
|
47
|
+
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
### **Instructions for configuring Plugin in iOS project**
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
```
|
|
51
|
+
* Run `npx pod-install` after installing the SDK.
|
|
52
|
+
* Install pods(for M1 processors running build on `x86_64` hardware)
|
|
58
53
|
|
|
59
|
-
`
|
|
54
|
+
`arch -x86_64 pod install`
|
|
60
55
|
|
|
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.
|
|
64
56
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
payloads.
|
|
57
|
+
* In the Signing & Capabilities section in Xcode, add HealthKit as a capability
|
|
58
|
+
* 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.
|
|
68
59
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
external host UI so the SDK ref remains available.
|
|
60
|
+
```
|
|
61
|
+
<key>NSHealthShareUsageDescription</key>
|
|
62
|
+
<string>Visit requires your permission to read health and fitness data.</string>
|
|
63
|
+
```
|
|
74
64
|
|
|
75
|
-
|
|
65
|
+
## SDK usage
|
|
66
|
+
|
|
67
|
+
The SDK accepts `ssoURL`, a required string containing the SSO URL supplied
|
|
68
|
+
at runtime, and `isLoggingEnabled`, an optional boolean that defaults to `false`.
|
|
69
|
+
The component renders without a WebView until it receives a nonblank URL.
|
|
70
|
+
Install `react-native-event-listeners` and `react-native-webview` for both
|
|
71
|
+
platforms and `react-native-location-enabler` for Android. The Android and iOS
|
|
72
|
+
native setup above still applies.
|
|
73
|
+
|
|
74
|
+
```jsx
|
|
75
|
+
import React from 'react';
|
|
76
|
+
import VisitRnSdkView from 'react-native-visit-rn-sdk';
|
|
77
|
+
import {View} from 'react-native';
|
|
78
|
+
|
|
79
|
+
export default function VisitScreen({sessionSsoUrl}) {
|
|
80
|
+
return (
|
|
81
|
+
<View style={{flex: 1}}>
|
|
82
|
+
<VisitRnSdkView
|
|
83
|
+
ssoURL={sessionSsoUrl}
|
|
84
|
+
isLoggingEnabled={false}
|
|
85
|
+
/>
|
|
86
|
+
</View>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
76
90
|
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
See the [example app](example/App.js) for connection status and manual sync usage.
|
|
92
|
+
|
|
93
|
+
## **Example App SDK Initialization and Manual Step Sync**
|
|
94
|
+
|
|
95
|
+
The example app separates health SDK setup, WebView-driven sync setup, and the
|
|
96
|
+
sync request itself. On the first eligible `Home` focus, it automatically
|
|
97
|
+
checks the platform connection, fetches today's metrics, and starts manual
|
|
98
|
+
sync only if the step read succeeds. The button remains available for later
|
|
99
|
+
manual retries.
|
|
100
|
+
|
|
101
|
+
```mermaid
|
|
102
|
+
flowchart TD
|
|
103
|
+
A["App opens on Home"] --> B{"Platform"}
|
|
104
|
+
B -->|Android| C["Home useEffect calls<br/>VisitFitnessModule.initiateSDK(true)"]
|
|
105
|
+
C --> D["Native module creates the Health Connect utility,<br/>step-sync helper, and session storage"]
|
|
106
|
+
D --> E["Home focus checks Health Connect status"]
|
|
107
|
+
B -->|iOS| F["Home focus checks HealthKit status<br/>No explicit initiateSDK call"]
|
|
108
|
+
F --> G{"Health status"}
|
|
109
|
+
E --> G
|
|
110
|
+
G -->|CONNECTED| H["Fetch today's metrics"]
|
|
111
|
+
G -->|Any other status| I["Do not sync and keep<br/>Start Step Sync disabled"]
|
|
112
|
+
H --> Y{"Today step count fetched?"}
|
|
113
|
+
Y -->|No| Z["Show an error and do not sync"]
|
|
114
|
+
Y -->|Yes| AA{"First eligible Home focus?"}
|
|
115
|
+
AA -->|Yes| R["Start automatic manual sync"]
|
|
116
|
+
AA -->|No| Q["Refresh metrics and keep<br/>Start Step Sync available"]
|
|
117
|
+
|
|
118
|
+
A --> J["User selects Go to next page"]
|
|
119
|
+
J --> K["VisitPage mounts VisitRnSdkView"]
|
|
120
|
+
K --> L["Visit WebView loads the SSO URL"]
|
|
121
|
+
L --> M["PWA posts UPDATE_API_BASE_URL"]
|
|
122
|
+
M --> N["Native layer stores API credentials<br/>and daily/hourly timestamps"]
|
|
123
|
+
N --> O["Native layer attempts the initial sync<br/>when its platform preconditions pass"]
|
|
124
|
+
O --> P["User returns to Home"]
|
|
125
|
+
P --> G
|
|
126
|
+
|
|
127
|
+
Q --> AB["User selects Start Step Sync"]
|
|
128
|
+
AB --> R
|
|
129
|
+
R --> S{"Platform"}
|
|
130
|
+
S -->|Android| T["VisitFitnessModule.triggerManualSync()"]
|
|
131
|
+
S -->|iOS| U["VisitRnSdkViewManager.triggerManualSync()"]
|
|
132
|
+
T --> V["Validate state, collect hourly/daily steps,<br/>and send them to Visit"]
|
|
133
|
+
U --> V
|
|
134
|
+
V -->|Resolved| W["Show the success message"]
|
|
135
|
+
V -->|Rejected| X["Show the native error message"]
|
|
136
|
+
```
|
|
79
137
|
|
|
80
|
-
|
|
138
|
+
### **1. Home Mount and Health Status**
|
|
139
|
+
|
|
140
|
+
On Android, the `Home` component's mount effect calls
|
|
141
|
+
`NativeModules.VisitFitnessModule.initiateSDK(true)`. The native method uses
|
|
142
|
+
the current Activity to create `HealthConnectUtil`, `VisitStepSyncHelper`, and
|
|
143
|
+
`VisitSessionStorage`. `App.js` then immediately sets
|
|
144
|
+
`isAndroidSDKInitialized` to `true`; `initiateSDK` is a void bridge call, so
|
|
145
|
+
this React state does not confirm that native initialization succeeded. If
|
|
146
|
+
`currentActivity` is `null`, the native method skips initialization. Mounting
|
|
147
|
+
`VisitRnSdkView` on Android calls `initiateSDK` again, which gives the SDK
|
|
148
|
+
another opportunity to initialize with an available Activity.
|
|
149
|
+
|
|
150
|
+
Once the Android React flag is true and `Home` is focused,
|
|
151
|
+
`runHealthStatusFlow()` calls `getHealthConnectStatus()`. On iOS, there is no
|
|
152
|
+
equivalent `initiateSDK` call in `App.js`; each `Home` focus calls
|
|
153
|
+
`VisitRnSdkViewManager.getHealthKitConnectStatus()` directly.
|
|
154
|
+
|
|
155
|
+
For either platform, a `CONNECTED` result triggers
|
|
156
|
+
`fetchTodayHealthMetrics()`, which requests today's steps, sleep minutes, and
|
|
157
|
+
calories from the platform-native module. The helper reports whether the step
|
|
158
|
+
request succeeded. On the first eligible `Home` focus, a successful step read
|
|
159
|
+
continues directly into manual sync; a failed step read shows an error and
|
|
160
|
+
blocks that automatic attempt. Other connection states do not fetch metrics or
|
|
161
|
+
start sync.
|
|
162
|
+
|
|
163
|
+
An in-memory ref records the first automatic attempt. Later `Home` focuses
|
|
164
|
+
refresh connection status and metrics but do not automatically sync again
|
|
165
|
+
during the same component lifetime.
|
|
166
|
+
|
|
167
|
+
### **2. WebView Setup and Initial Sync**
|
|
168
|
+
|
|
169
|
+
Selecting **Go to next page** navigates to `VisitPage` and mounts
|
|
170
|
+
`VisitRnSdkView` with the entered SSO URL. After the Visit PWA loads, it must
|
|
171
|
+
post an `UPDATE_API_BASE_URL` message containing `apiBaseUrl`, `authtoken`,
|
|
172
|
+
`googleFitLastSync`, and `gfHourlyLastSync`.
|
|
173
|
+
|
|
174
|
+
The SDK handles that message as follows:
|
|
175
|
+
|
|
176
|
+
* Android calls `VisitFitnessModule.updateApiBaseUrl()`, which stores the
|
|
177
|
+
values in `VisitSessionStorage` and starts the initial sync once per native
|
|
178
|
+
module lifecycle, unless a sync is already running. A failed initial sync
|
|
179
|
+
can be attempted again when the values are updated later.
|
|
180
|
+
* iOS calls `VisitRnSdkViewManager.updateApiUrl()` once per mounted
|
|
181
|
+
`VisitRnSdkView`, stores the available non-empty credentials and positive
|
|
182
|
+
timestamps in `NSUserDefaults`, and attempts the initial sync when HealthKit
|
|
183
|
+
is available, credentials are present, permission is available, and no
|
|
184
|
+
other sync is running.
|
|
185
|
+
|
|
186
|
+
The initial sync and the manual sync share the same native in-progress guard.
|
|
187
|
+
Returning to `Home` while the initial sync is still running can therefore make
|
|
188
|
+
an explicit button attempt reject with `SYNC_IN_PROGRESS`.
|
|
189
|
+
|
|
190
|
+
> **Ordering requirement:** `CONNECTED` only represents Health Connect or
|
|
191
|
+
> HealthKit access. It does not mean that the Visit API credentials and sync
|
|
192
|
+
> timestamps are ready. On a fresh install or after clearing app data, mount
|
|
193
|
+
> `VisitRnSdkView` and allow it to process `UPDATE_API_BASE_URL` before either
|
|
194
|
+
> automatic or button-driven sync. Otherwise, sync can reject with
|
|
195
|
+
> `MISSING_SYNC_CREDENTIALS` or `MISSING_SYNC_TIMESTAMPS` even though health
|
|
196
|
+
> access is connected. The automatic attempt runs only once per `Home` mount,
|
|
197
|
+
> so after visiting `VisitPage`, use **Start Step Sync** to retry.
|
|
198
|
+
|
|
199
|
+
### **3. Automatic and Button-Driven Step Sync**
|
|
200
|
+
|
|
201
|
+
The first eligible `Home` focus uses a shared in-flight lock while it checks
|
|
202
|
+
the connection and fetches today's metrics. This disables **Start Step Sync**
|
|
203
|
+
during preparation and prevents the button from overlapping the automatic
|
|
204
|
+
request. A successful step read calls the shared native sync executor.
|
|
205
|
+
|
|
206
|
+
The button remains enabled when the health connection status is `CONNECTED`
|
|
207
|
+
and no sync flow is running. Automatic and button-driven requests both:
|
|
208
|
+
|
|
209
|
+
1. Set `syncStatus` to `syncing` and show **Syncing in progress...**.
|
|
210
|
+
2. Call `VisitFitnessModule.triggerManualSync()` on Android or
|
|
211
|
+
`VisitRnSdkViewManager.triggerManualSync()` on iOS.
|
|
212
|
+
3. Let the native module validate its prerequisites and then collect and
|
|
213
|
+
upload the hourly and daily step data using the stored timestamps,
|
|
214
|
+
credentials, and Visit endpoints.
|
|
215
|
+
4. On resolution, set the status to `success` and show **Syncing has been
|
|
216
|
+
done successfully**. On rejection, set the status to `error` and show
|
|
217
|
+
the native error message.
|
|
218
|
+
|
|
219
|
+
The resolved native status string is written to the console, but the example
|
|
220
|
+
shows its own fixed success message. A completed manual sync also does not
|
|
221
|
+
automatically reload the three metric cards; those are refreshed the next
|
|
222
|
+
time the focused-screen status flow calls `fetchTodayHealthMetrics()`.
|
|
223
|
+
|
|
224
|
+
### **Manual Sync Preflight and Failures**
|
|
225
|
+
|
|
226
|
+
| Platform | Code | When it occurs |
|
|
227
|
+
| --- | --- | --- |
|
|
228
|
+
| Android | `SDK_NOT_INITIALIZED` | Session storage, the Health Connect utility, or the step-sync helper was not initialized. |
|
|
229
|
+
| iOS | `HEALTH_DATA_UNAVAILABLE` | HealthKit is unavailable on the device. |
|
|
230
|
+
| Both | `SYNC_IN_PROGRESS` | The initial WebView-driven sync or another manual sync is still running. |
|
|
231
|
+
| Both | `MISSING_SYNC_CREDENTIALS` | The WebView has not stored a non-empty Visit API base URL and auth token. |
|
|
232
|
+
| Android | `MISSING_SYNC_TIMESTAMPS` | Either the stored daily or hourly timestamp is negative. |
|
|
233
|
+
| iOS | `MISSING_SYNC_TIMESTAMPS` | Both stored timestamps are zero or missing. |
|
|
234
|
+
| iOS | `PERMISSION_DENIED` | HealthKit access is not available when the manual sync starts. |
|
|
235
|
+
| Both | `SYNC_FAILED` | The native sync pipeline reports a failure; on iOS this contains the first network or non-2xx Visit response. |
|
|
236
|
+
|
|
237
|
+
After the preflight passes, Android delegates the hourly and daily work to
|
|
238
|
+
`VisitStepSyncHelper`. iOS runs both flows through its shared sync executor.
|
|
239
|
+
The iOS executor posts hourly batches to `/users/embellish-sync` and daily
|
|
240
|
+
data to `/users/data-sync`; the manual promise resolves only after both flows
|
|
241
|
+
finish.
|
|
242
|
+
|
|
243
|
+
## Fitness data and Health Connect connection
|
|
244
|
+
|
|
245
|
+
The SDK reads steps, calories, distance, and sleep from Health Connect on Android
|
|
246
|
+
and HealthKit on iOS. Android also reads exercise duration for activity totals.
|
|
247
|
+
Health Connect history access is optional. The iOS host app needs the HealthKit
|
|
248
|
+
capability and an `NSHealthShareUsageDescription` that explains the four metrics.
|
|
249
|
+
|
|
250
|
+
For Android, declare steps, distance, total calories, sleep, exercise, and optional
|
|
251
|
+
history access in the host app's Google Play Health Apps form. Use the merged
|
|
252
|
+
manifest to verify the permission list. See [Google Play's Health Connect publishing guide](https://developer.android.com/health-and-fitness/health-connect/publish).
|
|
253
|
+
|
|
254
|
+
To start the Android connection flow, send:
|
|
255
|
+
|
|
256
|
+
```javascript
|
|
81
257
|
window.ReactNativeWebView.postMessage(
|
|
82
|
-
JSON.stringify({
|
|
83
|
-
method: 'sendEventToHost',
|
|
84
|
-
eventName: 'INITIATE_PAYMENT',
|
|
85
|
-
orderId: '<order-id>',
|
|
86
|
-
})
|
|
258
|
+
JSON.stringify({ method: 'CONNECT_TO_GOOGLE_FIT' })
|
|
87
259
|
);
|
|
88
260
|
```
|
|
89
261
|
|
|
90
|
-
The SDK
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
```
|
|
262
|
+
The native SDK requests Health Connect permissions or opens its Play Store page
|
|
263
|
+
if installation or an update is required. Send the same message again after
|
|
264
|
+
returning from the store. The PWA can request the current state with
|
|
265
|
+
`GET_HEALTH_CONNECT_STATUS`. The native bridge reports `NOT_SUPPORTED`,
|
|
266
|
+
`NOT_INSTALLED`, `INSTALLED`, or `CONNECTED`.
|
|
113
267
|
|
|
114
|
-
|
|
268
|
+
Both platforms accept `GET_DATA_TO_GENERATE_GRAPH` for steps, calories, and
|
|
269
|
+
distance by day, week, and month, and for sleep by day and week. The SDK
|
|
270
|
+
delivers the existing `DetailedGraph` callbacks and supplies steps and sleep
|
|
271
|
+
minutes to `updateFitnessPermissions` on connection.
|
|
115
272
|
|
|
116
|
-
|
|
117
|
-
into the Visit PWA. For example, after the client app finishes the payment
|
|
118
|
-
flow:
|
|
273
|
+
### **7.1.0**
|
|
119
274
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
status: 'success',
|
|
123
|
-
});
|
|
124
|
-
```
|
|
275
|
+
* Accept the host app's SSO URL through the `ssoURL` prop and default `isLoggingEnabled` to `false`.
|
|
276
|
+
* Remove the legacy SSO-generation props and the DeviceInfo and Axios dependencies.
|
|
125
277
|
|
|
126
|
-
|
|
127
|
-
Visit PWA. The Visit PWA must define that function:
|
|
278
|
+
### **7.0.0**
|
|
128
279
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// Continue the Visit flow using properties.status.
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
```
|
|
280
|
+
* Restore steps, calories, distance, and sleep on Android and iOS.
|
|
281
|
+
* Use AndroidSDK `v7.0.0` and start the native Health Connect permission flow directly.
|
|
282
|
+
* Remove the Android PWA disclaimer callback.
|
|
136
283
|
|
|
137
|
-
|
|
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.
|
|
284
|
+
### **3.0.15**
|
|
144
285
|
|
|
145
|
-
|
|
286
|
+
* Detect when iOS step-read access is unavailable after the HealthKit authorization sheet has already been answered.
|
|
287
|
+
* Show recovery instructions when HealthKit access is denied and offer to open the Health settings page.
|
|
288
|
+
* Refresh the PWA's HealthKit permission state when the iOS app returns to the foreground.
|
|
146
289
|
|
|
147
|
-
|
|
148
|
-
location permissions:
|
|
290
|
+
### **3.0.14**
|
|
149
291
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
```
|
|
292
|
+
* Request read-only HealthKit access for step data on iOS without requesting write permission.
|
|
293
|
+
* Determine HealthKit connection status without writing and deleting a probe step sample.
|
|
294
|
+
* Keep the existing JavaScript APIs and callback signatures unchanged.
|
|
154
295
|
|
|
155
|
-
|
|
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.
|
|
296
|
+
### **3.0.13**
|
|
160
297
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
open the phone's Location settings. When the user returns, the SDK rechecks
|
|
164
|
-
both states and calls the existing web callback:
|
|
298
|
+
* Add iOS compatibility methods for `getTodaySleepMinutes()` and `getTodayCalorieCount()` that resolve to `0`.
|
|
299
|
+
* Keep the existing JavaScript APIs and callback signatures unchanged.
|
|
165
300
|
|
|
166
|
-
|
|
167
|
-
window.checkTheGpsPermission(true); // Fine location and Location Services enabled
|
|
168
|
-
window.checkTheGpsPermission(false); // Either requirement is unavailable
|
|
169
|
-
```
|
|
170
|
-
|
|
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.
|
|
301
|
+
### **3.0.12**
|
|
176
302
|
|
|
177
|
-
|
|
303
|
+
* 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.
|
|
178
304
|
|
|
179
|
-
|
|
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.
|
|
305
|
+
### **3.0.11**
|
|
183
306
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
`unauthorized-wellness-access` listener has been removed. WebView errors are
|
|
188
|
-
logged only when `isLoggingEnabled={true}`.
|
|
307
|
+
* Upgrade AndroidSDK to `v3.13`.
|
|
308
|
+
* Reconcile hourly step buckets with Health Connect's exact daily aggregate so the graph total matches the daily total despite hourly fractional-step truncation.
|
|
309
|
+
* Keep the existing React Native APIs and PWA callback signatures unchanged.
|
|
189
310
|
|
|
190
|
-
|
|
311
|
+
### **3.0.10**
|
|
191
312
|
|
|
192
|
-
|
|
193
|
-
|
|
313
|
+
* Upgrade AndroidSDK to `v3.12`.
|
|
314
|
+
* 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.
|
|
194
315
|
|
|
195
|
-
|
|
316
|
+
### **3.0.9**
|
|
196
317
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
318
|
+
* Check Health Connect installation status before native step capability.
|
|
319
|
+
* Route `NOT_INSTALLED` directly to the native install/permission flow instead of the PWA disclaimer.
|
|
320
|
+
* Route Health Connect status-check failures to the permission flow.
|
|
321
|
+
* Keep capability-check failures on the PWA disclaimer fallback.
|
|
201
322
|
|
|
202
|
-
|
|
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`.
|
|
323
|
+
### **3.0.8**
|
|
206
324
|
|
|
207
|
-
|
|
325
|
+
* Remove duplicate-request suppression so the PWA can restart the flow after the user returns from the Health Connect Play Store page.
|
|
208
326
|
|
|
209
|
-
|
|
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.
|
|
327
|
+
### **3.0.7**
|
|
213
328
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
329
|
+
* Add Android native step-tracking capability detection through AndroidSDK `v3.11`.
|
|
330
|
+
* Add the `window.showHealthConnectDisclaimer()` PWA callback and strict `disclaimerAccepted: true` continuation contract.
|
|
331
|
+
* Add Health Connect routing logs for supported, unsupported, and failed capability checks.
|
|
217
332
|
|
|
218
|
-
|
|
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
|
-
```
|
|
333
|
+
### **Sample Project**
|
|
223
334
|
|
|
224
|
-
The
|
|
225
|
-
`
|
|
335
|
+
The [example app](example) uses React Native `0.86.2` and links the SDK from this
|
|
336
|
+
checkout. In the `example` directory, run `npm ci`, then start Metro with
|
|
337
|
+
`npm start`. For Android, run `npm run android` in another terminal. For iOS, run
|
|
338
|
+
`npx pod-install` and then `npm run ios`. Enter an SSO URL in the running example.
|
|
226
339
|
|
|
227
|
-
|
|
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
|
-
```
|
|
340
|
+
**Permission Usage Declaration:**
|
|
233
341
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
342
|
+
1\. For android, Google needs the declaration of how you are using the Health Data in your organisation privacy policy webpage.
|
|
343
|
+
Description for this is present inside this document along with the permission that needs to be added in the Google Play Console
|
|
344
|
+
<custom data-type="smartlink" data-id="id-0">https://docs.google.com/document/d/1QKtC9ofRtrLIroBzW0pG7BrdrpG_KorHbM5Y0zcgGQI/edit?usp=sharing</custom>
|
|
345
|
+
|
|
238
346
|
|
|
239
|
-
|
|
347
|
+
2. For iOS, Health and Fitness permission needs to be added in the App Store Connect Dashboard.
|
|
240
348
|
|
|
241
|
-
|
|
349
|
+

|
|
242
350
|
|
|
243
|
-
|
|
351
|
+
|
|
244
352
|
|
|
245
|
-
MIT
|
|
246
353
|
|
|
247
|
-
---
|
|
248
354
|
|
|
249
|
-
|
|
355
|
+
|
package/android/build.gradle
CHANGED
|
@@ -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 "
|
|
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.
|
|
2
|
-
VisitRnSdk_minSdkVersion=
|
|
3
|
-
VisitRnSdk_targetSdkVersion=
|
|
4
|
-
VisitRnSdk_compileSdkVersion=
|
|
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
|
-
|
|
3
|
-
package="com.visitrnsdk">
|
|
2
|
+
package="com.visitrnsdk">
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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>
|