nativescript-health-data icon indicating copy to clipboard operation
nativescript-health-data copied to clipboard

Support for prior iOS versions

Open nunopedrosa opened this issue 7 years ago • 0 comments

Hi! A few types in https://github.com/EddyVerbruggen/nativescript-health-data/blob/master/src/health-data.ios.ts are breaking compatibility with older iOS versions (plenty of devices running iOS 9.3.5...).

distanceSwimming: HKQuantityTypeIdentifierDistanceSwimming, // iOS 10.0+
distanceWheelChair: HKQuantityTypeIdentifierDistanceWheelchair, // iOS 10.0+
pushCount: HKQuantityTypeIdentifierPushCount, // iOS 10.0+
swimmingStrokeCount: HKQuantityTypeIdentifierSwimmingStrokeCount,  // iOS 10.0+
wheelchairUse: HKCharacteristicTypeIdentifierWheelchairUse,  // iOS 10.0+
mindfulSession: HKCategoryTypeIdentifierMindfulSession, //  iOS 10.0+

Not sure about the best way to deal with this... Does nativescript have some elegant way to detect whether some functionality is available, or does it really have to be some iOS version check? Something like:

  import * as platformModule from "tns-core-modules/platform";

  var sdkVer=  parseFloat(platformModule.device.sdkVersion);
  if (sdkVer >= 10 ) {
          .....
  }

nunopedrosa avatar Mar 26 '18 17:03 nunopedrosa