react-native-visit-rn-sdk 3.0.5 → 3.0.6
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 +91 -16
- package/ios/VisitRnSdkViewManager.h +6 -1
- package/ios/VisitRnSdkViewManager.m +760 -136
- package/lib/commonjs/index.ios.js +26 -40
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/module/index.ios.js +29 -43
- package/lib/module/index.ios.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ios.js +40 -58
package/README.md
CHANGED
|
@@ -1,31 +1,106 @@
|
|
|
1
|
-
|
|
1
|
+
### **Instructions for configuring your Android Project**
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
* Install Visit React Native Plugin
|
|
4
|
+
`npm install react-native-visit-rn-sdk@3.0.6`
|
|
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
|
+
* Enable code desugaring in your app, or there add the dependency.
|
|
4
11
|
|
|
5
|
-
|
|
12
|
+
```
|
|
13
|
+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
* Inside the `:app` `build.gradle` android block specify these.
|
|
6
17
|
|
|
7
|
-
```sh
|
|
8
|
-
npm install react-native-visit-rn-sdk
|
|
9
18
|
```
|
|
10
19
|
|
|
11
|
-
|
|
20
|
+
android {
|
|
21
|
+
compileOptions {
|
|
22
|
+
coreLibraryDesugaringEnabled true
|
|
23
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
24
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
* In the `AndroidManifest.xml` file, add the metadata tag to serve the privacy manifest URL
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
<meta-data
|
|
33
|
+
android:name="visit_android_sdk.health_connect_privacy_policy_url"
|
|
34
|
+
android:value="https://www.google.com" />
|
|
35
|
+
```
|
|
36
|
+
* Version Requirement:
|
|
37
|
+
AGP: `8.13.2` or higher
|
|
38
|
+
Kotlin: `1.9.25`or higher
|
|
39
|
+
`compileSdkVersion`: 36 or higher
|
|
12
40
|
|
|
13
|
-
|
|
14
|
-
import VisitRnSdkView from "react-native-visit-rn-sdk";
|
|
41
|
+
|
|
15
42
|
|
|
16
|
-
|
|
43
|
+
### **Instructions for configuring Plugin in iOS project**
|
|
17
44
|
|
|
18
|
-
|
|
45
|
+
* Add the plugin `npm install react-native-visit-rn-sdk@3.0.6 && npx pod-install`
|
|
46
|
+
* Install pods(for M1 processors running build on `x86_64` hardware)
|
|
47
|
+
|
|
48
|
+
`arch -x86_64 pod install`
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
* In the Signing & Capabilities section in Xcode, add HealthKit as a capability
|
|
52
|
+
* Add these keys inside `info.plist` file
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
<key>NSHealthShareUsageDescription</key>
|
|
56
|
+
<string>Visit requires your permission to read health and fitness data.</string>
|
|
57
|
+
<key>NSHealthUpdateUsageDescription</key>
|
|
58
|
+
<string>Visit requires your permission to store health and fitness data in HealthKit.</string>
|
|
19
59
|
```
|
|
20
60
|
|
|
21
|
-
|
|
61
|
+
# **Usage**
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
import React from 'react';
|
|
65
|
+
import VisitRnSdkView from 'react-native-visit-rn-sdk';
|
|
66
|
+
import {EventRegister} from 'react-native-event-listeners';
|
|
67
|
+
import {SafeAreaView, Alert} from 'react-native';
|
|
68
|
+
|
|
69
|
+
function App() {
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<SafeAreaView style={{flex: 1}}>
|
|
73
|
+
<VisitRnSdkView
|
|
74
|
+
magicLink={<Enter the sso link here>}
|
|
75
|
+
isLoggingEnabled={true}
|
|
76
|
+
}
|
|
77
|
+
/>
|
|
78
|
+
</SafeAreaView>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default App;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
To see the full usage code for getting Health Connect/Health Kit connection status and retriving step data, refer [here](https://github.com/VisitApp/Visit-ReactNative/blob/master/example/App.js).
|
|
86
|
+
|
|
87
|
+
### **Sample Project**
|
|
88
|
+
|
|
89
|
+
Please use the below project which demonstrates how to use the SDK. `https://github.com/VisitApp/Visit-ReactNative/tree/mchi-rn-sdk-3x/example`
|
|
90
|
+
|
|
91
|
+
**Permission Usage Declaration:**
|
|
92
|
+
|
|
93
|
+
1\. For android, Google needs the declaration of how you are using the Health Data in your organisation privacy policy webpage.
|
|
94
|
+
Description for this is present inside this document along with the permission that needs to be added in the Google Play Console
|
|
95
|
+
<custom data-type="smartlink" data-id="id-0">https://docs.google.com/document/d/1QKtC9ofRtrLIroBzW0pG7BrdrpG_KorHbM5Y0zcgGQI/edit?usp=sharing</custom>
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
2. For iOS, Health and Fitness permission needs to be added in the App Store Connect Dashboard.
|
|
22
99
|
|
|
23
|
-
|
|
100
|
+

|
|
24
101
|
|
|
25
|
-
|
|
102
|
+
|
|
26
103
|
|
|
27
|
-
MIT
|
|
28
104
|
|
|
29
|
-
---
|
|
30
105
|
|
|
31
|
-
|
|
106
|
+
|
|
@@ -14,9 +14,14 @@
|
|
|
14
14
|
- (void)renderGraph:(NSDictionary *)input callback:(RCTResponseSenderBlock)callback;
|
|
15
15
|
- (void)updateApiUrl:(NSDictionary *)input;
|
|
16
16
|
- (void)connectToAppleHealth:(RCTResponseSenderBlock)callback;
|
|
17
|
+
- (void)openAppleHealthApp:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
|
|
17
18
|
- (void)fetchHourlyData:(NSInteger)gfHourlyLastSync resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
|
|
18
19
|
- (void)fetchDailyData:(NSInteger)googleFitLastSync resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
|
|
19
20
|
- (void)getHealthKitStatus:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
|
|
20
|
-
- (void)
|
|
21
|
+
- (void)requestHealthKitAuthorization:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
|
|
22
|
+
- (void)getTodayStepCount:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
|
|
23
|
+
- (void)getTodaySleepMinutes:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
|
|
24
|
+
- (void)getTodayCalorieCount:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
|
|
25
|
+
- (void)triggerManualSync:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
|
|
21
26
|
|
|
22
27
|
@end
|