From b4135f5863d7b7cafaceae635d6705e42a7710f3 Mon Sep 17 00:00:00 2001
From: Sergei Butko <svbutko@hotmail.com>
Date: Wed, 19 Sep 2018 11:50:25 +0300
Subject: [PATCH 1/2] Add Methods_Dietary into RCTAppleHealthKit.xcodeproj

---
 RCTAppleHealthKit.xcodeproj/project.pbxproj | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/RCTAppleHealthKit.xcodeproj/project.pbxproj b/RCTAppleHealthKit.xcodeproj/project.pbxproj
index ab99383a..34a5219e 100644
--- a/RCTAppleHealthKit.xcodeproj/project.pbxproj
+++ b/RCTAppleHealthKit.xcodeproj/project.pbxproj
@@ -20,6 +20,7 @@
 		61232F931E303758000A5026 /* RCTAppleHealthKit+Methods_Mindfulness.m in Sources */ = {isa = PBXBuildFile; fileRef = 61232F921E303758000A5026 /* RCTAppleHealthKit+Methods_Mindfulness.m */; };
 		64C42D4A1D351A8800A0A8F7 /* RCTAppleHealthKit+Methods_Vitals.m in Sources */ = {isa = PBXBuildFile; fileRef = 64C42D491D351A8800A0A8F7 /* RCTAppleHealthKit+Methods_Vitals.m */; };
 		64E0E73F1D37947B00EAB905 /* RCTAppleHealthKit+Methods_Results.m in Sources */ = {isa = PBXBuildFile; fileRef = 64E0E73E1D37947B00EAB905 /* RCTAppleHealthKit+Methods_Results.m */; };
+		846A98EA215244E7000C3E5D /* RCTAppleHealthKit+Methods_Dietary.m in Sources */ = {isa = PBXBuildFile; fileRef = 846A98E9215244E6000C3E5D /* RCTAppleHealthKit+Methods_Dietary.m */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -61,6 +62,8 @@
 		64C42D491D351A8800A0A8F7 /* RCTAppleHealthKit+Methods_Vitals.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTAppleHealthKit+Methods_Vitals.m"; sourceTree = "<group>"; };
 		64E0E73D1D37947B00EAB905 /* RCTAppleHealthKit+Methods_Results.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTAppleHealthKit+Methods_Results.h"; sourceTree = "<group>"; };
 		64E0E73E1D37947B00EAB905 /* RCTAppleHealthKit+Methods_Results.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTAppleHealthKit+Methods_Results.m"; sourceTree = "<group>"; };
+		846A98E8215244E6000C3E5D /* RCTAppleHealthKit+Methods_Dietary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTAppleHealthKit+Methods_Dietary.h"; sourceTree = "<group>"; };
+		846A98E9215244E6000C3E5D /* RCTAppleHealthKit+Methods_Dietary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTAppleHealthKit+Methods_Dietary.m"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -93,6 +96,8 @@
 		3774C88F1D2092F20000B3F3 /* RCTAppleHealthKit */ = {
 			isa = PBXGroup;
 			children = (
+				846A98E8215244E6000C3E5D /* RCTAppleHealthKit+Methods_Dietary.h */,
+				846A98E9215244E6000C3E5D /* RCTAppleHealthKit+Methods_Dietary.m */,
 				58C81E6E1F84F6970005DD48 /* RCTAppleHealthKit+Methods_Activity.h */,
 				58C81E6D1F84F6970005DD48 /* RCTAppleHealthKit+Methods_Activity.m */,
 				61232F911E303758000A5026 /* RCTAppleHealthKit+Methods_Mindfulness.h */,
@@ -182,6 +187,7 @@
 				37837E7D1DCFE270000201A0 /* RCTAppleHealthKit+Methods_Sleep.m in Sources */,
 				3774C8D41D20C6390000B3F3 /* RCTAppleHealthKit+Methods_Body.m in Sources */,
 				61232F931E303758000A5026 /* RCTAppleHealthKit+Methods_Mindfulness.m in Sources */,
+				846A98EA215244E7000C3E5D /* RCTAppleHealthKit+Methods_Dietary.m in Sources */,
 				64E0E73F1D37947B00EAB905 /* RCTAppleHealthKit+Methods_Results.m in Sources */,
 				64C42D4A1D351A8800A0A8F7 /* RCTAppleHealthKit+Methods_Vitals.m in Sources */,
 				3774C8931D2092F20000B3F3 /* RCTAppleHealthKit.m in Sources */,

From 71fc2399f9d2f6d2b2477edfe769bef0f1bb0e34 Mon Sep 17 00:00:00 2001
From: Sergei Butko <svbutko@hotmail.com>
Date: Tue, 9 Oct 2018 22:31:38 +0300
Subject: [PATCH 2/2] Add TypeScript definition file

---
 index.d.ts | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 index.d.ts

diff --git a/index.d.ts b/index.d.ts
new file mode 100644
index 00000000..eeafb0ac
--- /dev/null
+++ b/index.d.ts
@@ -0,0 +1,62 @@
+declare module "rn-apple-healthkit" {
+    export interface HealthKitPermissions {
+        permissions: {
+            read: string[];
+            write: string[];
+        };
+    }
+
+    export interface AppleHealthKit {
+        initHealthKit(permissions: HealthKitPermissions, callback: (error: string, result: Object) => void): void;
+
+        saveFood(options: Object, callback: (error: string, result: Object) => void): void;
+
+        isAvailable(callback: (error: Object, results: boolean) => void): void;
+
+        getDateOfBirth(options: any, callback: (error: Object, results: HealthDateOfBirth) => void): void;
+
+        getLatestHeight(options: HealthUnitOptions, callback: (err: string, results: HealthValue) => void): void;
+
+        getLatestWeight(options: HealthUnitOptions, callback: (err: string, results: HealthValue) => void): void;
+    }
+
+    export interface HealthDateOfBirth {
+        value: string;
+        age: number;
+    }
+
+    export interface HealthValue {
+        value: number;
+        startDate: string;
+        endDate: string;
+    }
+
+    export interface HealthUnitOptions {
+        unit: HealthUnit;
+    }
+    export enum HealthUnit {
+        bpm = "bpm",
+        calorie = "calorie",
+        celsius = "celsius",
+        count = "count",
+        day = "day",
+        fahrenheit = "fahrenheit",
+        foot = "foot",
+        gram = "gram",
+        hour = "hour",
+        inch = "inch",
+        joule = "joule",
+        meter = "meter",
+        mgPerdL = "mgPerdL",
+        mile = "mile",
+        minute = "minute",
+        mmhg = "mmhg",
+        mmolPerL = "mmolPerL",
+        percent = "percent",
+        pound = "pound",
+        second = "second"
+    }
+
+    const appleHealthKit: AppleHealthKit;
+    export default appleHealthKit;
+}