Skip to content

Commit

Permalink
Merge pull request #1 from biklas7/chore/snaq
Browse files Browse the repository at this point in the history
Merge Chore/snaq
  • Loading branch information
biklas7 authored Jan 10, 2024
2 parents 316b282 + 8d542f1 commit 0a63b5b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/health/ios/Classes/SwiftHealthPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ public class SwiftHealthPlugin: NSObject, FlutterPlugin {
else {
throw PluginError(message: "Invalid Arguments")
}

let dateFrom = Date(timeIntervalSince1970: startTime.doubleValue / 1000)
let dateTo = Date(timeIntervalSince1970: endTime.doubleValue / 1000)

Expand Down Expand Up @@ -467,7 +468,8 @@ public class SwiftHealthPlugin: NSObject, FlutterPlugin {
}

if #available(iOS 15.0, *){
let meal = HKCorrelation.init(type: HKCorrelationType.init(HKCorrelationTypeIdentifier.food), start: dateFrom, end: dateTo, objects: nutrition, metadata: metadata)
let type = HKCorrelationType.correlationType(forIdentifier: HKCorrelationTypeIdentifier.food)!
let meal = HKCorrelation(type: type, start: dateFrom, end: dateTo, objects: nutrition, metadata: metadata)

HKHealthStore().save(meal, withCompletion: { (success, error) in
if let err = error {
Expand Down

0 comments on commit 0a63b5b

Please sign in to comment.