Commit 07630ce4 authored by Greg Wilson's avatar Greg Wilson

updated BodyMeasurements example app to use 0.1.0 methods

parent b8830be6
...@@ -213,10 +213,11 @@ class BodyStore extends airflux.Store { ...@@ -213,10 +213,11 @@ class BodyStore extends airflux.Store {
let options = { let options = {
unit: "pound" unit: "pound"
}; };
AppleHealthKit.getLatestWeight(options, (err, weight) => { AppleHealthKit.getLatestWeight(options, (err, res) => {
if(this._handleHealthKitError(err, 'getLatestWeight')){ if(this._handleHealthKitError(err, 'getLatestWeight')){
return; return;
} }
let weight = res.value;
weight = _.round(weight,1); weight = _.round(weight,1);
DATA.weight = weight; DATA.weight = weight;
...@@ -253,10 +254,11 @@ class BodyStore extends airflux.Store { ...@@ -253,10 +254,11 @@ class BodyStore extends airflux.Store {
let options = { let options = {
unit: "inch" unit: "inch"
}; };
AppleHealthKit.getLatestHeight(options, (err, height) => { AppleHealthKit.getLatestHeight(options, (err, res) => {
if(this._handleHealthKitError(err, 'getLatestHeight')){ if(this._handleHealthKitError(err, 'getLatestHeight')){
return; return;
} }
let height = res.value;
console.log("HEIGHT: ", height); console.log("HEIGHT: ", height);
if(typeof height === "number" && height > 0){ if(typeof height === "number" && height > 0){
...@@ -331,10 +333,12 @@ class BodyStore extends airflux.Store { ...@@ -331,10 +333,12 @@ class BodyStore extends airflux.Store {
_fetchHealthKitBodyFatPercentage() { _fetchHealthKitBodyFatPercentage() {
let self = this; let self = this;
AppleHealthKit.getLatestBodyFatPercentage({blah:true}, (err, fatPercentage) => { AppleHealthKit.getLatestBodyFatPercentage({blah:true}, (err, res) => {
if(this._handleHealthKitError(err, 'getLatestBodyFatPercentage')){ if(this._handleHealthKitError(err, 'getLatestBodyFatPercentage')){
return; return;
} }
let fatPercentage = res.value;
console.log("BODY FAT PERCENTAGE: ", fatPercentage); console.log("BODY FAT PERCENTAGE: ", fatPercentage);
DATA.bodyFatPercentage = fatPercentage; DATA.bodyFatPercentage = fatPercentage;
self.trigger({ self.trigger({
...@@ -348,10 +352,11 @@ class BodyStore extends airflux.Store { ...@@ -348,10 +352,11 @@ class BodyStore extends airflux.Store {
_fetchHealthKitLeanBodyMass() { _fetchHealthKitLeanBodyMass() {
let self = this; let self = this;
AppleHealthKit.getLatestLeanBodyMass({blah:true}, (err, leanMass) => { AppleHealthKit.getLatestLeanBodyMass({blah:true}, (err, res) => {
if(this._handleHealthKitError(err, 'getLatestLeanBodyMass')){ if(this._handleHealthKitError(err, 'getLatestLeanBodyMass')){
return; return;
} }
let leanMass = res.value;
console.log("LEAN BODY MASS: ", leanMass); console.log("LEAN BODY MASS: ", leanMass);
DATA.leanBodyMass = _.round(leanMass,0); DATA.leanBodyMass = _.round(leanMass,0);
self.trigger({ self.trigger({
...@@ -366,7 +371,7 @@ class BodyStore extends airflux.Store { ...@@ -366,7 +371,7 @@ class BodyStore extends airflux.Store {
_fetchHealthKitStepCountToday() { _fetchHealthKitStepCountToday() {
let self = this; let self = this;
AppleHealthKit.getStepCountForToday({options:"true"}, (err, steps) => { AppleHealthKit.getStepCount({options:"true"}, (err, steps) => {
if(this._handleHealthKitError(err, 'getStepCountForToday')){ if(this._handleHealthKitError(err, 'getStepCountForToday')){
return; return;
} }
...@@ -389,7 +394,7 @@ class BodyStore extends airflux.Store { ...@@ -389,7 +394,7 @@ class BodyStore extends airflux.Store {
let options = { let options = {
date: d.toISOString() date: d.toISOString()
}; };
AppleHealthKit.getStepCountForDay(options, (err, steps) => { AppleHealthKit.getStepCount(options, (err, steps) => {
if(this._handleHealthKitError(err, 'getStepCountForDay')){ if(this._handleHealthKitError(err, 'getStepCountForDay')){
return; return;
} }
...@@ -412,7 +417,7 @@ class BodyStore extends airflux.Store { ...@@ -412,7 +417,7 @@ class BodyStore extends airflux.Store {
let options = { let options = {
startDate: d.toISOString() startDate: d.toISOString()
}; };
AppleHealthKit.getMultiDayStepCounts(options, (err, res) => { AppleHealthKit.getDailyStepCountSamples(options, (err, res) => {
if(this._handleHealthKitError(err, 'getMultiDayStepCounts')){ if(this._handleHealthKitError(err, 'getMultiDayStepCounts')){
return; return;
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
377D44FA1D248091004E35CB /* libRCTAppleHealthKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 377D44F91D24808D004E35CB /* libRCTAppleHealthKit.a */; }; 378DCB661D31876000E83D06 /* libRCTAppleHealthKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 378DCB651D31875D00E83D06 /* libRCTAppleHealthKit.a */; };
37E9B8741D21B52F0090B19B /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 37E9B8731D21B52F0090B19B /* HealthKit.framework */; }; 37E9B8741D21B52F0090B19B /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 37E9B8731D21B52F0090B19B /* HealthKit.framework */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -91,9 +91,9 @@ ...@@ -91,9 +91,9 @@
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
remoteInfo = React; remoteInfo = React;
}; };
377D44F81D24808D004E35CB /* PBXContainerItemProxy */ = { 378DCB641D31875D00E83D06 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 377D44F41D24808D004E35CB /* RCTAppleHealthKit.xcodeproj */; containerPortal = 378DCB601D31875D00E83D06 /* RCTAppleHealthKit.xcodeproj */;
proxyType = 2; proxyType = 2;
remoteGlobalIDString = 3774C88D1D2092F20000B3F3; remoteGlobalIDString = 3774C88D1D2092F20000B3F3;
remoteInfo = RCTAppleHealthKit; remoteInfo = RCTAppleHealthKit;
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = BodyMeasurements/Info.plist; sourceTree = "<group>"; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = BodyMeasurements/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = BodyMeasurements/main.m; sourceTree = "<group>"; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = BodyMeasurements/main.m; sourceTree = "<group>"; };
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; }; 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
377D44F41D24808D004E35CB /* RCTAppleHealthKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAppleHealthKit.xcodeproj; path = "../node_modules/react-native-apple-healthkit/RCTAppleHealthKit.xcodeproj"; sourceTree = "<group>"; }; 378DCB601D31875D00E83D06 /* RCTAppleHealthKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAppleHealthKit.xcodeproj; path = "../node_modules/react-native-apple-healthkit/RCTAppleHealthKit.xcodeproj"; sourceTree = "<group>"; };
37E9B8731D21B52F0090B19B /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; }; 37E9B8731D21B52F0090B19B /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; };
37E9B8751D21B52F0090B19B /* BodyMeasurements.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = BodyMeasurements.entitlements; path = BodyMeasurements/BodyMeasurements.entitlements; sourceTree = "<group>"; }; 37E9B8751D21B52F0090B19B /* BodyMeasurements.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = BodyMeasurements.entitlements; path = BodyMeasurements/BodyMeasurements.entitlements; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
377D44FA1D248091004E35CB /* libRCTAppleHealthKit.a in Frameworks */, 378DCB661D31876000E83D06 /* libRCTAppleHealthKit.a in Frameworks */,
146834051AC3E58100842450 /* libReact.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */,
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
37E9B8741D21B52F0090B19B /* HealthKit.framework in Frameworks */, 37E9B8741D21B52F0090B19B /* HealthKit.framework in Frameworks */,
...@@ -268,10 +268,10 @@ ...@@ -268,10 +268,10 @@
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
377D44F51D24808D004E35CB /* Products */ = { 378DCB611D31875D00E83D06 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
377D44F91D24808D004E35CB /* libRCTAppleHealthKit.a */, 378DCB651D31875D00E83D06 /* libRCTAppleHealthKit.a */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = { 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
377D44F41D24808D004E35CB /* RCTAppleHealthKit.xcodeproj */, 378DCB601D31875D00E83D06 /* RCTAppleHealthKit.xcodeproj */,
146833FF1AC3E56700842450 /* React.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */,
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */,
...@@ -411,8 +411,8 @@ ...@@ -411,8 +411,8 @@
ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
}, },
{ {
ProductGroup = 377D44F51D24808D004E35CB /* Products */; ProductGroup = 378DCB611D31875D00E83D06 /* Products */;
ProjectRef = 377D44F41D24808D004E35CB /* RCTAppleHealthKit.xcodeproj */; ProjectRef = 378DCB601D31875D00E83D06 /* RCTAppleHealthKit.xcodeproj */;
}, },
{ {
ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
...@@ -516,11 +516,11 @@ ...@@ -516,11 +516,11 @@
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR; sourceTree = BUILT_PRODUCTS_DIR;
}; };
377D44F91D24808D004E35CB /* libRCTAppleHealthKit.a */ = { 378DCB651D31875D00E83D06 /* libRCTAppleHealthKit.a */ = {
isa = PBXReferenceProxy; isa = PBXReferenceProxy;
fileType = archive.ar; fileType = archive.ar;
path = libRCTAppleHealthKit.a; path = libRCTAppleHealthKit.a;
remoteRef = 377D44F81D24808D004E35CB /* PBXContainerItemProxy */; remoteRef = 378DCB641D31875D00E83D06 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR; sourceTree = BUILT_PRODUCTS_DIR;
}; };
78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment