Skip to content

Commit 5eb7bdb

Browse files
#72 Add support for HKCharacteristic (Fitzgerald skintype)
1 parent 4151bbf commit 5eb7bdb

File tree

7 files changed

+166
-114
lines changed

7 files changed

+166
-114
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* `readDateOfBirth`: formatted as yyyy-MM-dd
1919
* `readGender`: output = male|female|unknown
2020
* `readBloodType`: output = A+|A-|B+|B-|AB+|AB-|O+|O-|unknown
21+
* `readFitzpatrickSkinType`: output = I|II|III|IV|V|VI|unknown
2122
* `readWeight`: pass in unit (g=gram, kg=kilogram, oz=ounce, lb=pound, st=stone)
2223
* `saveWeight`: pass in unit (g=gram, kg=kilogram, oz=ounce, lb=pound, st=stone) and amount
2324
* `readHeight`: pass in unit (mm=millimeter, cm=centimeter, m=meter, in=inch, ft=foot)

demo/index.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ <h1>Apache Cordova</h1>
4646
<button onclick="readGender()">Read gender</button>
4747
<br/><br/>
4848
<button onclick="readBloodType()">Read bloodtype</button>
49+
&nbsp;&nbsp;
50+
<button onclick="readFitzpatrickSkinType()">Fitzp. Skin type</button>
4951
<br/><br/>
5052
<button onclick="querySampleType()">Query Sample</button>
5153
<br/><br/>
@@ -113,9 +115,9 @@ <h1>Apache Cordova</h1>
113115
function requestAuthorization() {
114116
window.plugins.healthkit.requestAuthorization(
115117
{
116-
'readTypes': ['HKCharacteristicTypeIdentifierDateOfBirth',
118+
readTypes: ['HKCharacteristicTypeIdentifierDateOfBirth',
117119
'HKCategoryTypeIdentifierSleepAnalysis', 'HKQuantityTypeIdentifierActiveEnergyBurned', 'HKQuantityTypeIdentifierHeight'],
118-
'writeTypes': ['HKQuantityTypeIdentifierDietaryEnergyConsumed', 'HKQuantityTypeIdentifierDietaryFatTotal', 'HKQuantityTypeIdentifierStepCount', 'HKQuantityTypeIdentifierActiveEnergyBurned', 'HKQuantityTypeIdentifierHeight', 'HKQuantityTypeIdentifierDistanceCycling']
120+
writeTypes: ['HKQuantityTypeIdentifierDietaryEnergyConsumed', 'HKQuantityTypeIdentifierDietaryFatTotal', 'HKQuantityTypeIdentifierStepCount', 'HKQuantityTypeIdentifierActiveEnergyBurned', 'HKQuantityTypeIdentifierHeight', 'HKQuantityTypeIdentifierDistanceCycling']
119121
},
120122
callback,
121123
callback
@@ -153,6 +155,13 @@ <h1>Apache Cordova</h1>
153155
);
154156
}
155157

158+
function readFitzpatrickSkinType() {
159+
window.plugins.healthkit.readFitzpatrickSkinType(
160+
callback,
161+
callback
162+
);
163+
}
164+
156165
function saveWeight() {
157166
window.plugins.healthkit.saveWeight({
158167
'requestReadPermission': false, // use if your app doesn't need to read
@@ -228,8 +237,9 @@ <h1>Apache Cordova</h1>
228237
{
229238
'startDate': new Date(new Date().getTime() - 3 * 24 * 60 * 60 * 1000), // three days ago
230239
'endDate': new Date(), // now
231-
'sampleType': 'HKQuantityTypeIdentifierStepCount', // anything in HealthKit/HKTypeIdentifiers.h
232-
'unit': 'count' // make sure this is compatible with the sampleType
240+
'sampleType': 'HKQuantityTypeIdentifierBasalBodyTemperature',
241+
//'sampleType': 'HKQuantityTypeIdentifierStepCount', // anything in HealthKit/HKTypeIdentifiers.h
242+
'unit': 'degF' // make sure this is compatible with the sampleType
233243
},
234244
callback,
235245
callback

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.4.2",
2+
"version": "0.5.0",
33
"name": "com.telerik.plugins.healthkit",
44
"cordova_name": "HealthKit",
55
"description": "Interact with the iOS HealthKit SDK.",

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
33
id="com.telerik.plugins.healthkit"
4-
version="0.4.2">
4+
version="0.5.0">
55

66
<name>HealthKit</name>
77

src/ios/HealthKit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- (void) readGender:(CDVInvokedUrlCommand*)command;
1414
- (void) readBloodType:(CDVInvokedUrlCommand*)command;
1515
- (void) readDateOfBirth:(CDVInvokedUrlCommand*)command;
16+
- (void) readFitzpatrickSkinType:(CDVInvokedUrlCommand*)command;
1617

1718
- (void) saveWeight:(CDVInvokedUrlCommand*)command;
1819
- (void) readWeight:(CDVInvokedUrlCommand*)command;

0 commit comments

Comments
 (0)