@tryvital/vital-health-react-native 0.1.1 → 0.2.2
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/ios/VitalHealthKitConfiguration.h +7 -0
- package/ios/VitalHealthKitConfiguration.m +12 -0
- package/ios/VitalHealthReactNative-Bridging-Header.h +1 -0
- package/ios/VitalHealthReactNative.m +3 -1
- package/ios/VitalHealthReactNative.swift +48 -3
- package/lib/index.js +44 -0
- package/package.json +10 -26
- package/src/index.tsx +27 -23
- package/vital-health-react-native.podspec +1 -1
- package/.editorconfig +0 -15
- package/.gitattributes +0 -3
- package/.gitignore +0 -70
- package/.watchmanconfig +0 -1
- package/.yarnrc +0 -3
- package/babel.config.js +0 -3
- package/lefthook.yml +0 -16
- package/lib/commonjs/index.js +0 -50
- package/lib/commonjs/index.js.map +0 -1
- package/lib/module/index.js +0 -42
- package/lib/module/index.js.map +0 -1
- package/lib/typescript/__tests__/index.test.d.ts +0 -1
- package/lib/typescript/__tests__/index.test.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -21
- package/lib/typescript/index.d.ts.map +0 -1
- package/scripts/bootstrap.js +0 -29
- package/src/__tests__/index.test.tsx +0 -1
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -28
- package/yarn.lock +0 -9658
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#import "VitalHealthKitConfiguration.h"
|
|
2
|
+
#import <React/RCTBridgeModule.h>
|
|
3
|
+
|
|
4
|
+
@import VitalHealthKit;
|
|
5
|
+
|
|
6
|
+
@implementation VitalHealthKitConfiguration
|
|
7
|
+
|
|
8
|
+
+ (void)configureWithBackgroundDeliveryEnabled:(BOOL)backgroundDeliveryEnabled numberOfDaysToBackFill:(int)numberOfDaysToBackFill enableLogs:(BOOL)enableLogs {
|
|
9
|
+
[VitalHealthKitClient configureWithBackgroundDeliveryEnabled:backgroundDeliveryEnabled numberOfDaysToBackFill:numberOfDaysToBackFill logsEnabled:enableLogs];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#import <React/RCTBridgeModule.h>
|
|
2
|
-
|
|
2
|
+
#import <React/RCTEventEmitter.h>
|
|
3
3
|
@interface RCT_EXTERN_MODULE(VitalHealthReactNative, NSObject)
|
|
4
4
|
|
|
5
5
|
RCT_EXTERN_METHOD(configure:(BOOL)backgroundDeliveryEnabled
|
|
@@ -23,6 +23,8 @@ RCT_EXTERN_METHOD(syncData:(NSArray<NSString *> *)resources
|
|
|
23
23
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
24
24
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
25
25
|
|
|
26
|
+
RCT_EXTERN_METHOD(status)
|
|
27
|
+
|
|
26
28
|
+ (BOOL)requiresMainQueueSetup
|
|
27
29
|
{
|
|
28
30
|
return NO;
|
|
@@ -1,8 +1,53 @@
|
|
|
1
1
|
import VitalCore
|
|
2
2
|
import VitalHealthKit
|
|
3
|
+
import Combine
|
|
3
4
|
|
|
4
5
|
@objc(VitalHealthReactNative)
|
|
5
|
-
class VitalHealthReactNative:
|
|
6
|
+
class VitalHealthReactNative: RCTEventEmitter {
|
|
7
|
+
|
|
8
|
+
public static var status: RCTEventEmitter!
|
|
9
|
+
public var cancellable: AnyCancellable?
|
|
10
|
+
|
|
11
|
+
deinit {
|
|
12
|
+
cancellable?.cancel()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override init() {
|
|
16
|
+
super.init()
|
|
17
|
+
VitalHealthReactNative.status = self
|
|
18
|
+
|
|
19
|
+
cancellable = VitalHealthKitClient.shared.status.sink { status in
|
|
20
|
+
var payload: [String: String] = [:]
|
|
21
|
+
|
|
22
|
+
switch status {
|
|
23
|
+
case let .failedSyncing(resource, error):
|
|
24
|
+
payload["resource"] = String(describing: resource)
|
|
25
|
+
payload["status"] = "failedSyncing"
|
|
26
|
+
payload["extra"] = error?.localizedDescription
|
|
27
|
+
|
|
28
|
+
case let .nothingToSync(resource):
|
|
29
|
+
payload["resource"] = String(describing: resource)
|
|
30
|
+
payload["status"] = "nothingToSync"
|
|
31
|
+
|
|
32
|
+
case let .successSyncing(resource, _):
|
|
33
|
+
payload["resource"] = String(describing: resource)
|
|
34
|
+
payload["status"] = "successSyncing"
|
|
35
|
+
|
|
36
|
+
case let .syncing(resource):
|
|
37
|
+
payload["resource"] = String(describing: resource)
|
|
38
|
+
payload["status"] = "syncing"
|
|
39
|
+
|
|
40
|
+
case .syncingCompleted:
|
|
41
|
+
payload["status"] = "completed"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
self.sendEvent(withName: "status", body: payload)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override func supportedEvents() -> [String]! {
|
|
49
|
+
return ["status"]
|
|
50
|
+
}
|
|
6
51
|
|
|
7
52
|
@objc(configure:numberOfDaysToBackFill:enableLogs:resolver:rejecter:)
|
|
8
53
|
func configure(
|
|
@@ -16,8 +61,8 @@ class VitalHealthReactNative: NSObject {
|
|
|
16
61
|
await VitalHealthKitClient.configure(
|
|
17
62
|
.init(
|
|
18
63
|
backgroundDeliveryEnabled: backgroundDeliveryEnabled,
|
|
19
|
-
|
|
20
|
-
|
|
64
|
+
numberOfDaysToBackFill: numberOfDaysToBackFill,
|
|
65
|
+
logsEnabled: enableLogs
|
|
21
66
|
)
|
|
22
67
|
)
|
|
23
68
|
resolve(())
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package 'vital-health-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
3
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
4
|
+
'- You rebuilt the app after installing the package\n' +
|
|
5
|
+
'- You are not using Expo Go\n';
|
|
6
|
+
const VitalHealthReactNative = NativeModules.VitalHealthReactNative
|
|
7
|
+
? NativeModules.VitalHealthReactNative
|
|
8
|
+
: new Proxy({}, {
|
|
9
|
+
get() {
|
|
10
|
+
throw new Error(LINKING_ERROR);
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export class VitalHealth {
|
|
14
|
+
static status = new NativeEventEmitter(VitalHealthReactNative);
|
|
15
|
+
static configure(backgroundDeliveryEnabled, numberOfDaysToBackFill, enableLogs) {
|
|
16
|
+
return VitalHealthReactNative.configure(backgroundDeliveryEnabled, numberOfDaysToBackFill, enableLogs);
|
|
17
|
+
}
|
|
18
|
+
static askForResources(resources) {
|
|
19
|
+
return VitalHealthReactNative.askForResources(resources);
|
|
20
|
+
}
|
|
21
|
+
static hasAskedForPermission(resource) {
|
|
22
|
+
return VitalHealthReactNative.hasAskedForPermission(resource);
|
|
23
|
+
}
|
|
24
|
+
static syncData(resources) {
|
|
25
|
+
return VitalHealthReactNative.syncData(resources);
|
|
26
|
+
}
|
|
27
|
+
static cleanUp() {
|
|
28
|
+
return VitalHealthReactNative.cleanUp();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export var VitalResource;
|
|
32
|
+
(function (VitalResource) {
|
|
33
|
+
VitalResource["Profile"] = "profile";
|
|
34
|
+
VitalResource["Body"] = "body";
|
|
35
|
+
VitalResource["Workout"] = "workout";
|
|
36
|
+
VitalResource["Activity"] = "activity";
|
|
37
|
+
VitalResource["Sleep"] = "sleep";
|
|
38
|
+
VitalResource["Glucose"] = "glucose";
|
|
39
|
+
VitalResource["BloodPressure"] = "bloodPressure";
|
|
40
|
+
VitalResource["HeartRate"] = "heartRate";
|
|
41
|
+
VitalResource["Steps"] = "steps";
|
|
42
|
+
VitalResource["ActiveEnergyBurned"] = "activeEnergyBurned";
|
|
43
|
+
VitalResource["BasalEnergyBurned"] = "basalEnergyBurned";
|
|
44
|
+
})(VitalResource || (VitalResource = {}));
|
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvital/vital-health-react-native",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "lib/
|
|
6
|
-
"
|
|
7
|
-
"types": "lib/typescript/index.d.ts",
|
|
8
|
-
"react-native": "src/index",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "Client to access iOS's HealthKit and Android HealthConnect",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
9
7
|
"source": "src/index",
|
|
10
8
|
"files": [
|
|
11
9
|
"src",
|
|
@@ -28,25 +26,25 @@
|
|
|
28
26
|
],
|
|
29
27
|
"scripts": {
|
|
30
28
|
"test": "jest",
|
|
31
|
-
"typescript": "tsc --
|
|
29
|
+
"typescript": "tsc --declaration",
|
|
32
30
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
|
-
"prepare": "bob build",
|
|
34
31
|
"release": "release-it",
|
|
35
32
|
"example": "yarn --cwd example",
|
|
36
33
|
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
37
|
-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
|
|
34
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
|
|
35
|
+
"postinstall": "npm run typescript"
|
|
38
36
|
},
|
|
39
37
|
"keywords": [
|
|
40
38
|
"react-native",
|
|
41
39
|
"ios",
|
|
42
40
|
"android"
|
|
43
41
|
],
|
|
44
|
-
"repository": "https://github.com/tryVital/vital-react-native",
|
|
42
|
+
"repository": "https://github.com/tryVital/vital-health-react-native",
|
|
45
43
|
"author": "Vital",
|
|
46
44
|
"bugs": {
|
|
47
|
-
"url": "https://github.com/tryVital/vital-react-native/issues"
|
|
45
|
+
"url": "https://github.com/tryVital/vital-health-react-native/issues"
|
|
48
46
|
},
|
|
49
|
-
"homepage": "https://github.com/tryVital/vital-react-native#readme",
|
|
47
|
+
"homepage": "https://github.com/tryVital/vital-health-react-native#readme",
|
|
50
48
|
"publishConfig": {
|
|
51
49
|
"registry": "https://registry.npmjs.org/"
|
|
52
50
|
},
|
|
@@ -141,19 +139,5 @@
|
|
|
141
139
|
"tabWidth": 2,
|
|
142
140
|
"trailingComma": "es5",
|
|
143
141
|
"useTabs": false
|
|
144
|
-
},
|
|
145
|
-
"react-native-builder-bob": {
|
|
146
|
-
"source": "src",
|
|
147
|
-
"output": "lib",
|
|
148
|
-
"targets": [
|
|
149
|
-
"commonjs",
|
|
150
|
-
"module",
|
|
151
|
-
[
|
|
152
|
-
"typescript",
|
|
153
|
-
{
|
|
154
|
-
"project": "tsconfig.build.json"
|
|
155
|
-
}
|
|
156
|
-
]
|
|
157
|
-
]
|
|
158
142
|
}
|
|
159
143
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import { NativeModules, Platform
|
|
1
|
+
import {NativeEventEmitter, NativeModules, Platform} from 'react-native';
|
|
2
2
|
|
|
3
3
|
const LINKING_ERROR =
|
|
4
4
|
`The package 'vital-health-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
-
Platform.select({
|
|
5
|
+
Platform.select({ios: "- You have run 'pod install'\n", default: ''}) +
|
|
6
6
|
'- You rebuilt the app after installing the package\n' +
|
|
7
7
|
'- You are not using Expo Go\n';
|
|
8
8
|
|
|
9
9
|
const VitalHealthReactNative = NativeModules.VitalHealthReactNative
|
|
10
10
|
? NativeModules.VitalHealthReactNative
|
|
11
11
|
: new Proxy(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
19
20
|
|
|
20
21
|
export class VitalHealth {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
static status = new NativeEventEmitter(VitalHealthReactNative);
|
|
24
|
+
|
|
25
|
+
static configure(backgroundDeliveryEnabled: boolean, numberOfDaysToBackFill: number, enableLogs: boolean): Promise<void> {
|
|
26
|
+
return VitalHealthReactNative.configure(backgroundDeliveryEnabled, numberOfDaysToBackFill, enableLogs);
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
static askForResources(resources: VitalResource[]): Promise<void> {
|
|
@@ -40,15 +44,15 @@ export class VitalHealth {
|
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
export enum VitalResource {
|
|
43
|
-
Profile =
|
|
44
|
-
Body =
|
|
45
|
-
Workout =
|
|
46
|
-
Activity =
|
|
47
|
-
Sleep =
|
|
48
|
-
Glucose =
|
|
49
|
-
BloodPressure =
|
|
50
|
-
HeartRate =
|
|
51
|
-
Steps =
|
|
52
|
-
ActiveEnergyBurned =
|
|
53
|
-
BasalEnergyBurned =
|
|
54
|
-
}
|
|
47
|
+
Profile = 'profile',
|
|
48
|
+
Body = 'body',
|
|
49
|
+
Workout = 'workout',
|
|
50
|
+
Activity = 'activity',
|
|
51
|
+
Sleep = 'sleep',
|
|
52
|
+
Glucose = 'glucose',
|
|
53
|
+
BloodPressure = 'bloodPressure',
|
|
54
|
+
HeartRate = 'heartRate',
|
|
55
|
+
Steps = 'steps',
|
|
56
|
+
ActiveEnergyBurned = 'activeEnergyBurned',
|
|
57
|
+
BasalEnergyBurned = 'basalEnergyBurned',
|
|
58
|
+
}
|
|
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
19
|
s.dependency "React-Core"
|
|
20
|
-
s.dependency "VitalHealthKit", "~> 0.7.
|
|
20
|
+
s.dependency "VitalHealthKit", "~> 0.7.8"
|
|
21
21
|
|
|
22
22
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
23
23
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
package/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
|
2
|
-
# coding styles between different editors and IDEs
|
|
3
|
-
# editorconfig.org
|
|
4
|
-
|
|
5
|
-
root = true
|
|
6
|
-
|
|
7
|
-
[*]
|
|
8
|
-
|
|
9
|
-
indent_style = space
|
|
10
|
-
indent_size = 2
|
|
11
|
-
|
|
12
|
-
end_of_line = lf
|
|
13
|
-
charset = utf-8
|
|
14
|
-
trim_trailing_whitespace = true
|
|
15
|
-
insert_final_newline = true
|
package/.gitattributes
DELETED
package/.gitignore
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# OSX
|
|
2
|
-
#
|
|
3
|
-
.DS_Store
|
|
4
|
-
|
|
5
|
-
# XDE
|
|
6
|
-
.expo/
|
|
7
|
-
|
|
8
|
-
# VSCode
|
|
9
|
-
.vscode/
|
|
10
|
-
jsconfig.json
|
|
11
|
-
|
|
12
|
-
# Xcode
|
|
13
|
-
#
|
|
14
|
-
build/
|
|
15
|
-
*.pbxuser
|
|
16
|
-
!default.pbxuser
|
|
17
|
-
*.mode1v3
|
|
18
|
-
!default.mode1v3
|
|
19
|
-
*.mode2v3
|
|
20
|
-
!default.mode2v3
|
|
21
|
-
*.perspectivev3
|
|
22
|
-
!default.perspectivev3
|
|
23
|
-
xcuserdata
|
|
24
|
-
*.xccheckout
|
|
25
|
-
*.moved-aside
|
|
26
|
-
DerivedData
|
|
27
|
-
*.hmap
|
|
28
|
-
*.ipa
|
|
29
|
-
*.xcuserstate
|
|
30
|
-
project.xcworkspace
|
|
31
|
-
|
|
32
|
-
# Android/IJ
|
|
33
|
-
#
|
|
34
|
-
.classpath
|
|
35
|
-
.cxx
|
|
36
|
-
.gradle
|
|
37
|
-
.idea
|
|
38
|
-
.project
|
|
39
|
-
.settings
|
|
40
|
-
local.properties
|
|
41
|
-
android.iml
|
|
42
|
-
|
|
43
|
-
# Cocoapods
|
|
44
|
-
#
|
|
45
|
-
example/ios/Pods
|
|
46
|
-
|
|
47
|
-
# Ruby
|
|
48
|
-
example/vendor/
|
|
49
|
-
|
|
50
|
-
# node.js
|
|
51
|
-
#
|
|
52
|
-
node_modules/
|
|
53
|
-
npm-debug.log
|
|
54
|
-
yarn-debug.log
|
|
55
|
-
yarn-error.log
|
|
56
|
-
|
|
57
|
-
# BUCK
|
|
58
|
-
buck-out/
|
|
59
|
-
\.buckd/
|
|
60
|
-
android/app/libs
|
|
61
|
-
android/keystores/debug.keystore
|
|
62
|
-
|
|
63
|
-
# Expo
|
|
64
|
-
.expo/
|
|
65
|
-
|
|
66
|
-
# Turborepo
|
|
67
|
-
.turbo/
|
|
68
|
-
|
|
69
|
-
# generated by bob
|
|
70
|
-
lib/
|
package/.watchmanconfig
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
package/.yarnrc
DELETED
package/babel.config.js
DELETED
package/lefthook.yml
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
pre-commit:
|
|
2
|
-
parallel: true
|
|
3
|
-
commands:
|
|
4
|
-
lint:
|
|
5
|
-
files: git diff --name-only @{push}
|
|
6
|
-
glob: "*.{js,ts,jsx,tsx}"
|
|
7
|
-
run: npx eslint {files}
|
|
8
|
-
types:
|
|
9
|
-
files: git diff --name-only @{push}
|
|
10
|
-
glob: "*.{js,ts, jsx, tsx}"
|
|
11
|
-
run: npx tsc --noEmit
|
|
12
|
-
commit-msg:
|
|
13
|
-
parallel: true
|
|
14
|
-
commands:
|
|
15
|
-
commitlint:
|
|
16
|
-
run: npx commitlint --edit
|
package/lib/commonjs/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.VitalResource = exports.VitalHealth = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
const LINKING_ERROR = `The package 'vital-health-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
9
|
-
ios: "- You have run 'pod install'\n",
|
|
10
|
-
default: ''
|
|
11
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
12
|
-
const VitalHealthReactNative = _reactNative.NativeModules.VitalHealthReactNative ? _reactNative.NativeModules.VitalHealthReactNative : new Proxy({}, {
|
|
13
|
-
get() {
|
|
14
|
-
throw new Error(LINKING_ERROR);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
class VitalHealth {
|
|
18
|
-
static configure(backgroundDeliveryEnabled, numberOfDaysToBackFill, enableLogs) {
|
|
19
|
-
return VitalHealthReactNative.configure(backgroundDeliveryEnabled, numberOfDaysToBackFill, enableLogs);
|
|
20
|
-
}
|
|
21
|
-
static askForResources(resources) {
|
|
22
|
-
return VitalHealthReactNative.askForResources(resources);
|
|
23
|
-
}
|
|
24
|
-
static hasAskedForPermission(resource) {
|
|
25
|
-
return VitalHealthReactNative.hasAskedForPermission(resource);
|
|
26
|
-
}
|
|
27
|
-
static syncData(resources) {
|
|
28
|
-
return VitalHealthReactNative.syncData(resources);
|
|
29
|
-
}
|
|
30
|
-
static cleanUp() {
|
|
31
|
-
return VitalHealthReactNative.cleanUp();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.VitalHealth = VitalHealth;
|
|
35
|
-
let VitalResource;
|
|
36
|
-
exports.VitalResource = VitalResource;
|
|
37
|
-
(function (VitalResource) {
|
|
38
|
-
VitalResource["Profile"] = "profile";
|
|
39
|
-
VitalResource["Body"] = "body";
|
|
40
|
-
VitalResource["Workout"] = "workout";
|
|
41
|
-
VitalResource["Activity"] = "activity";
|
|
42
|
-
VitalResource["Sleep"] = "sleep";
|
|
43
|
-
VitalResource["Glucose"] = "glucose";
|
|
44
|
-
VitalResource["BloodPressure"] = "bloodPressure";
|
|
45
|
-
VitalResource["HeartRate"] = "heartRate";
|
|
46
|
-
VitalResource["Steps"] = "steps";
|
|
47
|
-
VitalResource["ActiveEnergyBurned"] = "activeEnergyBurned";
|
|
48
|
-
VitalResource["BasalEnergyBurned"] = "basalEnergyBurned";
|
|
49
|
-
})(VitalResource || (exports.VitalResource = VitalResource = {}));
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","VitalHealthReactNative","NativeModules","Proxy","get","Error","VitalHealth","configure","backgroundDeliveryEnabled","numberOfDaysToBackFill","enableLogs","askForResources","resources","hasAskedForPermission","resource","syncData","cleanUp","VitalResource"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA;AAEA,MAAMA,aAAa,GAChB,oFAAmF,GACpFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,sBAAsB,GAAGC,0BAAa,CAACD,sBAAsB,GAC/DC,0BAAa,CAACD,sBAAsB,GACpC,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEE,MAAMU,WAAW,CAAC;EACtB,OAAOC,SAAS,CAACC,yBAAkC,EAAEC,sBAA8B,EAAEC,UAAmB,EAAiB;IACtH,OAAOT,sBAAsB,CAACM,SAAS,CAACC,yBAAyB,EAAEC,sBAAsB,EAAEC,UAAU,CAAC;EAC1G;EAEA,OAAOC,eAAe,CAACC,SAA0B,EAAiB;IAChE,OAAOX,sBAAsB,CAACU,eAAe,CAACC,SAAS,CAAC;EAC1D;EAEA,OAAOC,qBAAqB,CAACC,QAAuB,EAAoB;IACtE,OAAOb,sBAAsB,CAACY,qBAAqB,CAACC,QAAQ,CAAC;EAC/D;EAEA,OAAOC,QAAQ,CAACH,SAA0B,EAAiB;IACzD,OAAOX,sBAAsB,CAACc,QAAQ,CAACH,SAAS,CAAC;EACnD;EAEA,OAAOI,OAAO,GAAkB;IAC9B,OAAOf,sBAAsB,CAACe,OAAO,EAAE;EACzC;AACF;AAAC;AAAA,IAEWC,aAAa;AAAA;AAAA,WAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,6BAAbA,aAAa"}
|
package/lib/module/index.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { NativeModules, Platform } from 'react-native';
|
|
2
|
-
const LINKING_ERROR = `The package 'vital-health-react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
-
ios: "- You have run 'pod install'\n",
|
|
4
|
-
default: ''
|
|
5
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
6
|
-
const VitalHealthReactNative = NativeModules.VitalHealthReactNative ? NativeModules.VitalHealthReactNative : new Proxy({}, {
|
|
7
|
-
get() {
|
|
8
|
-
throw new Error(LINKING_ERROR);
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
export class VitalHealth {
|
|
12
|
-
static configure(backgroundDeliveryEnabled, numberOfDaysToBackFill, enableLogs) {
|
|
13
|
-
return VitalHealthReactNative.configure(backgroundDeliveryEnabled, numberOfDaysToBackFill, enableLogs);
|
|
14
|
-
}
|
|
15
|
-
static askForResources(resources) {
|
|
16
|
-
return VitalHealthReactNative.askForResources(resources);
|
|
17
|
-
}
|
|
18
|
-
static hasAskedForPermission(resource) {
|
|
19
|
-
return VitalHealthReactNative.hasAskedForPermission(resource);
|
|
20
|
-
}
|
|
21
|
-
static syncData(resources) {
|
|
22
|
-
return VitalHealthReactNative.syncData(resources);
|
|
23
|
-
}
|
|
24
|
-
static cleanUp() {
|
|
25
|
-
return VitalHealthReactNative.cleanUp();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export let VitalResource;
|
|
29
|
-
(function (VitalResource) {
|
|
30
|
-
VitalResource["Profile"] = "profile";
|
|
31
|
-
VitalResource["Body"] = "body";
|
|
32
|
-
VitalResource["Workout"] = "workout";
|
|
33
|
-
VitalResource["Activity"] = "activity";
|
|
34
|
-
VitalResource["Sleep"] = "sleep";
|
|
35
|
-
VitalResource["Glucose"] = "glucose";
|
|
36
|
-
VitalResource["BloodPressure"] = "bloodPressure";
|
|
37
|
-
VitalResource["HeartRate"] = "heartRate";
|
|
38
|
-
VitalResource["Steps"] = "steps";
|
|
39
|
-
VitalResource["ActiveEnergyBurned"] = "activeEnergyBurned";
|
|
40
|
-
VitalResource["BasalEnergyBurned"] = "basalEnergyBurned";
|
|
41
|
-
})(VitalResource || (VitalResource = {}));
|
|
42
|
-
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","VitalHealthReactNative","Proxy","get","Error","VitalHealth","configure","backgroundDeliveryEnabled","numberOfDaysToBackFill","enableLogs","askForResources","resources","hasAskedForPermission","resource","syncData","cleanUp","VitalResource"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GAChB,oFAAmF,GACpFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,sBAAsB,GAAGN,aAAa,CAACM,sBAAsB,GAC/DN,aAAa,CAACM,sBAAsB,GACpC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEL,OAAO,MAAMQ,WAAW,CAAC;EACtB,OAAOC,SAAS,CAACC,yBAAkC,EAAEC,sBAA8B,EAAEC,UAAmB,EAAiB;IACtH,OAAOR,sBAAsB,CAACK,SAAS,CAACC,yBAAyB,EAAEC,sBAAsB,EAAEC,UAAU,CAAC;EAC1G;EAEA,OAAOC,eAAe,CAACC,SAA0B,EAAiB;IAChE,OAAOV,sBAAsB,CAACS,eAAe,CAACC,SAAS,CAAC;EAC1D;EAEA,OAAOC,qBAAqB,CAACC,QAAuB,EAAoB;IACtE,OAAOZ,sBAAsB,CAACW,qBAAqB,CAACC,QAAQ,CAAC;EAC/D;EAEA,OAAOC,QAAQ,CAACH,SAA0B,EAAiB;IACzD,OAAOV,sBAAsB,CAACa,QAAQ,CAACH,SAAS,CAAC;EACnD;EAEA,OAAOI,OAAO,GAAkB;IAC9B,OAAOd,sBAAsB,CAACc,OAAO,EAAE;EACzC;AACF;AAEA,WAAYC,aAAa;AAYxB,WAZWA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,KAAbA,aAAa"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/index.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare class VitalHealth {
|
|
2
|
-
static configure(backgroundDeliveryEnabled: boolean, numberOfDaysToBackFill: number, enableLogs: boolean): Promise<void>;
|
|
3
|
-
static askForResources(resources: VitalResource[]): Promise<void>;
|
|
4
|
-
static hasAskedForPermission(resource: VitalResource): Promise<boolean>;
|
|
5
|
-
static syncData(resources: VitalResource[]): Promise<void>;
|
|
6
|
-
static cleanUp(): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
export declare enum VitalResource {
|
|
9
|
-
Profile = "profile",
|
|
10
|
-
Body = "body",
|
|
11
|
-
Workout = "workout",
|
|
12
|
-
Activity = "activity",
|
|
13
|
-
Sleep = "sleep",
|
|
14
|
-
Glucose = "glucose",
|
|
15
|
-
BloodPressure = "bloodPressure",
|
|
16
|
-
HeartRate = "heartRate",
|
|
17
|
-
Steps = "steps",
|
|
18
|
-
ActiveEnergyBurned = "activeEnergyBurned",
|
|
19
|
-
BasalEnergyBurned = "basalEnergyBurned"
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAmBA,qBAAa,WAAW;IACrB,MAAM,CAAC,SAAS,CAAC,yBAAyB,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzH,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvE,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1D,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC;AAED,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;CACxC"}
|
package/scripts/bootstrap.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const os = require('os');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const child_process = require('child_process');
|
|
4
|
-
|
|
5
|
-
const root = path.resolve(__dirname, '..');
|
|
6
|
-
const args = process.argv.slice(2);
|
|
7
|
-
const options = {
|
|
8
|
-
cwd: process.cwd(),
|
|
9
|
-
env: process.env,
|
|
10
|
-
stdio: 'inherit',
|
|
11
|
-
encoding: 'utf-8',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
if (os.type() === 'Windows_NT') {
|
|
15
|
-
options.shell = true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let result;
|
|
19
|
-
|
|
20
|
-
if (process.cwd() !== root || args.length) {
|
|
21
|
-
// We're not in the root of the project, or additional arguments were passed
|
|
22
|
-
// In this case, forward the command to `yarn`
|
|
23
|
-
result = child_process.spawnSync('yarn', args, options);
|
|
24
|
-
} else {
|
|
25
|
-
// If `yarn` is run without arguments, perform bootstrap
|
|
26
|
-
result = child_process.spawnSync('yarn', ['bootstrap'], options);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
process.exitCode = result.status;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
it.todo('write a test');
|
package/tsconfig.build.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": "./",
|
|
4
|
-
"paths": {
|
|
5
|
-
"vital-health-react-native": ["./src/index"]
|
|
6
|
-
},
|
|
7
|
-
"allowUnreachableCode": false,
|
|
8
|
-
"allowUnusedLabels": false,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"importsNotUsedAsValues": "error",
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"lib": ["esnext"],
|
|
14
|
-
"module": "esnext",
|
|
15
|
-
"moduleResolution": "node",
|
|
16
|
-
"noFallthroughCasesInSwitch": true,
|
|
17
|
-
"noImplicitReturns": true,
|
|
18
|
-
"noImplicitUseStrict": false,
|
|
19
|
-
"noStrictGenericChecks": false,
|
|
20
|
-
"noUncheckedIndexedAccess": true,
|
|
21
|
-
"noUnusedLocals": true,
|
|
22
|
-
"noUnusedParameters": true,
|
|
23
|
-
"resolveJsonModule": true,
|
|
24
|
-
"skipLibCheck": true,
|
|
25
|
-
"strict": true,
|
|
26
|
-
"target": "esnext"
|
|
27
|
-
}
|
|
28
|
-
}
|