@tryvital/vital-health-react-native 2.0.1 → 2.0.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/.editorconfig +15 -0
- package/.gitattributes +3 -0
- package/.gitignore +70 -0
- package/.watchmanconfig +1 -0
- package/.yarnrc +3 -0
- package/android/build.gradle +1 -1
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/app.plugin.js +33 -0
- package/babel.config.js +3 -0
- package/lib/commonjs/health_config.js +16 -7
- package/lib/commonjs/health_config.js.map +1 -1
- package/lib/commonjs/index.js +18 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/health_config.js +16 -7
- package/lib/module/health_config.js.map +1 -1
- package/lib/module/index.js +12 -8
- package/lib/module/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/bootstrap.js +29 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +29 -0
- package/vital-health-react-native.podspec +1 -1
- package/yarn.lock +8788 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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
ADDED
package/.gitignore
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/.yarnrc
ADDED
package/android/build.gradle
CHANGED
package/app.plugin.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const { withEntitlementsPlist, withInfoPlist } = require('@expo/config-plugins')
|
|
2
|
+
|
|
3
|
+
const HEALTH_SHARE = 'Allow $(PRODUCT_NAME) to check health info'
|
|
4
|
+
|
|
5
|
+
const withHealthKit = (
|
|
6
|
+
config,
|
|
7
|
+
{ healthSharePermission } = {},
|
|
8
|
+
) => {
|
|
9
|
+
// Add permissions
|
|
10
|
+
config = withInfoPlist(config, (config) => {
|
|
11
|
+
config.modResults.NSHealthShareUsageDescription =
|
|
12
|
+
healthSharePermission ||
|
|
13
|
+
config.modResults.NSHealthShareUsageDescription ||
|
|
14
|
+
HEALTH_SHARE
|
|
15
|
+
|
|
16
|
+
return config
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
// Add entitlements. These are automatically synced when using EAS build for production apps.
|
|
20
|
+
config = withEntitlementsPlist(config, (config) => {
|
|
21
|
+
config.modResults['com.apple.developer.healthkit'] = true
|
|
22
|
+
if (
|
|
23
|
+
!Array.isArray(config.modResults['com.apple.developer.healthkit.access'])
|
|
24
|
+
) {
|
|
25
|
+
config.modResults['com.apple.developer.healthkit.access'] = []
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return config
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
return config
|
|
32
|
+
}
|
|
33
|
+
module.exports = withHealthKit
|
package/babel.config.js
ADDED
|
@@ -4,20 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.IOSHealthConfig = exports.HealthConfig = exports.AndroidHealthConfig = void 0;
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
10
|
class HealthConfig {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
constructor() {
|
|
12
|
+
_defineProperty(this, "logsEnabled", true);
|
|
13
|
+
_defineProperty(this, "numberOfDaysToBackFill", 30);
|
|
14
|
+
_defineProperty(this, "androidConfig", new AndroidHealthConfig());
|
|
15
|
+
_defineProperty(this, "iOSConfig", new IOSHealthConfig());
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
18
|
exports.HealthConfig = HealthConfig;
|
|
14
19
|
class AndroidHealthConfig {
|
|
15
|
-
|
|
20
|
+
constructor() {
|
|
21
|
+
_defineProperty(this, "syncOnAppStart", true);
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
exports.AndroidHealthConfig = AndroidHealthConfig;
|
|
18
25
|
class IOSHealthConfig {
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
constructor() {
|
|
27
|
+
_defineProperty(this, "dataPushMode", 'automatic');
|
|
28
|
+
_defineProperty(this, "backgroundDeliveryEnabled", true);
|
|
29
|
+
}
|
|
21
30
|
}
|
|
22
31
|
exports.IOSHealthConfig = IOSHealthConfig;
|
|
23
32
|
//# sourceMappingURL=health_config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HealthConfig","
|
|
1
|
+
{"version":3,"names":["HealthConfig","AndroidHealthConfig","IOSHealthConfig"],"sourceRoot":"../../src","sources":["health_config.ts"],"mappings":";;;;;;;;;AAAO,MAAMA,YAAY,CAAC;EAAA;IAAA,qCACV,IAAI;IAAA,gDACO,EAAE;IAAA,uCACX,IAAIC,mBAAmB,EAAE;IAAA,mCAC7B,IAAIC,eAAe,EAAE;EAAA;AACnC;AAAC;AAEM,MAAMD,mBAAmB,CAAC;EAAA;IAAA,wCACd,IAAI;EAAA;AACvB;AAAC;AAEM,MAAMC,eAAe,CAAC;EAAA;IAAA,sCACZ,WAAW;IAAA,mDACE,IAAI;EAAA;AAClC;AAAC"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -24,8 +24,9 @@ Object.keys(_health_config).forEach(function (key) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
28
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
29
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
29
30
|
const LINKING_ERROR = `The package 'vital-health-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
30
31
|
ios: "- You have run 'pod install'\n",
|
|
31
32
|
default: ''
|
|
@@ -35,12 +36,13 @@ const VitalHealthReactNative = _reactNative.NativeModules.VitalHealthReactNative
|
|
|
35
36
|
throw new Error(LINKING_ERROR);
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
|
-
const VitalHealthReactNativeModule =
|
|
39
|
-
|
|
39
|
+
const VitalHealthReactNativeModule = VitalHealthReactNative;
|
|
40
|
+
exports.VitalHealthReactNativeModule = VitalHealthReactNativeModule;
|
|
41
|
+
const VitalHealthEvents = {
|
|
40
42
|
statusEvent: 'Status'
|
|
41
43
|
};
|
|
44
|
+
exports.VitalHealthEvents = VitalHealthEvents;
|
|
42
45
|
class VitalHealth {
|
|
43
|
-
static status = new _reactNative.NativeEventEmitter(VitalHealthReactNative);
|
|
44
46
|
static configure(healthConfig) {
|
|
45
47
|
if (_reactNative.Platform.OS === 'android') {
|
|
46
48
|
return VitalHealthReactNative.configure(healthConfig.androidConfig.syncOnAppStart, healthConfig.numberOfDaysToBackFill, healthConfig.logsEnabled);
|
|
@@ -66,7 +68,8 @@ class VitalHealth {
|
|
|
66
68
|
static hasAskedForPermission(resource) {
|
|
67
69
|
return VitalHealthReactNative.hasAskedForPermission(resource);
|
|
68
70
|
}
|
|
69
|
-
static syncData(
|
|
71
|
+
static syncData() {
|
|
72
|
+
let resources = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
70
73
|
return VitalHealthReactNative.syncData(resources);
|
|
71
74
|
}
|
|
72
75
|
static cleanUp() {
|
|
@@ -76,7 +79,10 @@ class VitalHealth {
|
|
|
76
79
|
|
|
77
80
|
// noinspection JSUnusedGlobalSymbols
|
|
78
81
|
exports.VitalHealth = VitalHealth;
|
|
79
|
-
|
|
82
|
+
_defineProperty(VitalHealth, "status", new _reactNative.NativeEventEmitter(VitalHealthReactNative));
|
|
83
|
+
let VitalResource;
|
|
84
|
+
exports.VitalResource = VitalResource;
|
|
85
|
+
(function (VitalResource) {
|
|
80
86
|
VitalResource["Profile"] = "profile";
|
|
81
87
|
VitalResource["Body"] = "body";
|
|
82
88
|
VitalResource["Workout"] = "workout";
|
|
@@ -91,12 +97,12 @@ let VitalResource = exports.VitalResource = /*#__PURE__*/function (VitalResource
|
|
|
91
97
|
VitalResource["Water"] = "water";
|
|
92
98
|
VitalResource["Caffeine"] = "caffeine";
|
|
93
99
|
VitalResource["MindfulSession"] = "mindfulSession";
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
})(VitalResource || (exports.VitalResource = VitalResource = {}));
|
|
101
|
+
let VitalWriteResource; // iOS only, value is ignored
|
|
102
|
+
exports.VitalWriteResource = VitalWriteResource;
|
|
103
|
+
(function (VitalWriteResource) {
|
|
97
104
|
VitalWriteResource["Water"] = "water";
|
|
98
105
|
VitalWriteResource["Caffeine"] = "caffeine";
|
|
99
106
|
VitalWriteResource["MindfulSession"] = "mindfulSession";
|
|
100
|
-
|
|
101
|
-
}({}); // iOS only, value is ignored
|
|
107
|
+
})(VitalWriteResource || (exports.VitalWriteResource = VitalWriteResource = {}));
|
|
102
108
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","VitalHealthReactNative","NativeModules","Proxy","get","Error","VitalHealthReactNativeModule","VitalHealthEvents","statusEvent","VitalHealth","configure","healthConfig","OS","androidConfig","syncOnAppStart","numberOfDaysToBackFill","logsEnabled","iOSConfig","backgroundDeliveryEnabled","setUserId","userId","configureClient","apiKey","environment","region","enableLogs","askForResources","resources","ask","readResources","writeResources","writeHealthData","resource","value","startDate","endDate","getTime","hasAskedForPermission","syncData","cleanUp","NativeEventEmitter","VitalResource","VitalWriteResource"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;AAAA;AAIA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAAgC;AAAA;AAAA;AAEhC,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,4BAA4B,GAAGL,sBAAsB;AAAC;AAE5D,MAAMM,iBAAiB,GAAG;EAC/BC,WAAW,EAAE;AACf,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L,QAAQ,CAAC;EAC/D;EAEA,OAAOM,QAAQ,GAAiD;IAAA,IAAhDX,SAA0B,uEAAG,EAAE;IAC7C,OAAO1B,sBAAsB,CAACqC,QAAQ,CAACX,SAAS,CAAC;EACnD;EAEA,OAAOY,OAAO,GAAkB;IAC9B,OAAOtC,sBAAsB,CAACsC,OAAO,EAAE;EACzC;AACF;;AAEA;AAAA;AAAA,gBA3Ea9B,WAAW,YACN,IAAI+B,+BAAkB,CAACvC,sBAAsB,CAAC;AAAA,IA2EpDwC,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;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,6BAAbA,aAAa;AAAA,IAiBbC,kBAAkB,EAGO;AAAA;AAAA,WAHzBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;AAAA,GAAlBA,kBAAkB,kCAAlBA,kBAAkB"}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
4
|
export class HealthConfig {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
constructor() {
|
|
6
|
+
_defineProperty(this, "logsEnabled", true);
|
|
7
|
+
_defineProperty(this, "numberOfDaysToBackFill", 30);
|
|
8
|
+
_defineProperty(this, "androidConfig", new AndroidHealthConfig());
|
|
9
|
+
_defineProperty(this, "iOSConfig", new IOSHealthConfig());
|
|
10
|
+
}
|
|
6
11
|
}
|
|
7
12
|
export class AndroidHealthConfig {
|
|
8
|
-
|
|
13
|
+
constructor() {
|
|
14
|
+
_defineProperty(this, "syncOnAppStart", true);
|
|
15
|
+
}
|
|
9
16
|
}
|
|
10
17
|
export class IOSHealthConfig {
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
constructor() {
|
|
19
|
+
_defineProperty(this, "dataPushMode", 'automatic');
|
|
20
|
+
_defineProperty(this, "backgroundDeliveryEnabled", true);
|
|
21
|
+
}
|
|
13
22
|
}
|
|
14
23
|
//# sourceMappingURL=health_config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HealthConfig","
|
|
1
|
+
{"version":3,"names":["HealthConfig","AndroidHealthConfig","IOSHealthConfig"],"sourceRoot":"../../src","sources":["health_config.ts"],"mappings":";;;AAAA,OAAO,MAAMA,YAAY,CAAC;EAAA;IAAA,qCACV,IAAI;IAAA,gDACO,EAAE;IAAA,uCACX,IAAIC,mBAAmB,EAAE;IAAA,mCAC7B,IAAIC,eAAe,EAAE;EAAA;AACnC;AAEA,OAAO,MAAMD,mBAAmB,CAAC;EAAA;IAAA,wCACd,IAAI;EAAA;AACvB;AAEA,OAAO,MAAMC,eAAe,CAAC;EAAA;IAAA,sCACZ,WAAW;IAAA,mDACE,IAAI;EAAA;AAClC"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
4
|
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
5
|
// Reexports
|
|
3
6
|
export * from './health_config';
|
|
@@ -15,7 +18,6 @@ export const VitalHealthEvents = {
|
|
|
15
18
|
statusEvent: 'Status'
|
|
16
19
|
};
|
|
17
20
|
export class VitalHealth {
|
|
18
|
-
static status = new NativeEventEmitter(VitalHealthReactNative);
|
|
19
21
|
static configure(healthConfig) {
|
|
20
22
|
if (Platform.OS === 'android') {
|
|
21
23
|
return VitalHealthReactNative.configure(healthConfig.androidConfig.syncOnAppStart, healthConfig.numberOfDaysToBackFill, healthConfig.logsEnabled);
|
|
@@ -41,7 +43,8 @@ export class VitalHealth {
|
|
|
41
43
|
static hasAskedForPermission(resource) {
|
|
42
44
|
return VitalHealthReactNative.hasAskedForPermission(resource);
|
|
43
45
|
}
|
|
44
|
-
static syncData(
|
|
46
|
+
static syncData() {
|
|
47
|
+
let resources = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
45
48
|
return VitalHealthReactNative.syncData(resources);
|
|
46
49
|
}
|
|
47
50
|
static cleanUp() {
|
|
@@ -50,7 +53,9 @@ export class VitalHealth {
|
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
// noinspection JSUnusedGlobalSymbols
|
|
53
|
-
|
|
56
|
+
_defineProperty(VitalHealth, "status", new NativeEventEmitter(VitalHealthReactNative));
|
|
57
|
+
export let VitalResource;
|
|
58
|
+
(function (VitalResource) {
|
|
54
59
|
VitalResource["Profile"] = "profile";
|
|
55
60
|
VitalResource["Body"] = "body";
|
|
56
61
|
VitalResource["Workout"] = "workout";
|
|
@@ -65,12 +70,11 @@ export let VitalResource = /*#__PURE__*/function (VitalResource) {
|
|
|
65
70
|
VitalResource["Water"] = "water";
|
|
66
71
|
VitalResource["Caffeine"] = "caffeine";
|
|
67
72
|
VitalResource["MindfulSession"] = "mindfulSession";
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
})(VitalResource || (VitalResource = {}));
|
|
74
|
+
export let VitalWriteResource; // iOS only, value is ignored
|
|
75
|
+
(function (VitalWriteResource) {
|
|
71
76
|
VitalWriteResource["Water"] = "water";
|
|
72
77
|
VitalWriteResource["Caffeine"] = "caffeine";
|
|
73
78
|
VitalWriteResource["MindfulSession"] = "mindfulSession";
|
|
74
|
-
|
|
75
|
-
}({}); // iOS only, value is ignored
|
|
79
|
+
})(VitalWriteResource || (VitalWriteResource = {}));
|
|
76
80
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","LINKING_ERROR","select","ios","default","VitalHealthReactNative","Proxy","get","Error","VitalHealthReactNativeModule","VitalHealthEvents","statusEvent","VitalHealth","
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","LINKING_ERROR","select","ios","default","VitalHealthReactNative","Proxy","get","Error","VitalHealthReactNativeModule","VitalHealthEvents","statusEvent","VitalHealth","configure","healthConfig","OS","androidConfig","syncOnAppStart","numberOfDaysToBackFill","logsEnabled","iOSConfig","backgroundDeliveryEnabled","setUserId","userId","configureClient","apiKey","environment","region","enableLogs","askForResources","resources","ask","readResources","writeResources","writeHealthData","resource","value","startDate","endDate","getTime","hasAskedForPermission","syncData","cleanUp","VitalResource","VitalWriteResource"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;AAAA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAG1E;AACA,cAAc,iBAAiB;AAE/B,MAAMC,aAAa,GAChB,oFAAmF,GACpFD,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= 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;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": "./",
|
|
4
|
+
"paths": {
|
|
5
|
+
"vital-health-react-native": ["./src/index"]
|
|
6
|
+
},
|
|
7
|
+
"outDir": "./lib",
|
|
8
|
+
"allowUnreachableCode": false,
|
|
9
|
+
"allowUnusedLabels": false,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"importsNotUsedAsValues": "error",
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"jsx": "react",
|
|
14
|
+
"lib": ["esnext"],
|
|
15
|
+
"module": "esnext",
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
19
|
+
"noImplicitUseStrict": false,
|
|
20
|
+
"noStrictGenericChecks": false,
|
|
21
|
+
"noUncheckedIndexedAccess": true,
|
|
22
|
+
"noUnusedLocals": true,
|
|
23
|
+
"noUnusedParameters": true,
|
|
24
|
+
"resolveJsonModule": true,
|
|
25
|
+
"skipLibCheck": true,
|
|
26
|
+
"strict": true,
|
|
27
|
+
"target": "esnext"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -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.10.
|
|
20
|
+
s.dependency "VitalHealthKit", "~> 0.10.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
|