react-native-health-connect 0.1.0-alpha.3 → 0.1.0-alpha.4

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 CHANGED
@@ -1,11 +1,15 @@
1
1
  <div align="center">
2
- <a href="https://developer.android.com/guide/health-and-fitness/health-connect">
3
- <img src="https://developer.android.com/static/guide/health-and-fitness/health-connect/images/health_connect_logo_192pxnew.png"><br/>
2
+ <img src="https://developer.android.com/static/guide/health-and-fitness/health-connect/images/health_connect_logo_192pxnew.png" />
3
+ <div align="center">
4
4
  <h1>React Native Health Connect</h1>
5
- </a>
5
+ </div>
6
6
  <div align="center">
7
- <a href="http://www.npmjs.com/package/react-native-health-connect"><img src="https://img.shields.io/npm/v/react-native-health-connect.svg?style=for-the-badge&color=4284F3" /></a>
8
- <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge" /></a>
7
+ <a href="https://www.npmjs.com/package/react-native-health-connect/v/alpha">
8
+ <img src="https://img.shields.io/npm/v/react-native-health-connect/alpha.svg?style=for-the-badge&color=4284F3" />
9
+ </a>
10
+ <a href="https://opensource.org/licenses/MIT">
11
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge" />
12
+ </a>
9
13
  </div>
10
14
  </div>
11
15
 
@@ -22,8 +22,8 @@ fun <T : Record> convertReactRequestOptionsFromJS(
22
22
  recordType,
23
23
  timeRangeFilter = options.getTimeRangeFilter("timeRangeFilter"),
24
24
  dataOriginFilter = convertJsToDataOriginSet(options.getArray("dataOriginFilter")),
25
- ascendingOrder = if (options.hasKey("ascendingOrder")) options.getBoolean("ascendingOrder") else true,
26
- pageSize = if (options.hasKey("pageSize")) options.getInt("pageSize") else 1000,
25
+ ascendingOrder = options.getSafeBoolean("ascendingOrder", true),
26
+ pageSize = options.getSafeInt("pageSize", 1000),
27
27
  pageToken = if (options.hasKey("pageToken")) options.getString("pageToken") else null,
28
28
  )
29
29
  }
@@ -57,7 +57,15 @@ fun ReadableArray.toMapList(): List<ReadableMap> {
57
57
  }
58
58
 
59
59
  fun ReadableMap.getSafeInt(key: String, default: Int): Int {
60
- return if (this.hasKey(key)) this.getInt("measurementLocation") else default
60
+ return if (this.hasKey(key)) this.getInt(key) else default
61
+ }
62
+
63
+ fun ReadableMap.getSafeBoolean(key: String, default: Boolean): Boolean {
64
+ return if (this.hasKey(key)) this.getBoolean(key) else default
65
+ }
66
+
67
+ fun ReadableMap.getSafeString(key: String, default: String): String {
68
+ return if (this.hasKey(key)) this.getString(key) ?: default else default
61
69
  }
62
70
 
63
71
  fun ReadableMap.getTimeRangeFilter(key: String? = null): TimeRangeFilter {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-health-connect",
3
- "version": "0.1.0-alpha.3",
3
+ "version": "0.1.0-alpha.4",
4
4
  "description": "React native library for health connect (Android only)",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -53,8 +53,10 @@
53
53
  },
54
54
  "keywords": [
55
55
  "react-native",
56
- "ios",
57
- "android"
56
+ "health-connect",
57
+ "health-sdk",
58
+ "android",
59
+ "fitness"
58
60
  ],
59
61
  "files": [
60
62
  "src",