Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added quantity types #7

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
72 changes: 26 additions & 46 deletions Pod/Classes/OMHHealthKitConstantsMapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,7 @@ + (NSString*)stringForHKWorkoutActivityType:(int) enumValue{
case HKWorkoutActivityTypeOther:
return @"HKWorkoutActivityTypeOther";
default:{
NSException *e = [NSException
exceptionWithName:@"HKWorkoutActivityTypeInvalidValue"
reason:@"HKWorkoutActivityType can only have a value from the HKWorkoutActivityType enum"
userInfo:nil];
@throw e;
return @"UNKNOWN";
}
}
}
Expand All @@ -156,11 +152,7 @@ + (NSString*) stringForHKSleepAnalysisValue:(int) enumValue {
return @"Asleep";
break;
default:{
NSException *e = [NSException
exceptionWithName:@"HKCategoryValueSleepAnalysisInvalidValue"
reason:@"HKCategoryValueSleepAnalysis can only have a HKCategoryValueSleepAnalysisInBed or HKCategoryValueSleepAnalysisAsleep value"
userInfo:nil];
@throw e;
return @"UNKNOWN";
}
}
}
Expand All @@ -172,11 +164,7 @@ + (NSString*) stringForHKAppleStandHourValue:(int) enumValue {
case HKCategoryValueAppleStandHourStood:
return @"Standing";
default:{
NSException *e = [NSException
exceptionWithName:@"HKCategoryValueAppleStandHourInvalidValue"
reason:@"HKCategoryValueAppleStandHour can only have a HKCategoryValueAppleStandHourIdle or HKCategoryValueAppleStandHourStood value"
userInfo:nil];
@throw e;
return @"UNKNOWN";
}
}
}
Expand All @@ -194,11 +182,7 @@ + (NSString*) stringForHKCervicalMucusQualityValue:(int) enumValue {
case HKCategoryValueCervicalMucusQualityWatery:
return @"Watery";
default:{
NSException *e = [NSException
exceptionWithName:@"HKCategoryValueCervicalMucusQualityInvalidValue"
reason:@"HKCategoryValueCervicalMucusQuality can only have a value specified in the HKCategoryValueCervicalMucusQuality enum"
userInfo:nil];
@throw e;
return @"UNKNOWN";
}
}
}
Expand All @@ -214,11 +198,7 @@ + (NSString*) stringForHKMenstrualFlowValue:(int) enumValue {
case HKCategoryValueMenstrualFlowHeavy:
return @"Heavy";
default:{
NSException *e = [NSException
exceptionWithName:@"HKCategoryValueMenstrualFlowInvalidValue"
reason:@"HKCategoryValueMenstrualFlow can only have a value specified in the HKCategoryValueMenstrualFlow enum"
userInfo:nil];
@throw e;
return @"UNKNOWN";
}
}
}
Expand All @@ -232,11 +212,7 @@ + (NSString*) stringForHKOvulationTestResultValue:(int) enumValue {
case HKCategoryValueOvulationTestResultIndeterminate:
return @"Indeterminate";
default:{
NSException *e = [NSException
exceptionWithName:@"HKCategoryValueOvulationTestResultInvalidValue"
reason:@"HKCategoryValueOvulationTestResult can only have a value specified in the HKCategoryValueOvulationTestResult enum"
userInfo:nil];
@throw e;
return @"UNKNOWN";
}
}
}
Expand All @@ -247,7 +223,7 @@ + (NSDictionary*)allSupportedTypeIdentifiersToClasses {
typeIdsToClasses = @{ HKWorkoutTypeIdentifier: @"OMHSerializerGenericWorkout"};
}

NSMutableDictionary *allTypeIdsToClasses = [NSMutableDictionary dictionaryWithDictionary:typeIdsToClasses];
NSMutableDictionary *allTypeIdsToClasses = [NSMutableDictionary dictionary];

[allTypeIdsToClasses addEntriesFromDictionary:[self allSupportedCategoryTypeIdentifiersToClasses]];
[allTypeIdsToClasses addEntriesFromDictionary:[self allSupportedCorrelationTypeIdentifiersToClass]];
Expand All @@ -262,7 +238,7 @@ + (NSDictionary*)allSupportedCategoryTypeIdentifiersToClasses {
static NSDictionary* allCategoryTypeIdsToClasses = nil;
if (allCategoryTypeIdsToClasses == nil) {
allCategoryTypeIdsToClasses = @{
HKCategoryTypeIdentifierSleepAnalysis : @"OMHSerializerSleepAnalysis", //Samples with Asleep value use this serializer, samples with InBed value use generic category serializer
HKCategoryTypeIdentifierSleepAnalysis : @"OMHSerializerGenericCategorySample", //Samples with Asleep value use this serializer, samples with InBed value use generic category serializer
HKCategoryTypeIdentifierAppleStandHour : @"OMHSerializerGenericCategorySample",
HKCategoryTypeIdentifierCervicalMucusQuality : @"OMHSerializerGenericCategorySample",
HKCategoryTypeIdentifierIntermenstrualBleeding: @"OMHSerializerGenericCategorySample",
Expand Down Expand Up @@ -292,17 +268,17 @@ + (NSDictionary*)allSupportedQuantityTypeIdentifiersToClass {
static NSDictionary* allQuantityTypeIdsToClasses = nil;
if (allQuantityTypeIdsToClasses == nil) {
allQuantityTypeIdsToClasses = @{
HKQuantityTypeIdentifierActiveEnergyBurned: @"OMHSerializerEnergyBurned",
HKQuantityTypeIdentifierBasalBodyTemperature: @"OMHSerializerBodyTemperature",
HKQuantityTypeIdentifierBasalEnergyBurned: @"OMHSerializerEnergyBurned",
HKQuantityTypeIdentifierActiveEnergyBurned: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBasalBodyTemperature: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBasalEnergyBurned: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBloodAlcoholContent: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBloodGlucose : @"OMHSerializerBloodGlucose",
HKQuantityTypeIdentifierBloodGlucose : @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBloodPressureDiastolic: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBloodPressureSystolic: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBodyFatPercentage: @"OMHSerializerBodyFatPercentage",
HKQuantityTypeIdentifierBodyMass : @"OMHSerializerWeight",
HKQuantityTypeIdentifierBodyMassIndex: @"OMHSerializerBodyMassIndex",
HKQuantityTypeIdentifierBodyTemperature: @"OMHSerializerBodyTemperature",
HKQuantityTypeIdentifierBodyFatPercentage: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBodyMass : @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBodyMassIndex: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierBodyTemperature: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierDietaryBiotin: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierDietaryCaffeine: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierDietaryCalcium: @"OMHSerializerGenericQuantitySample",
Expand Down Expand Up @@ -348,18 +324,22 @@ + (NSDictionary*)allSupportedQuantityTypeIdentifiersToClass {
HKQuantityTypeIdentifierFlightsClimbed: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierForcedExpiratoryVolume1: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierForcedVitalCapacity: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierHeight : @"OMHSerializerHeight",
HKQuantityTypeIdentifierHeartRate : @"OMHSerializerHeartRate",
HKQuantityTypeIdentifierHeight : @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierHeartRate : @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierInhalerUsage: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierLeanBodyMass: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierNikeFuel: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierNumberOfTimesFallen: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierOxygenSaturation: @"OMHSerializerOxygenSaturation",
HKQuantityTypeIdentifierOxygenSaturation: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierPeakExpiratoryFlowRate: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierPeripheralPerfusionIndex: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierRespiratoryRate: @"OMHSerializerRespiratoryRate",
HKQuantityTypeIdentifierStepCount : @"OMHSerializerStepCount",
HKQuantityTypeIdentifierUVExposure: @"OMHSerializerGenericQuantitySample"
HKQuantityTypeIdentifierRespiratoryRate: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierStepCount : @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierUVExposure: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierInsulinDelivery: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierRestingHeartRate: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierWalkingHeartRateAverage: @"OMHSerializerGenericQuantitySample",
HKQuantityTypeIdentifierHeartRateVariabilitySDNN: @"OMHSerializerGenericQuantitySample"
};
}
return allQuantityTypeIdsToClasses;
Expand Down
Loading