-
Notifications
You must be signed in to change notification settings - Fork 752
Refactored Swift native implementation #1175
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
Conversation
Only files under |
# Conflicts: # packages/health/CHANGELOG.md # packages/health/ios/Classes/SwiftHealthPlugin.swift # packages/health/ios/health.podspec # packages/health/pubspec.yaml
…12/refactor # Conflicts: # packages/health/CHANGELOG.md # packages/health/ios/health.podspec # packages/health/pubspec.yaml
Error deleting data:
|
It worked well on the Carp Studies, example app gives error above but data seems to be deleted nevertheless. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the same errors when deleting data as reported by @Panosfunk - but othervise it seems to work fine.
But I get the
Warning: Health data type 'GENDER' not found in dataTypesDict
Warning: Health data type 'BLOOD_TYPE' not found in dataTypesDict
Warning: Health data type 'BIRTH_DATE' not found in dataTypesDict
when trying to authenticate. Don't know what this means?
- Includes the Swift Version on the podspec for the health plugin
Any update on this release. waiting for feature blocked in https://github.com/cph-cachet/flutter-plugins/issues/1178 in favour of Health 13 |
…wift-version (chore): Add Swift version to health plugin podspec
# Conflicts: # packages/health/CHANGELOG.md # packages/health/ios/health.podspec # packages/health/pubspec.yaml
@bardram @Panosfunk issues were some data were read-only and some didn't have any samples to be deleted |
This PR refactors the Swift native implementation. It introduces the following new classes:
HealthDataWriter
: writing health data to HealthKit functionsHealthDataReader
: reading health data from HealthKit functionsHealthDataOperations
: managing data permissions and delete functionsHealthConstants
: constants used in the plugin (where types are introduced)HealthUtilities
: helper functions - also includes type conversion helpers forHKWorkoutActivityType
The initialisation of these classes are lazy now to help with performance.
In the new approach, when defining a new method for iOS native, for better error handling the cases should be handled as follow under the
handle(_ call: FlutterMethodCall, result: @escaping FlutterResult)
function:This now requires each new method to throw an error in case of failure.
Supported error codes to be used:
REQUEST_AUTH_ERROR
: Error requesting authorisationPERMISSION_ERROR
: Error checking permissionsWRITE_ERROR
: Error writing [DataType]DELETE_ERROR
: Error deleting dataARGUMENT_ERROR
: Missing required argumentINVALID_TYPE
: Invalid dataTypeKeyHEALTH_ERROR
: Error getting health dataINTERNAL_ERROR
: Internal instance reference lostSTATISTICS_ERROR
: Error getting statisticsSTEPS_ERROR
: Error getting step count