Skip to content

Commit

Permalink
fix with timestamps, 1.5.2 preps
Browse files Browse the repository at this point in the history
  • Loading branch information
kvs-coder committed Nov 4, 2021
1 parent 1e1c8b9 commit 5e6328e
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 36 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.5.2] - 04.11.2021

* invalid timstamps fixes for data saving

## [1.5.1] - 15.10.2021

* package minor fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A Flutter wrapper for [HealthKitReporter](https://cocoapods.org/pods/HealthKitRe
- Add this to your package's pubspec.yaml file:
``` Dart
dependencies:
health_kit_reporter: ^1.5.1
health_kit_reporter: ^1.5.2
```
- Get dependencies

Expand Down
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ PODS:
- Flutter (1.0.0)
- flutter_local_notifications (0.0.1):
- Flutter
- health_kit_reporter (1.5.0):
- health_kit_reporter (1.5.1):
- Flutter
- HealthKitReporter
- HealthKitReporter (1.6.1)
- HealthKitReporter (1.6.2)

DEPENDENCIES:
- Flutter (from `Flutter`)
Expand All @@ -27,8 +27,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
health_kit_reporter: 12469a4177d1b3b9d3a1930a07b077619fe131cf
HealthKitReporter: 40e0bd9cecb50e011cebafbe4ba7f8104504ae5b
health_kit_reporter: 60f4e901356f465779dc4a9a315a045721c52f78
HealthKitReporter: e17195a40b8245d8bfa1d80e52bc8297eae9d3be

PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.5.0"
version: "1.5.1"
matcher:
dependency: transitive
description:
Expand Down
24 changes: 21 additions & 3 deletions ios/Classes/SwiftHealthKitReporterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1410,13 +1410,31 @@ extension SwiftHealthKitReporterPlugin {
}
private func parse(arguments: [String: Any]) throws -> Sample {
if let quantity = arguments["quantity"] as? [String: Any] {
return try Quantity.make(from: quantity)
let sample = try Quantity.make(from: quantity)
return sample.copyWith(
startTimestamp: sample.startTimestamp.secondsSince1970,
endTimestamp: sample.endTimestamp.secondsSince1970
)
}
if let category = arguments["category"] as? [String: Any] {
return try Category.make(from: category)
let sample = try Category.make(from: category)
return sample.copyWith(
startTimestamp: sample.startTimestamp.secondsSince1970,
endTimestamp: sample.endTimestamp.secondsSince1970
)
}
if let workout = arguments["workout"] as? [String: Any] {
return try Workout.make(from: workout)
let sample = try Workout.make(from: workout)
return sample.copyWith(
startTimestamp: sample.startTimestamp.secondsSince1970,
endTimestamp: sample.endTimestamp.secondsSince1970,
workoutEvents: sample.workoutEvents.map { event in
event.copyWith(
startTimestamp: event.startTimestamp.secondsSince1970,
endTimestamp: event.endTimestamp.secondsSince1970
)
}
)
}
throw HealthKitError.invalidValue("Invalid arguments: \(arguments)")
}
Expand Down
2 changes: 1 addition & 1 deletion ios/health_kit_reporter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'health_kit_reporter'
s.version = '1.5.1'
s.version = '1.5.2'
s.summary = 'HealthKitReporter. A wrapper for HealthKit framework. A Flutter plugin'
s.swift_versions = '5.3'
s.description = 'Helps to write or read data from Apple Health via HealthKit framework using Flutter.'
Expand Down
36 changes: 18 additions & 18 deletions lib/model/payload/characteristic/fitzpatrick_skin_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@
///
enum FitzpatrickSkinType {
notSet,
I,
II,
III,
IV,
V,
VI,
i,
ii,
iii,
iv,
v,
vi,
}

extension Description on FitzpatrickSkinType {
String get description {
switch (this) {
case FitzpatrickSkinType.notSet:
return 'na';
case FitzpatrickSkinType.I:
case FitzpatrickSkinType.i:
return 'I';
case FitzpatrickSkinType.II:
case FitzpatrickSkinType.ii:
return 'II';
case FitzpatrickSkinType.III:
case FitzpatrickSkinType.iii:
return 'III';
case FitzpatrickSkinType.IV:
case FitzpatrickSkinType.iv:
return 'IV';
case FitzpatrickSkinType.V:
case FitzpatrickSkinType.v:
return 'V';
case FitzpatrickSkinType.VI:
case FitzpatrickSkinType.vi:
return 'VI';
}
}
Expand All @@ -44,17 +44,17 @@ extension FitzpatrickSkinTypeFactory on FitzpatrickSkinType {
case 'na':
return FitzpatrickSkinType.notSet;
case 'I':
return FitzpatrickSkinType.I;
return FitzpatrickSkinType.i;
case 'II':
return FitzpatrickSkinType.II;
return FitzpatrickSkinType.ii;
case 'III':
return FitzpatrickSkinType.III;
return FitzpatrickSkinType.iii;
case 'IV':
return FitzpatrickSkinType.IV;
return FitzpatrickSkinType.iv;
case 'V':
return FitzpatrickSkinType.V;
return FitzpatrickSkinType.v;
case 'VI':
return FitzpatrickSkinType.VI;
return FitzpatrickSkinType.vi;
default:
return null;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/model/payload/sample.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ abstract class Sample<Harmonized> {

/// General constructor from JSON payload
///
Sample.from(Map<String, dynamic> json, Harmonized harmonized)
Sample.from(Map<String, dynamic> json, this.harmonized)
: uuid = json['uuid'],
identifier = json['identifier'],
startTimestamp = json['startTimestamp'],
endTimestamp = json['endTimestamp'],
device =
json['device'] != null ? Device.fromJson(json['device']) : null,
sourceRevision = SourceRevision.fromJson(json['sourceRevision']),
harmonized = harmonized;
sourceRevision = SourceRevision.fromJson(json['sourceRevision']);

/// For saving data, prepares appropriate map
/// for [HealthKitReporter.save]
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: health_kit_reporter
description: Helps to write or read data from Apple Health via HealthKit framework.
version: 1.5.1
version: 1.5.2
homepage: https://github.com/VictorKachalov/health_kit_reporter

environment:
Expand Down
2 changes: 1 addition & 1 deletion test/characteristic_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void main() {
expect(sut.biologicalSex, BiologicalSex.male);
expect(sut.birthday, '1986-09-02T20:56:55.000+02:00'.toString().date);
expect(sut.bloodType, BloodType.abPositive);
expect(sut.fitzpatrickSkinType, FitzpatrickSkinType.II);
expect(sut.fitzpatrickSkinType, FitzpatrickSkinType.ii);
expect(sut.wheelchairUse, WheelchairUse.yes);
expect(sut.activityMoveMode, ActivityMoveMode.activeEnergy);
});
Expand Down
4 changes: 2 additions & 2 deletions test/electrocardiogram_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void main() {
'averageHeartRate': 62,
'classification': 'HKElectrocardiogramClassification',
'samplingFrequencyUnit': 'Hz',
'averageHeartRateUnit': 'count\/min',
'averageHeartRateUnit': 'count/min',
'symptomsStatus': 'HKElectrocardiogramSymptomsStatus',
'samplingFrequency': 512,
'metadata': {
Expand Down Expand Up @@ -66,7 +66,7 @@ void main() {
expect(sut.harmonized.averageHeartRate, 62);
expect(sut.harmonized.classification, 'HKElectrocardiogramClassification');
expect(sut.harmonized.samplingFrequencyUnit, 'Hz');
expect(sut.harmonized.averageHeartRateUnit, 'count\/min');
expect(sut.harmonized.averageHeartRateUnit, 'count/min');
expect(sut.harmonized.symptomsStatus, 'HKElectrocardiogramSymptomsStatus');
expect(sut.harmonized.samplingFrequency, 512);
expect(sut.harmonized.metadata, {
Expand Down
2 changes: 1 addition & 1 deletion test/heartbeat_series_sample_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void main() {
'endTimestamp': 1634309012.3221436,
'harmonized': {
'count': 39,
'series': [
'measurements': [
{
'precededByGap': true,
'done': false,
Expand Down

0 comments on commit 5e6328e

Please sign in to comment.